import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.CTFClock;
import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceProperties;
import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
* The CTf trace handler
*/
protected static final int DEFAULT_CACHE_SIZE = 50000;
+ /*
+ * The Ctf clock unique identifier field
+ */
+ private static final String CLOCK_HOST_PROPERTY = "uuid"; //$NON-NLS-1$
+
// -------------------------------------------
// Fields
// -------------------------------------------
*
* @return null, since the trace has no knowledge of the current location
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentLocation()
+ * @since 3.0
*/
@Override
public ITmfLocation getCurrentLocation() {
return null;
}
+ /**
+ * @since 3.0
+ */
@Override
public double getLocationRatio(ITmfLocation location) {
final CtfLocation curLocation = (CtfLocation) location;
* @param location
* ITmfLocation<?>
* @return ITmfContext
+ * @since 3.0
*/
@Override
public synchronized ITmfContext seekEvent(final ITmfLocation location) {
return fTrace;
}
+ /**
+ * Ctf traces have a clock with a unique uuid that will be used to identify
+ * the host. Traces with the same clock uuid will be known to have been made
+ * on the same machine.
+ *
+ * Note: uuid is an optional field, it may not be there for a clock.
+ */
+ @Override
+ public String getHostId() {
+ CTFClock clock = getCTFTrace().getClock();
+ if (clock != null) {
+ String clockHost = (String) clock.getProperty(CLOCK_HOST_PROPERTY);
+ if (clockHost != null) {
+ return clockHost;
+ }
+ }
+ return super.getHostId();
+ }
+
// -------------------------------------------
// ITmfTraceProperties
// -------------------------------------------
* @param eventName
* The name of the event to check
* @return Whether the event is in the metadata or not
- * @since 2.1
+ * @since 3.0
*/
public boolean hasEvent(final String eventName) {
Map<Long, IEventDeclaration> events = fTrace.getEvents(0L);
* @param names
* The array of events to check for
* @return Whether all events are in the metadata
- * @since 2.1
+ * @since 3.0
*/
public boolean hasAllEvents(String[] names) {
for (String name : names) {
* @param names
* The array of event names of check for
* @return Whether one of the event is present in trace metadata
- * @since 2.1
+ * @since 3.0
*/
public boolean hasAtLeastOneOfEvents(String[] names) {
for (String name : names) {