import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages;
import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
import org.eclipse.linuxtools.tmf.ui.editors.ITmfTraceEditor;
import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources.ResourcesEntry.Type;
import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
import org.eclipse.linuxtools.tmf.ui.editors.ITmfTraceEditor;
import org.eclipse.linuxtools.internal.tmf.core.component.TmfProviderManager;
import org.eclipse.linuxtools.tmf.core.component.ITmfDataProvider;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfStartSynchSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.tests.stubs.component.TmfEventProviderStub;
import org.eclipse.linuxtools.tmf.tests.stubs.component.TmfSyntheticEventProviderStub;
import org.eclipse.linuxtools.tmf.tests.stubs.event.TmfSyntheticEventStub;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocation;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationInfo;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.junit.Before;
import org.junit.Test;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignal;
import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.junit.After;
import org.junit.Before;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
import java.text.SimpleDateFormat;
import java.util.Date;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfSimpleTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfSimpleTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.junit.Test;
/**
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.junit.Test;
/**
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestampDelta;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestampFormat;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestampDelta;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestampFormat;
import org.junit.Test;
/**
import java.text.SimpleDateFormat;
import java.util.Date;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestampFormat;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestampFormat;
import org.junit.Test;
/**
import org.eclipse.linuxtools.internal.tmf.core.request.TmfCoalescedEventRequest;
import org.eclipse.linuxtools.tmf.core.component.ITmfDataProvider;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.tests.stubs.request.TmfEventRequestStub;
import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
import org.junit.Before;
import static org.junit.Assert.assertTrue;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.tests.stubs.request.TmfEventRequestStub;
import org.junit.Before;
import org.junit.Test;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfCheckpoint;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpointIndexer;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfCheckpoint;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpointIndexer;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpoint;
import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfCheckpoint;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentContext;
import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentLocation;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfTimestampLocation;
import org.eclipse.core.runtime.Path;
import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentContext;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.internal.tmf.core.component.TmfProviderManager;
import org.eclipse.linuxtools.tmf.core.component.ITmfDataProvider;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.uml2sd.TmfAsyncSequenceDiagramEvent;
import org.junit.Test;
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.uml2sd.TmfSyncSequenceDiagramEvent;
import org.junit.Test;
import org.eclipse.linuxtools.tmf.core.component.ITmfDataProvider;
import org.eclipse.linuxtools.tmf.core.component.TmfEventProvider;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
import org.eclipse.linuxtools.tmf.tests.stubs.event.TmfSyntheticEventStub;
package org.eclipse.linuxtools.tmf.tests.stubs.request;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
/**
* <b><u>TmfEventRequestStub</u></b>
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+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.ITmfTrace;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
org.eclipse.linuxtools.tmf.core.statesystem,
org.eclipse.linuxtools.tmf.core.statevalue,
org.eclipse.linuxtools.tmf.core.statistics,
+ org.eclipse.linuxtools.tmf.core.timestamp,
org.eclipse.linuxtools.tmf.core.trace,
org.eclipse.linuxtools.tmf.core.uml2sd,
org.eclipse.linuxtools.tmf.core.util
import org.eclipse.linuxtools.internal.tmf.core.TmfCoreTracer;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
/**
* The TMF coalesced event request
import org.eclipse.linuxtools.internal.tmf.core.statesystem.backends.IStateHistoryBackend;
import org.eclipse.linuxtools.tmf.core.component.TmfComponent;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.statesystem.IStateChangeInput;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystemBuilder;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
import org.eclipse.linuxtools.tmf.core.statevalue.TmfStateValue;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
/**
* Variant of the HistoryTreeBackend which runs all the interval-insertion logic
package org.eclipse.linuxtools.internal.tmf.core.trace;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
/**
import org.eclipse.linuxtools.internal.tmf.core.TmfCoreTracer;
import org.eclipse.linuxtools.internal.tmf.core.request.TmfCoalescedEventRequest;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
/**
* An extension of TmfDataProvider timestamped events providers.
*******************************************************************************/
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
/**
*
* @param timestamp
* The timestamp of this location
+ * @since 2.0
*/
public CtfLocation(final ITmfTimestamp timestamp) {
this(timestamp.getValue(), 0);
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
/**
* The CTF adapter for the TMF timestamp. It's basically the same as a
import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+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;
package org.eclipse.linuxtools.tmf.core.event;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
/**
/**
* @return the event timestamp
+ * @since 2.0
*/
public ITmfTimestamp getTimestamp();
package org.eclipse.linuxtools.tmf.core.event;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+
/**
* The generic lost event structure in TMF.
*
/**
* @return the 'problem' time range
+ * @since 2.0
*/
public TmfTimeRange getTimeRange();
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.event;
-
-/**
- * The fundamental time reference in the TMF.
- * <p>
- * It defines a generic timestamp interface in its most basic form:
- * <ul>
- * <li>timestamp = [value] * 10**[scale] +/- [precision]
- * </ul>
- * Where:
- * <ul>
- * <li>[value] is an unstructured integer value
- * <li>[scale] is the magnitude of the value wrt some application-specific
- * base unit (e.g. the second)
- * <li>[precision] indicates the error on the value (useful for comparing
- * timestamps in different scales). Default: 0.
- * </ul>
- *
- * @version 2.0
- * @author Francois Chouinard
- *
- * @see ITmfEvent
- * @see TmfTimeRange
- */
-public interface ITmfTimestamp extends Comparable<ITmfTimestamp> {
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- /**
- * The millisecond scale factor (10e0)
- * @since 2.0
- */
- public static final int SECOND_SCALE = 0;
-
- /**
- * The millisecond scale factor (10e-3)
- * @since 2.0
- */
- public static final int MILLISECOND_SCALE = -3;
-
- /**
- * The microsecond scale factor (10e-6)
- * @since 2.0
- */
- public static final int MICROSECOND_SCALE = -6;
-
- /**
- * The nanosecond scale factor (10e-9)
- * @since 2.0
- */
- public static final int NANOSECOND_SCALE = -9;
-
- // ------------------------------------------------------------------------
- // Getters
- // ------------------------------------------------------------------------
-
- /**
- * @return the timestamp value (magnitude)
- */
- public long getValue();
-
- /**
- * @return the timestamp scale (exponent)
- */
- public int getScale();
-
- /**
- * @return the timestamp precision (measurement tolerance)
- */
- public int getPrecision();
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * Normalize (adjust scale and offset) of the timestamp
- *
- * @param offset the offset to apply to the timestamp value (after scaling)
- * @param scale the new timestamp scale
- * @return a new 'adjusted' ITmfTimestamp
- */
- public ITmfTimestamp normalize(long offset, int scale);
-
- /**
- * Compares [this] and [ts] within timestamp precision
- *
- * @param ts the other timestamp
- * @param withinPrecision consider the precision when testing for equality
- * @return -1, 0 or 1 (less than, equals, greater than)
- */
- public int compareTo(ITmfTimestamp ts, boolean withinPrecision);
-
- /**
- * Returns the difference between [this] and [ts] as a timestamp
- *
- * @param ts the other timestamp
- * @return the time difference (this - other) as an ITmfTimestamp
- */
- public ITmfTimestamp getDelta(ITmfTimestamp ts);
-
- // ------------------------------------------------------------------------
- // Comparable
- // ------------------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- @Override
- int compareTo(ITmfTimestamp ts);
-
- /**
- * Format the timestamp as per the format provided
- *
- * @param format the timestamp formatter
- * @return the formatted timestamp
- * @since 2.0
- */
- public String toString(final TmfTimestampFormat format);
-
-}
package org.eclipse.linuxtools.tmf.core.event;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.ui.views.properties.IPropertySource;
* @param type the event type
* @param content the event content (payload)
* @param reference the event reference
+ * @since 2.0
*/
public TmfEvent(final ITmfTrace trace, final ITmfTimestamp timestamp, final String source,
* @param type the event type
* @param content the event content (payload)
* @param reference the event reference
+ * @since 2.0
*/
public TmfEvent(final ITmfTrace trace, final long rank, final ITmfTimestamp timestamp, final String source,
final ITmfEventType type, final ITmfEventField content, final String reference)
return fRank;
}
+ /**
+ * @since 2.0
+ */
@Override
public ITmfTimestamp getTimestamp() {
return fTimestamp;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.PropertyDescriptor;
package org.eclipse.linuxtools.tmf.core.event;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
* @param reference the event reference
* @param timeRange the 'problematic' time range
* @param nbLostEvents the number of lost events in the time range
+ * @since 2.0
*/
public TmfLostEvent(final ITmfTrace trace, final long rank, final ITmfTimestamp timestamp,
final String source, final ITmfEventType type, final String reference, final TmfTimeRange timeRange, final long nbLostEvents)
// ITmfLostEvent
// ------------------------------------------------------------------------
+ /**
+ * @since 2.0
+ */
@Override
public TmfTimeRange getTimeRange() {
return fTimeRange;
/**
* @param timeRange the 'problematic' time range
+ * @since 2.0
*/
protected void setTimeRange(final TmfTimeRange timeRange) {
fTimeRange = timeRange;
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Francois Chouinard - Standardize on the default toString()
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.event;
-
-/**
- * A simplified timestamp where scale and precision are set to 0.
- *
- * @version 1.1
- * @author Francois Chouinard
- */
-public class TmfSimpleTimestamp extends TmfTimestamp {
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Default constructor (value = 0)
- */
- public TmfSimpleTimestamp() {
- this(0);
- }
-
- /**
- * Full constructor
- *
- * @param value the timestamp value
- */
- public TmfSimpleTimestamp(final long value) {
- super(value, 0, 0);
- }
-
- /**
- * Copy constructor.
- *
- * If the parameter is not a TmfSimpleTimestamp, the timestamp will be
- * scaled to seconds, and the precision will be discarded.
- *
- * @param timestamp
- * The timestamp to copy
- */
- public TmfSimpleTimestamp(final ITmfTimestamp timestamp) {
- super(timestamp.normalize(0, ITmfTimestamp.SECOND_SCALE).getValue(), 0, 0);
- }
-
- // ------------------------------------------------------------------------
- // ITmfTimestamp
- // ------------------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#normalize(long, int)
- */
- @Override
- public ITmfTimestamp normalize(final long offset, final int scale) {
- if (scale == 0) {
- return new TmfSimpleTimestamp(getValue() + offset);
- }
- return super.normalize(offset, scale);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#compareTo(org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp, boolean)
- */
- @Override
- public int compareTo(final ITmfTimestamp ts, final boolean withinPrecision) {
- if (ts instanceof TmfSimpleTimestamp) {
- final long delta = getValue() - ts.getValue();
- return (delta == 0) ? 0 : (delta > 0) ? 1 : -1;
- }
- return super.compareTo(ts, withinPrecision);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#getDelta(org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp)
- */
- @Override
- public ITmfTimestamp getDelta(final ITmfTimestamp ts) {
- if (ts instanceof TmfSimpleTimestamp) {
- return new TmfTimestampDelta(getValue() - ts.getValue());
- }
- return super.getDelta(ts);
- }
-
- // ------------------------------------------------------------------------
- // Object
- // ------------------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#hashCode()
- */
- @Override
- public int hashCode() {
- return super.hashCode();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object other) {
- if (this == other) {
- return true;
- }
- if (other == null) {
- return false;
- }
- if (!(other instanceof TmfSimpleTimestamp)) {
- return super.equals(other);
- }
- final TmfSimpleTimestamp ts = (TmfSimpleTimestamp) other;
-
- return compareTo(ts, false) == 0;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2012 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Francois Chouinard - Updated as per TMF Event Model 1.0
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.event;
-
-/**
- * A utility class to define and manage time ranges.
- *
- * @version 1.0
- * @author Francois Chouinard
- *
- * @see ITmfTimestamp
- */
-public final class TmfTimeRange {
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- /**
- * The full possible time range
- */
- public static final TmfTimeRange ETERNITY =
- new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-
- /**
- * The null time range
- */
- public static final TmfTimeRange NULL_RANGE = new TmfTimeRange();
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final ITmfTimestamp fStartTime;
- private final ITmfTimestamp fEndTime;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Default constructor
- */
- private TmfTimeRange() {
- fStartTime = TmfTimestamp.BIG_BANG;
- fEndTime = TmfTimestamp.BIG_BANG;
- }
-
- /**
- * Full constructor
- *
- * @param startTime start of the time range
- * @param endTime end of the time range
- */
- public TmfTimeRange(final ITmfTimestamp startTime, final ITmfTimestamp endTime) {
- if (startTime == null || endTime == null) {
- throw new IllegalArgumentException();
- }
- fStartTime = startTime;
- fEndTime = endTime;
- }
-
- /**
- * Copy constructor
- *
- * @param range the other time range
- */
- public TmfTimeRange(final TmfTimeRange range) {
- if (range == null) {
- throw new IllegalArgumentException();
- }
- fStartTime = range.getStartTime();
- fEndTime = range.getEndTime();
- }
-
- // ------------------------------------------------------------------------
- // Getters
- // ------------------------------------------------------------------------
-
- /**
- * @return the time range start time
- */
- public ITmfTimestamp getStartTime() {
- return fStartTime;
- }
-
- /**
- * @return the time range end time
- */
- public ITmfTimestamp getEndTime() {
- return fEndTime;
- }
-
- // ------------------------------------------------------------------------
- // Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Check if the timestamp is within the time range
- *
- * @param ts the timestamp to check
- * @return true if [startTime] <= [ts] <= [endTime]
- */
- public boolean contains(final ITmfTimestamp ts) {
- // Zero acts as a "universal donor" timestamp
- if (ts.equals(TmfTimestamp.ZERO)) {
- return true;
- }
- return (fStartTime.compareTo(ts, true) <= 0) && (fEndTime.compareTo(ts, true) >= 0);
- }
-
- /**
- * Check if the time range is within the time range
- *
- * @param range the other time range
- * @return true if [range] is fully contained
- */
- public boolean contains(final TmfTimeRange range) {
- final ITmfTimestamp startTime = range.getStartTime();
- final ITmfTimestamp endTime = range.getEndTime();
- return (fStartTime.compareTo(startTime, true) <= 0) && (fEndTime.compareTo(endTime, true) >= 0);
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * Get intersection of two time ranges
- *
- * @param range the other time range
- * @return the intersection time range, or null if no intersection exists
- */
- public TmfTimeRange getIntersection(final TmfTimeRange range) {
- if (fStartTime.compareTo(range.fEndTime, true) > 0 || fEndTime.compareTo(range.fStartTime, true) < 0) {
- return null; // no intersection
- }
-
- return new TmfTimeRange(fStartTime.compareTo(range.fStartTime, true) < 0
- ? range.fStartTime
- : fStartTime, fEndTime.compareTo(range.fEndTime, true) > 0
- ? range.fEndTime
- : fEndTime);
- }
-
- // ------------------------------------------------------------------------
- // Object
- // ------------------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + fEndTime.hashCode();
- result = prime * result + fStartTime.hashCode();
- return result;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof TmfTimeRange)) {
- return false;
- }
- final TmfTimeRange other = (TmfTimeRange) obj;
- if (!fEndTime.equals(other.fEndTime)) {
- return false;
- }
- if (!fStartTime.equals(other.fStartTime)) {
- return false;
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- @SuppressWarnings("nls")
- public String toString() {
- return "TmfTimeRange [fStartTime=" + fStartTime + ", fEndTime=" + fEndTime + "]";
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2010, 2012 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Thomas Gatterweh - Updated scaling / synchronization
- * Francois Chouinard - Refactoring to align with TMF Event Model 1.0
- * Francois Chouinard - Implement augmented interface
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.event;
-
-/**
- * A generic timestamp implementation. The timestamp is represented by the
- * tuple { value, scale, precision }. By default, timestamps are scaled in
- * seconds.
- *
- * @version 1.1
- * @author Francois Chouinard
- */
-public class TmfTimestamp implements ITmfTimestamp {
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- /**
- * The beginning of time
- */
- public static final ITmfTimestamp BIG_BANG =
- new TmfTimestamp(Long.MIN_VALUE, Integer.MAX_VALUE, 0);
-
- /**
- * The end of time
- */
- public static final ITmfTimestamp BIG_CRUNCH =
- new TmfTimestamp(Long.MAX_VALUE, Integer.MAX_VALUE, 0);
-
- /**
- * A more practical definition of "beginning of time"
- * @since 2.0
- */
- public static final ITmfTimestamp PROJECT_IS_FUNDED = BIG_BANG;
-
- /**
- * A more practical definition of "end of time"
- * @since 2.0
- */
- public static final ITmfTimestamp PROJECT_IS_CANNED = BIG_CRUNCH;
-
- /**
- * Zero
- */
- public static final ITmfTimestamp ZERO =
- new TmfTimestamp(0, 0, 0);
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The timestamp raw value (mantissa)
- */
- private final long fValue;
-
- /**
- * The timestamp scale (magnitude)
- */
- private final int fScale;
-
- /**
- * The value precision (tolerance)
- */
- private final int fPrecision;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Default constructor
- */
- public TmfTimestamp() {
- this(0, ITmfTimestamp.SECOND_SCALE, 0);
- }
-
- /**
- * Simple constructor (scale = precision = 0)
- *
- * @param value the timestamp value
- */
- public TmfTimestamp(final long value) {
- this(value, ITmfTimestamp.SECOND_SCALE, 0);
- }
-
- /**
- * Simple constructor (precision = 0)
- *
- * @param value the timestamp value
- * @param scale the timestamp scale
- */
- public TmfTimestamp(final long value, final int scale) {
- this(value, scale, 0);
- }
-
- /**
- * Full constructor
- *
- * @param value the timestamp value
- * @param scale the timestamp scale
- * @param precision the timestamp precision
- */
- public TmfTimestamp(final long value, final int scale, final int precision) {
- fValue = value;
- fScale = scale;
- fPrecision = Math.abs(precision);
- }
-
- /**
- * Copy constructor
- *
- * @param timestamp the timestamp to copy
- */
- public TmfTimestamp(final ITmfTimestamp timestamp) {
- if (timestamp == null) {
- throw new IllegalArgumentException();
- }
- fValue = timestamp.getValue();
- fScale = timestamp.getScale();
- fPrecision = timestamp.getPrecision();
- }
-
- // ------------------------------------------------------------------------
- // ITmfTimestamp
- // ------------------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#getValue()
- */
- @Override
- public long getValue() {
- return fValue;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#getScale()
- */
- @Override
- public int getScale() {
- return fScale;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#getPrecision()
- */
- @Override
- public int getPrecision() {
- return fPrecision;
- }
-
- private static final long scalingFactors[] = new long[] {
- 1L,
- 10L,
- 100L,
- 1000L,
- 10000L,
- 100000L,
- 1000000L,
- 10000000L,
- 100000000L,
- 1000000000L,
- 10000000000L,
- 100000000000L,
- 1000000000000L,
- 10000000000000L,
- 100000000000000L,
- 1000000000000000L,
- 10000000000000000L,
- 100000000000000000L,
- 1000000000000000000L,
- };
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#normalize(long, int)
- */
- @Override
- public ITmfTimestamp normalize(final long offset, final int scale) {
-
- long value = fValue;
- int precision = fPrecision;
-
- // Handle the trivial case
- if (fScale == scale && offset == 0) {
- return this;
- }
-
- // In case of big bang and big crunch just return this (no need to normalize)
- if (this.equals(BIG_BANG) || this.equals(BIG_CRUNCH)) {
- return this;
- }
-
- // First, scale the timestamp
- if (fScale != scale) {
- final int scaleDiff = Math.abs(fScale - scale);
- if (scaleDiff >= scalingFactors.length) {
- throw new ArithmeticException("Scaling exception"); //$NON-NLS-1$
- }
-
- final long scalingFactor = scalingFactors[scaleDiff];
- if (scale < fScale) {
- value *= scalingFactor;
- precision *= scalingFactor;
- } else {
- value /= scalingFactor;
- precision /= scalingFactor;
- }
- }
-
- // Then, apply the offset
- if (offset < 0) {
- value = (value < Long.MIN_VALUE - offset) ? Long.MIN_VALUE : value + offset;
- } else {
- value = (value > Long.MAX_VALUE - offset) ? Long.MAX_VALUE : value + offset;
- }
-
- return new TmfTimestamp(value, scale, precision);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#compareTo(org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp, boolean)
- */
- @Override
- public int compareTo(final ITmfTimestamp ts, final boolean withinPrecision) {
-
- // Check the corner cases (we can't use equals() because it uses compareTo()...)
- if (ts == null) {
- return 1;
- }
- if (this == ts || (fValue == ts.getValue() && fScale == ts.getScale())) {
- return 0;
- }
- if ((fValue == BIG_BANG.getValue() && fScale == BIG_BANG.getScale()) || (ts.getValue() == BIG_CRUNCH.getValue() && ts.getScale() == BIG_CRUNCH.getScale())) {
- return -1;
- }
- if ((fValue == BIG_CRUNCH.getValue() && fScale == BIG_CRUNCH.getScale()) || (ts.getValue() == BIG_BANG.getValue() && ts.getScale() == BIG_BANG.getScale())) {
- return 1;
- }
-
- try {
- final ITmfTimestamp nts = ts.normalize(0, fScale);
- final long delta = fValue - nts.getValue();
- if ((delta == 0) || (withinPrecision && (Math.abs(delta) <= (fPrecision + nts.getPrecision())))) {
- return 0;
- }
- return (delta > 0) ? 1 : -1;
- }
- catch (final ArithmeticException e) {
- // Scaling error. We can figure it out nonetheless.
-
- // First, look at the sign of the mantissa
- final long value = ts.getValue();
- if (fValue == 0 && value == 0) {
- return 0;
- }
- if (fValue < 0 && value >= 0) {
- return -1;
- }
- if (fValue >= 0 && value < 0) {
- return 1;
- }
-
- // Otherwise, just compare the scales
- final int scale = ts.getScale();
- return (fScale > scale) ? (fValue >= 0) ? 1 : -1 : (fValue >= 0) ? -1 : 1;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#getDelta(org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp)
- */
- @Override
- public ITmfTimestamp getDelta(final ITmfTimestamp ts) {
- final ITmfTimestamp nts = ts.normalize(0, fScale);
- final long value = fValue - nts.getValue();
- return new TmfTimestampDelta(value, fScale, fPrecision + nts.getPrecision());
- }
-
- // ------------------------------------------------------------------------
- // Comparable
- // ------------------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#compareTo(org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp)
- */
- @Override
- public int compareTo(final ITmfTimestamp ts) {
- return compareTo(ts, false);
- }
-
- // ------------------------------------------------------------------------
- // Object
- // ------------------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (int) (fValue ^ (fValue >>> 32));
- result = prime * result + fScale;
- result = prime * result + fPrecision;
- return result;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object other) {
- if (this == other) {
- return true;
- }
- if (other == null) {
- return false;
- }
- if (!(other instanceof TmfTimestamp)) {
- return false;
- }
- final TmfTimestamp ts = (TmfTimestamp) other;
- return compareTo(ts, false) == 0;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return toString(TmfTimestampFormat.getDefaulTimeFormat());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#toString(org.eclipse.linuxtools.tmf.core.event.TmfTimestampFormat)
- */
- /**
- * @since 2.0
- */
- @Override
- public String toString(final TmfTimestampFormat format) {
- try {
- ITmfTimestamp ts = normalize(0, ITmfTimestamp.NANOSECOND_SCALE);
- return format.format(ts.getValue());
- }
- catch (ArithmeticException e) {
- return format.format(0);
- }
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.tmf.core.event;
-
-import java.util.TimeZone;
-
-/**
- * A generic timestamp implementation for delta between timestamps.
- * The toString() method takes negative values into consideration.
- *
- * @author Bernd Hufmann
- * @since 2.0
- */
-public class TmfTimestampDelta extends TmfTimestamp {
-
- // ------------------------------------------------------------------------
- // Members
- // ------------------------------------------------------------------------
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
- /**
- * Default constructor
- */
- public TmfTimestampDelta() {
- super();
- }
-
- /**
- * Simple constructor (scale = precision = 0)
- *
- * @param value the timestamp value
- */
-
- public TmfTimestampDelta(long value) {
- super(value);
- }
-
- /**
- * Simple constructor (precision = 0)
- *
- * @param value the timestamp value
- * @param scale the timestamp scale
- */
- public TmfTimestampDelta(long value, int scale) {
- super(value, scale);
- }
-
-
- /**
- * Copy constructor
- *
- * @param timestamp the timestamp to copy
- */
- public TmfTimestampDelta(ITmfTimestamp timestamp) {
- super(timestamp);
- }
-
- /**
- * Full constructor
- *
- * @param value the timestamp value
- * @param scale the timestamp scale
- * @param precision the timestamp precision
- */
- public TmfTimestampDelta(long value, int scale, int precision) {
- super(value, scale, precision);
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#normalize(long, int)
- */
- @Override
- public ITmfTimestamp normalize(final long offset, final int scale) {
- ITmfTimestamp nts = super.normalize(offset, scale);
- return new TmfTimestampDelta(nts.getValue(), nts.getScale(), nts.getPrecision());
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return toString(TmfTimestampFormat.getDefaulIntervalFormat());
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#toString(org.eclipse.linuxtools.tmf.core.event.TmfTimestampFormat)
- */
- @Override
- public String toString(TmfTimestampFormat format) {
- if (getValue() < 0) {
- TmfTimestampDelta tmpTs = new TmfTimestampDelta(-getValue(), getScale(), getPrecision());
- return "-" + tmpTs.toString(format); //$NON-NLS-1$
- }
- TmfTimestampFormat deltaFormat = new TmfTimestampFormat(format.toPattern());
- deltaFormat.setTimeZone(TimeZone.getTimeZone("UTC")); //$NON-NLS-1$
- return super.toString(deltaFormat);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.event;
-
-import java.text.DecimalFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTimestampFormatUpdateSignal;
-
-/**
- * A formatting and parsing facility that can handle timestamps that span the
- * epoch with a precision down to the nanosecond. It can be understood as a
- * simplified and more constrained version of SimpleDateFormat as it limits the
- * number of allowed pattern characters and the acceptable timestamp formats.
- * <p>
- * The timestamp representation is broken down into a number of optional
- * components that can be assembled into a fairly simple way.
- *
- * <h4>Date Pattern</h4>
- * <blockquote>
- * <table border=0 cellspacing=3 cellpadding=0 >
- * <tr bgcolor="#ccccff">
- * <th align=left>Format
- * <th align=left>Description
- * <th align=left>Value Range
- * <th align=left>Example
- * <tr>
- * <td><code>yyyy</code>
- * <td>Year
- * <td><code>1970-...</code>
- * <td><code>2012</code>
- * <tr bgcolor="#eeeeff">
- * <td><code>MM</code>
- * <td>Month in year
- * <td><code>01-12</code>
- * <td><code>09</code>
- * <tr>
- * <td><code>dd</code>
- * <td>Day in month
- * <td><code>01-31</code>
- * <td><code>22</code>
- * </table>
- * </blockquote>
- *
- * <h4>Time Pattern</h4>
- * <blockquote>
- * <table border=0 cellspacing=3 cellpadding=0 >
- * <tr bgcolor="#ccccff">
- * <th align=left>Format
- * <th align=left>Description
- * <th align=left>Value Range
- * <th align=left>Example
- * <tr>
- * <td><code>HH</code>
- * <td>Hour in day
- * <td><code>00-23</code>
- * <td><code>07</code>
- * <tr bgcolor="#eeeeff">
- * <td><code>mm</code>
- * <td>Minute in hour
- * <td><code>00-59</code>
- * <td><code>35</code>
- * <tr>
- * <td><code>ss</code>
- * <td>Second in minute
- * <td><code>00-59</code>
- * <td><code>41</code>
- * <tr bgcolor="#eeeeff">
- * <td><code>T</code>
- * <td>The seconds since the epoch
- * <td><code>00-...</code>
- * <td><code>1332170682</code>
- * </table>
- * </blockquote>
- *
- * <h4>Sub-Seconds Pattern</h4>
- * <blockquote>
- * <table border=0 cellspacing=3 cellpadding=0 >
- * <tr bgcolor="#ccccff">
- * <th align=left>Format
- * <th align=left>Description
- * <th align=left>Value Range
- * <th align=left>Example
- * <tr>
- * <td><code>SSS</code>
- * <td>Millisecond in second
- * <td><code>000-999</code>
- * <td><code>123</code>
- * <tr bgcolor="#eeeeff">
- * <td><code>CCC</code>
- * <td>Microseconds in ms
- * <td><code>000-999</code>
- * <td><code>456</code>
- * <tr>
- * <td><code>NNN</code>
- * <td>Nanosecond in µs
- * <td><code>000-999</code>
- * <td><code>789</code>
- * </table>
- * </blockquote>
- *
- * <strong>Note: </strong>If "T" is used, no other Date or Time pattern
- * can be used. Also, "T" should be used for time intervals.
- * <p>
- * <strong>Note: </strong>Each sub-field can be separated by a single,
- * optional character delimiter. However, the between Date/Time and the
- * Sub-seconds pattern is mandatory (if there is a fractional part) and
- * has to be separated from Date/time by "." (period).
- * <p>
- * The recognized delimiters are:
- * <ul>
- * <li>Space ("<code> </code>")
- * <li>Period (<code>".</code>")
- * <li>Comma ("<code>,</code>")
- * <li>Dash ("<code>-</code>")
- * <li>Underline ("<code>_</code>")
- * <li>Colon ("<code>:</code>")
- * <li>Semicolon ("<code>;</code>")
- * <li>Slash ("<code>/</code>")
- * <li>Double-quote ("<code>"</code>")
- * </ul>
- *
- * <h4>Examples</h4>
- * The following examples show how timestamp patterns are interpreted in
- * the U.S. locale. The given timestamp is 1332170682539677389L, the number
- * of nanoseconds since 1970/01/01.
- *
- * <blockquote>
- * <table border=0 cellspacing=3 cellpadding=0>
- * <tr bgcolor="#ccccff">
- * <th align=left>Date and Time Pattern
- * <th align=left>Result
- * <tr>
- * <td><code>"yyyy-MM-dd HH:mm:ss.SSS.CCC.NNN"</code>
- * <td><code>2012-03-19 11:24:42.539.677.389</code>
- * <tr bgcolor="#eeeeff">
- * <td><code>"yyyy-MM-dd HH:mm:ss.SSS.CCC"</code>
- * <td><code>2012-03-19 11:24:42.539.677</code>
- * <tr>
- * <td><code>"yyyy-D HH:mm:ss.SSS.CCC"</code>
- * <td><code>2012-79 11:24:42.539.677</code>
- * <tr bgcolor="#eeeeff">
- * <td><code>"ss.SSSCCCNNN"</code>
- * <td><code>42.539677389</code>
- * <tr>
- * <td><code>"T.SSS CCC NNN"</code>
- * <td><code>1332170682.539 677 389</code>
- * <tr bgcolor="#eeeeff">
- * <td><code>"T"</code>
- * <td><code>1332170682</code>
- * </table>
- * </blockquote>
- * <p>
- * @version 1.0
- * @since 2.0
- * @author Francois Chouinard
- */
-public class TmfTimestampFormat extends SimpleDateFormat {
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- /**
- * This class' serialization ID
- */
- private static final long serialVersionUID = 2835829763122454020L;
-
- /**
- * The default timestamp pattern
- */
- public static final String DEFAULT_TIME_PATTERN = "HH:mm:ss.SSS CCC NNN"; //$NON-NLS-1$
-
- /**
- * The LTTng 0.x legacy timestamp format
- */
- public static final String DEFAULT_INTERVAL_PATTERN = "TTT.SSS CCC NNN"; //$NON-NLS-1$
-
- // Fractions of seconds supported patterns
- private static final String DOT_RE = "\\."; //$NON-NLS-1$
- private static final String SEP_RE = "[ \\.,-_:;/\\\"]?"; //$NON-NLS-1$
- private static final String DGTS_3_RE = "(\\d{3})"; //$NON-NLS-1$
- private static final String DGTS_13_RE = "(\\d{1,3})"; //$NON-NLS-1$
-
- private static final String MILLISEC_RE = DOT_RE + DGTS_13_RE;
- private static final String MICROSEC_RE = DOT_RE + DGTS_3_RE + SEP_RE + DGTS_13_RE;
- private static final String NANOSEC_RE = DOT_RE + DGTS_3_RE + SEP_RE + DGTS_3_RE + SEP_RE + DGTS_13_RE;
-
- private static final Pattern MILLISEC_PAT = Pattern.compile(MILLISEC_RE);
- private static final Pattern MICROSEC_PAT = Pattern.compile(MICROSEC_RE);
- private static final Pattern NANOSEC_PAT = Pattern.compile(NANOSEC_RE);
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- // The default timestamp pattern
- private static String fDefaultTimePattern = null;
- private static TmfTimestampFormat fDefaultTimeFormat = null;
-
- // The default time interval format
- private static String fDefaultIntervalPattern = null;
- private static TmfTimestampFormat fDefaultIntervalFormat = null;
-
- // The timestamp pattern
- private String fPattern;
-
- // The timestamp pattern
- private List<String> fSupplPatterns = new ArrayList<String>();
-
- /**
- * The supplementary pattern letters. Can be redefined by sub-classes
- * to either override existing letters or augment the letter set.
- * If so, the format() method must provide the (re-)implementation of the
- * pattern.
- */
- protected String fSupplPatternLetters = "TSCN"; //$NON-NLS-1$
-
- /*
- * The bracketing symbols used to mitigate the risk of a format string
- * that contains escaped sequences that would conflict with our format
- * extension.
- */
- /** The open bracket symbol */
- protected String fOpenBracket = "[&"; //$NON-NLS-1$
-
- /** The closing bracket symbol */
- protected String fCloseBracket = "&]"; //$NON-NLS-1$
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * The default constructor (uses the default pattern)
- */
- public TmfTimestampFormat() {
- this(fDefaultTimePattern);
- }
-
- /**
- * The normal constructor
- *
- * @param pattern the format pattern
- */
- public TmfTimestampFormat(String pattern) {
- applyPattern(pattern);
- }
-
- /**
- * The copy constructor
- *
- * @param other the other format pattern
- */
- public TmfTimestampFormat(TmfTimestampFormat other) {
- this(other.fPattern);
- }
-
- // ------------------------------------------------------------------------
- // Getters/setters
- // ------------------------------------------------------------------------
-
- /**
- * @param pattern the new default time pattern
- */
- public static void setDefaultTimeFormat(final String pattern) {
- fDefaultTimePattern = pattern;
- fDefaultTimeFormat = new TmfTimestampFormat(fDefaultTimePattern);
- TmfSignalManager.dispatchSignal(new TmfTimestampFormatUpdateSignal(null));
- }
-
- /**
- * @return the default time format pattern
- */
- public static TmfTimestampFormat getDefaulTimeFormat() {
- if (fDefaultTimeFormat == null) {
- fDefaultTimeFormat = new TmfTimestampFormat(DEFAULT_TIME_PATTERN);
- }
- return fDefaultTimeFormat;
- }
-
- /**
- * @param pattern the new default interval pattern
- */
- public static void setDefaultIntervalFormat(final String pattern) {
- fDefaultIntervalPattern = pattern;
- fDefaultIntervalFormat = new TmfTimestampFormat(fDefaultIntervalPattern);
- TmfSignalManager.dispatchSignal(new TmfTimestampFormatUpdateSignal(null));
- }
-
- /**
- * @return the default interval format pattern
- */
- public static TmfTimestampFormat getDefaulIntervalFormat() {
- if (fDefaultIntervalFormat == null) {
- fDefaultIntervalFormat = new TmfTimestampFormat(DEFAULT_INTERVAL_PATTERN);
- }
- return fDefaultIntervalFormat;
- }
-
- /* (non-Javadoc)
- * @see java.text.SimpleDateFormat#applyPattern(java.lang.String)
- */
- @Override
- public void applyPattern(String pattern) {
- fPattern = pattern;
- String quotedPattern = quoteSpecificTags(pattern);
- super.applyPattern(quotedPattern);
- }
-
- /* (non-Javadoc)
- * @see java.text.SimpleDateFormat#toPattern()
- */
- @Override
- public String toPattern() {
- return fPattern;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * Format the timestamp according to its pattern.
- *
- * @param value the timestamp value to format (in ns)
- * @return the formatted timestamp
- */
- public synchronized String format(long value) {
-
- // Split the timestamp value into its sub-components
- long sec = value / 1000000000; // seconds
- long ms = value % 1000000000 / 1000000; // milliseconds
- long cs = value % 1000000 / 1000; // microseconds
- long ns = value % 1000; // nanoseconds
-
- // Let the base class fill the stuff it knows about
- StringBuffer result = new StringBuffer(super.format(sec * 1000 + ms));
-
- // In the case where there is no separation between 2 supplementary
- // fields, the pattern will have the form "..'[pat-1]''[pat-2]'.." and
- // the base class format() will interpret the 2 adjacent quotes as a
- // wanted character in the result string as ("..[pat-1]'[pat-2]..").
- // Remove these extra quotes before filling the supplementary fields.
- int loc = result.indexOf(fCloseBracket + "'" + fOpenBracket); //$NON-NLS-1$
- while (loc != -1) {
- result.deleteCharAt(loc + fCloseBracket.length());
- loc = result.indexOf(fCloseBracket + "'" + fOpenBracket); //$NON-NLS-1$
- }
-
- // Fill in our extensions
- for (String pattern : fSupplPatterns) {
- int length = pattern.length();
-
- // Prepare the format buffer
- StringBuffer fmt = new StringBuffer(length);
- for (int i = 0; i < length; i++) {
- fmt.append("0"); //$NON-NLS-1$
- }
- DecimalFormat dfmt = new DecimalFormat(fmt.toString());
- String fmtVal = ""; //$NON-NLS-1$;
-
- // Format the proper value as per the pattern
- switch (pattern.charAt(0)) {
- case 'T':
- fmtVal = dfmt.format(sec);
- break;
- case 'S':
- fmtVal = dfmt.format(ms);
- break;
- case 'C':
- fmtVal = dfmt.format(cs);
- break;
- case 'N':
- fmtVal = dfmt.format(ns);
- break;
- default:
- break;
- }
-
- // Substitute the placeholder with the formatted value
- String ph = new StringBuffer(fOpenBracket + pattern + fCloseBracket).toString();
- loc = result.indexOf(ph);
- result.replace(loc, loc + length + fOpenBracket.length() + fCloseBracket.length(), fmtVal);
- }
-
- return result.toString();
- }
-
- /**
- * Parse a string according to the format pattern
- *
- * @param string the source string
- * @param ref the reference (base) time
- * @return the parsed value
- * @throws ParseException if the string has an invalid format
- */
- public synchronized long parseValue(final String string, final long ref) throws ParseException {
-
- // Trivial case
- if (string == null || string.length() == 0) {
- return 0;
- }
-
- // The timestamp sub-components
- long seconds = -1;
- long millisec = 0;
- long microsec = 0;
- long nanosec = 0;
-
- // Since we are processing the fractional part, substitute it with
- // its pattern so the base parser doesn't complain
- StringBuilder sb = new StringBuilder(string);
- int dot = string.indexOf('.');
- if (dot == -1) {
- sb.append('.');
- dot = string.length();
- }
- sb = new StringBuilder(string.substring(0, dot));
- String basePattern = super.toPattern();
- int dot2 = basePattern.indexOf('.');
- if (dot2 != -1) {
- sb.append(basePattern.substring(dot2));
- }
-
- // Fill in our extensions
- for (String pattern : fSupplPatterns) {
- String pat = fOpenBracket + pattern + fCloseBracket;
- Matcher matcher;
-
- // Extract the substring corresponding to the extra pattern letters
- // and replace with the pattern so the base parser can do its job.
- switch (pattern.charAt(0)) {
- case 'T':
- // Remove everything up to the first "." and compute the
- // number of seconds since the epoch. If there is no period,
- // assume an integer value and return immediately
- if (dot < 1) {
- return new DecimalFormat("0").parse(string).longValue() * 1000000000; //$NON-NLS-1$
- }
- seconds = new DecimalFormat("0").parse(string.substring(0, dot)).longValue(); //$NON-NLS-1$
- sb.delete(0, dot);
- sb.insert(0, pat);
- break;
- case 'S':
- matcher = MILLISEC_PAT.matcher(string.substring(dot));
- if (matcher.find()) {
- millisec = new Long(matcher.group(1));
- for (int l = matcher.group(1).length(); l < 3; l++) {
- millisec *= 10;
- }
- }
- stripQuotes(sb, pattern);
- break;
- case 'C':
- matcher = MICROSEC_PAT.matcher(string.substring(dot));
- if (matcher.find()) {
- microsec = new Long(matcher.group(2));
- for (int l = matcher.group(2).length(); l < 3; l++) {
- microsec *= 10;
- }
- }
- stripQuotes(sb, pattern);
- break;
- case 'N':
- matcher = NANOSEC_PAT.matcher(string.substring(dot));
- if (matcher.find()) {
- nanosec = new Long(matcher.group(3));
- for (int l = matcher.group(3).length(); l < 3; l++) {
- nanosec *= 10;
- }
- }
- stripQuotes(sb, pattern);
- break;
- default:
- break;
- }
- }
-
- // If there was no "T" (thus not an interval), parse as a date
- if (seconds == -1) {
- Date baseDate = super.parse(sb.toString());
-
- Calendar refTime = Calendar.getInstance(getTimeZone());
- refTime.setTimeInMillis(ref / 1000000);
- Calendar newTime = Calendar.getInstance(getTimeZone());
- newTime.setTimeInMillis(baseDate.getTime());
-
- int[] fields = new int[] { Calendar.YEAR, Calendar.MONTH, Calendar.DATE, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND };
- for (int field : fields) {
- int value = newTime.get(field);
- // Do some adjustments...
- if (field == Calendar.YEAR) {
- value -= 1970;
- } else if (field == Calendar.DATE) {
- value -= 1;
- }
- // ... and fill-in the empty fields
- if (value == 0) {
- newTime.set(field, refTime.get(field));
- } else {
- break; // Get out as soon as we have a significant value
- }
- }
- seconds = newTime.getTimeInMillis() / 1000;
- }
-
- // Compute the value in ns
- return seconds * 1000000000 + millisec * 1000000 + microsec * 1000 + nanosec;
- }
-
- /**
- * Parse a string according to the format pattern
- *
- * @param string the source string
- * @return the parsed value
- * @throws ParseException if the string has an invalid format
- */
- public long parseValue(final String string) throws ParseException {
- long result = parseValue(string, 0);
- return result;
-
- }
-
- // ------------------------------------------------------------------------
- // Helper functions
- // ------------------------------------------------------------------------
-
- /**
- * Copy the pattern but quote (bracket with "[&" and "&]") the
- * TmfTimestampFormat specific tags so these fields are treated as
- * comments by the base class.
- *
- * It also keeps track of the corresponding quoted fields so they can be
- * properly populated later on (by format()).
- *
- * @param pattern the 'extended' pattern
- * @return the quoted and bracketed pattern
- */
- private String quoteSpecificTags(final String pattern) {
-
- StringBuffer result = new StringBuffer();
-
- int length = pattern.length();
- boolean inQuote = false;
-
- for (int i = 0; i < length; i++) {
- char c = pattern.charAt(i);
- result.append(c);
- if (c == '\'') {
- // '' is treated as a single quote regardless of being
- // in a quoted section.
- if ((i + 1) < length) {
- c = pattern.charAt(i + 1);
- if (c == '\'') {
- i++;
- result.append(c);
- continue;
- }
- }
- inQuote = !inQuote;
- continue;
- }
- if (!inQuote) {
- if (fSupplPatternLetters.indexOf(c) != -1) {
- StringBuilder pat = new StringBuilder();
- pat.append(c);
- result.insert(result.length() - 1, "'" + fOpenBracket); //$NON-NLS-1$
- while ((i + 1) < length && pattern.charAt(i + 1) == c) {
- result.append(c);
- pat.append(c);
- i++;
- }
- result.append(fCloseBracket + "'"); //$NON-NLS-1$
- fSupplPatterns.add(pat.toString());
- }
- }
- }
- return result.toString();
- }
-
- /**
- * Remove the quotes from the pattern
- *
- * @param sb
- * @param pattern
- */
- private void stripQuotes(StringBuilder sb, String pattern) {
- String pt = "'" + fOpenBracket + pattern + fCloseBracket + "'"; //$NON-NLS-1$//$NON-NLS-2$
- int l = sb.indexOf(pt);
- if (l != -1) {
- sb.delete(l + pt.length() - 1, l + pt.length());
- sb.delete(l, l + 1);
- }
- }
-
-}
import java.util.List;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
/**
package org.eclipse.linuxtools.tmf.core.request;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
/**
* The TMF event request
/**
* @return the requested time range
+ * @since 2.0
*/
public TmfTimeRange getRange();
import org.eclipse.linuxtools.internal.tmf.core.TmfCoreTracer;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
/**
* An extension of TmfDataRequest for timestamped events.
/**
* @return the requested time range
+ * @since 2.0
*/
@Override
public TmfTimeRange getRange() {
package org.eclipse.linuxtools.tmf.core.signal;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
/**
* A new active time range has been selected
* @param ts
* The current selected timestamp, independent from the time
* range
+ * @since 2.0
*/
public TmfRangeSynchSignal(Object source, TmfTimeRange range, ITmfTimestamp ts) {
super(source);
/**
* @return This signal's time range
+ * @since 2.0
*/
public TmfTimeRange getCurrentRange() {
return fCurrentRange;
/**
* @return This signal's current selected timestamp
+ * @since 2.0
*/
public ITmfTimestamp getCurrentTime() {
return fCurrentTime;
package org.eclipse.linuxtools.tmf.core.signal;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
/**
* A new current time is selected (for component synchronization)
* Object sending this signal
* @param ts
* Synchronize to which timestamp
+ * @since 2.0
*/
public TmfTimeSynchSignal(Object source, ITmfTimestamp ts) {
super(source);
/**
* @return The synchronization timestamp of this signal
+ * @since 2.0
*/
public ITmfTimestamp getCurrentTime() {
return fCurrentTime;
package org.eclipse.linuxtools.tmf.core.signal;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
/**
package org.eclipse.linuxtools.tmf.core.signal;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
/**
* The trace that was updated
* @param range
* The new time range of the trace
+ * @since 2.0
*/
public TmfTraceUpdatedSignal(Object source, ITmfTrace trace, TmfTimeRange range) {
super(source);
/**
* @return The time range indicated by this signal
+ * @since 2.0
*/
public TmfTimeRange getRange() {
return fTimeRange;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEventFactory;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import java.util.List;
import java.util.Map;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.signal.TmfStatsUpdatedSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
/**
* Provider for statistics, which is assigned to a trace. This can be used to
package org.eclipse.linuxtools.tmf.core.statistics;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
import org.eclipse.linuxtools.tmf.core.statesystem.AbstractStateChangeInput;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystemBuilder;
import org.eclipse.linuxtools.tmf.core.statistics.TmfStateStatistics.Attributes;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
/**
import java.util.TreeMap;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
import org.eclipse.linuxtools.tmf.core.signal.TmfStatsUpdatedSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
/**
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.timestamp;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+
+/**
+ * The fundamental time reference in the TMF.
+ * <p>
+ * It defines a generic timestamp interface in its most basic form:
+ * <ul>
+ * <li>timestamp = [value] * 10**[scale] +/- [precision]
+ * </ul>
+ * Where:
+ * <ul>
+ * <li>[value] is an unstructured integer value
+ * <li>[scale] is the magnitude of the value wrt some application-specific
+ * base unit (e.g. the second)
+ * <li>[precision] indicates the error on the value (useful for comparing
+ * timestamps in different scales). Default: 0.
+ * </ul>
+ *
+ * @author Francois Chouinard
+ * @version 2.0
+ * @since 2.0
+ *
+ * @see ITmfEvent
+ * @see TmfTimeRange
+ */
+public interface ITmfTimestamp extends Comparable<ITmfTimestamp> {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ /**
+ * The millisecond scale factor (10e0)
+ * @since 2.0
+ */
+ public static final int SECOND_SCALE = 0;
+
+ /**
+ * The millisecond scale factor (10e-3)
+ * @since 2.0
+ */
+ public static final int MILLISECOND_SCALE = -3;
+
+ /**
+ * The microsecond scale factor (10e-6)
+ * @since 2.0
+ */
+ public static final int MICROSECOND_SCALE = -6;
+
+ /**
+ * The nanosecond scale factor (10e-9)
+ * @since 2.0
+ */
+ public static final int NANOSECOND_SCALE = -9;
+
+ // ------------------------------------------------------------------------
+ // Getters
+ // ------------------------------------------------------------------------
+
+ /**
+ * @return the timestamp value (magnitude)
+ */
+ public long getValue();
+
+ /**
+ * @return the timestamp scale (exponent)
+ */
+ public int getScale();
+
+ /**
+ * @return the timestamp precision (measurement tolerance)
+ */
+ public int getPrecision();
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Normalize (adjust scale and offset) of the timestamp
+ *
+ * @param offset the offset to apply to the timestamp value (after scaling)
+ * @param scale the new timestamp scale
+ * @return a new 'adjusted' ITmfTimestamp
+ */
+ public ITmfTimestamp normalize(long offset, int scale);
+
+ /**
+ * Compares [this] and [ts] within timestamp precision
+ *
+ * @param ts the other timestamp
+ * @param withinPrecision consider the precision when testing for equality
+ * @return -1, 0 or 1 (less than, equals, greater than)
+ */
+ public int compareTo(ITmfTimestamp ts, boolean withinPrecision);
+
+ /**
+ * Returns the difference between [this] and [ts] as a timestamp
+ *
+ * @param ts the other timestamp
+ * @return the time difference (this - other) as an ITmfTimestamp
+ */
+ public ITmfTimestamp getDelta(ITmfTimestamp ts);
+
+ // ------------------------------------------------------------------------
+ // Comparable
+ // ------------------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ @Override
+ int compareTo(ITmfTimestamp ts);
+
+ /**
+ * Format the timestamp as per the format provided
+ *
+ * @param format the timestamp formatter
+ * @return the formatted timestamp
+ * @since 2.0
+ */
+ public String toString(final TmfTimestampFormat format);
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Standardize on the default toString()
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.timestamp;
+
+/**
+ * A simplified timestamp where scale and precision are set to 0.
+ *
+ * @author Francois Chouinard
+ * @version 1.1
+ * @since 2.0
+ */
+public class TmfSimpleTimestamp extends TmfTimestamp {
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Default constructor (value = 0)
+ */
+ public TmfSimpleTimestamp() {
+ this(0);
+ }
+
+ /**
+ * Full constructor
+ *
+ * @param value the timestamp value
+ */
+ public TmfSimpleTimestamp(final long value) {
+ super(value, 0, 0);
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * If the parameter is not a TmfSimpleTimestamp, the timestamp will be
+ * scaled to seconds, and the precision will be discarded.
+ *
+ * @param timestamp
+ * The timestamp to copy
+ */
+ public TmfSimpleTimestamp(final ITmfTimestamp timestamp) {
+ super(timestamp.normalize(0, ITmfTimestamp.SECOND_SCALE).getValue(), 0, 0);
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfTimestamp
+ // ------------------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#normalize(long, int)
+ */
+ @Override
+ public ITmfTimestamp normalize(final long offset, final int scale) {
+ if (scale == 0) {
+ return new TmfSimpleTimestamp(getValue() + offset);
+ }
+ return super.normalize(offset, scale);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#compareTo(org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp, boolean)
+ */
+ @Override
+ public int compareTo(final ITmfTimestamp ts, final boolean withinPrecision) {
+ if (ts instanceof TmfSimpleTimestamp) {
+ final long delta = getValue() - ts.getValue();
+ return (delta == 0) ? 0 : (delta > 0) ? 1 : -1;
+ }
+ return super.compareTo(ts, withinPrecision);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#getDelta(org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp)
+ */
+ @Override
+ public ITmfTimestamp getDelta(final ITmfTimestamp ts) {
+ if (ts instanceof TmfSimpleTimestamp) {
+ return new TmfTimestampDelta(getValue() - ts.getValue());
+ }
+ return super.getDelta(ts);
+ }
+
+ // ------------------------------------------------------------------------
+ // Object
+ // ------------------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (other == null) {
+ return false;
+ }
+ if (!(other instanceof TmfSimpleTimestamp)) {
+ return super.equals(other);
+ }
+ final TmfSimpleTimestamp ts = (TmfSimpleTimestamp) other;
+
+ return compareTo(ts, false) == 0;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Updated as per TMF Event Model 1.0
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.timestamp;
+
+/**
+ * A utility class to define and manage time ranges.
+ *
+ * @author Francois Chouinard
+ * @version 1.0
+ * @since 2.0
+ *
+ * @see ITmfTimestamp
+ */
+public final class TmfTimeRange {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ /**
+ * The full possible time range
+ */
+ public static final TmfTimeRange ETERNITY =
+ new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
+
+ /**
+ * The null time range
+ */
+ public static final TmfTimeRange NULL_RANGE = new TmfTimeRange();
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final ITmfTimestamp fStartTime;
+ private final ITmfTimestamp fEndTime;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Default constructor
+ */
+ private TmfTimeRange() {
+ fStartTime = TmfTimestamp.BIG_BANG;
+ fEndTime = TmfTimestamp.BIG_BANG;
+ }
+
+ /**
+ * Full constructor
+ *
+ * @param startTime start of the time range
+ * @param endTime end of the time range
+ */
+ public TmfTimeRange(final ITmfTimestamp startTime, final ITmfTimestamp endTime) {
+ if (startTime == null || endTime == null) {
+ throw new IllegalArgumentException();
+ }
+ fStartTime = startTime;
+ fEndTime = endTime;
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param range the other time range
+ */
+ public TmfTimeRange(final TmfTimeRange range) {
+ if (range == null) {
+ throw new IllegalArgumentException();
+ }
+ fStartTime = range.getStartTime();
+ fEndTime = range.getEndTime();
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters
+ // ------------------------------------------------------------------------
+
+ /**
+ * @return the time range start time
+ */
+ public ITmfTimestamp getStartTime() {
+ return fStartTime;
+ }
+
+ /**
+ * @return the time range end time
+ */
+ public ITmfTimestamp getEndTime() {
+ return fEndTime;
+ }
+
+ // ------------------------------------------------------------------------
+ // Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Check if the timestamp is within the time range
+ *
+ * @param ts the timestamp to check
+ * @return true if [startTime] <= [ts] <= [endTime]
+ */
+ public boolean contains(final ITmfTimestamp ts) {
+ // Zero acts as a "universal donor" timestamp
+ if (ts.equals(TmfTimestamp.ZERO)) {
+ return true;
+ }
+ return (fStartTime.compareTo(ts, true) <= 0) && (fEndTime.compareTo(ts, true) >= 0);
+ }
+
+ /**
+ * Check if the time range is within the time range
+ *
+ * @param range the other time range
+ * @return true if [range] is fully contained
+ */
+ public boolean contains(final TmfTimeRange range) {
+ final ITmfTimestamp startTime = range.getStartTime();
+ final ITmfTimestamp endTime = range.getEndTime();
+ return (fStartTime.compareTo(startTime, true) <= 0) && (fEndTime.compareTo(endTime, true) >= 0);
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get intersection of two time ranges
+ *
+ * @param range the other time range
+ * @return the intersection time range, or null if no intersection exists
+ */
+ public TmfTimeRange getIntersection(final TmfTimeRange range) {
+ if (fStartTime.compareTo(range.fEndTime, true) > 0 || fEndTime.compareTo(range.fStartTime, true) < 0) {
+ return null; // no intersection
+ }
+
+ return new TmfTimeRange(fStartTime.compareTo(range.fStartTime, true) < 0
+ ? range.fStartTime
+ : fStartTime, fEndTime.compareTo(range.fEndTime, true) > 0
+ ? range.fEndTime
+ : fEndTime);
+ }
+
+ // ------------------------------------------------------------------------
+ // Object
+ // ------------------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + fEndTime.hashCode();
+ result = prime * result + fStartTime.hashCode();
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof TmfTimeRange)) {
+ return false;
+ }
+ final TmfTimeRange other = (TmfTimeRange) obj;
+ if (!fEndTime.equals(other.fEndTime)) {
+ return false;
+ }
+ if (!fStartTime.equals(other.fStartTime)) {
+ return false;
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ @SuppressWarnings("nls")
+ public String toString() {
+ return "TmfTimeRange [fStartTime=" + fStartTime + ", fEndTime=" + fEndTime + "]";
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2010, 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Thomas Gatterweh - Updated scaling / synchronization
+ * Francois Chouinard - Refactoring to align with TMF Event Model 1.0
+ * Francois Chouinard - Implement augmented interface
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.timestamp;
+
+/**
+ * A generic timestamp implementation. The timestamp is represented by the
+ * tuple { value, scale, precision }. By default, timestamps are scaled in
+ * seconds.
+ *
+ * @author Francois Chouinard
+ * @version 1.1
+ * @since 2.0
+ */
+public class TmfTimestamp implements ITmfTimestamp {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ /**
+ * The beginning of time
+ */
+ public static final ITmfTimestamp BIG_BANG =
+ new TmfTimestamp(Long.MIN_VALUE, Integer.MAX_VALUE, 0);
+
+ /**
+ * The end of time
+ */
+ public static final ITmfTimestamp BIG_CRUNCH =
+ new TmfTimestamp(Long.MAX_VALUE, Integer.MAX_VALUE, 0);
+
+ /**
+ * A more practical definition of "beginning of time"
+ * @since 2.0
+ */
+ public static final ITmfTimestamp PROJECT_IS_FUNDED = BIG_BANG;
+
+ /**
+ * A more practical definition of "end of time"
+ * @since 2.0
+ */
+ public static final ITmfTimestamp PROJECT_IS_CANNED = BIG_CRUNCH;
+
+ /**
+ * Zero
+ */
+ public static final ITmfTimestamp ZERO =
+ new TmfTimestamp(0, 0, 0);
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * The timestamp raw value (mantissa)
+ */
+ private final long fValue;
+
+ /**
+ * The timestamp scale (magnitude)
+ */
+ private final int fScale;
+
+ /**
+ * The value precision (tolerance)
+ */
+ private final int fPrecision;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Default constructor
+ */
+ public TmfTimestamp() {
+ this(0, ITmfTimestamp.SECOND_SCALE, 0);
+ }
+
+ /**
+ * Simple constructor (scale = precision = 0)
+ *
+ * @param value the timestamp value
+ */
+ public TmfTimestamp(final long value) {
+ this(value, ITmfTimestamp.SECOND_SCALE, 0);
+ }
+
+ /**
+ * Simple constructor (precision = 0)
+ *
+ * @param value the timestamp value
+ * @param scale the timestamp scale
+ */
+ public TmfTimestamp(final long value, final int scale) {
+ this(value, scale, 0);
+ }
+
+ /**
+ * Full constructor
+ *
+ * @param value the timestamp value
+ * @param scale the timestamp scale
+ * @param precision the timestamp precision
+ */
+ public TmfTimestamp(final long value, final int scale, final int precision) {
+ fValue = value;
+ fScale = scale;
+ fPrecision = Math.abs(precision);
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param timestamp the timestamp to copy
+ */
+ public TmfTimestamp(final ITmfTimestamp timestamp) {
+ if (timestamp == null) {
+ throw new IllegalArgumentException();
+ }
+ fValue = timestamp.getValue();
+ fScale = timestamp.getScale();
+ fPrecision = timestamp.getPrecision();
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfTimestamp
+ // ------------------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#getValue()
+ */
+ @Override
+ public long getValue() {
+ return fValue;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#getScale()
+ */
+ @Override
+ public int getScale() {
+ return fScale;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#getPrecision()
+ */
+ @Override
+ public int getPrecision() {
+ return fPrecision;
+ }
+
+ private static final long scalingFactors[] = new long[] {
+ 1L,
+ 10L,
+ 100L,
+ 1000L,
+ 10000L,
+ 100000L,
+ 1000000L,
+ 10000000L,
+ 100000000L,
+ 1000000000L,
+ 10000000000L,
+ 100000000000L,
+ 1000000000000L,
+ 10000000000000L,
+ 100000000000000L,
+ 1000000000000000L,
+ 10000000000000000L,
+ 100000000000000000L,
+ 1000000000000000000L,
+ };
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#normalize(long, int)
+ */
+ @Override
+ public ITmfTimestamp normalize(final long offset, final int scale) {
+
+ long value = fValue;
+ int precision = fPrecision;
+
+ // Handle the trivial case
+ if (fScale == scale && offset == 0) {
+ return this;
+ }
+
+ // In case of big bang and big crunch just return this (no need to normalize)
+ if (this.equals(BIG_BANG) || this.equals(BIG_CRUNCH)) {
+ return this;
+ }
+
+ // First, scale the timestamp
+ if (fScale != scale) {
+ final int scaleDiff = Math.abs(fScale - scale);
+ if (scaleDiff >= scalingFactors.length) {
+ throw new ArithmeticException("Scaling exception"); //$NON-NLS-1$
+ }
+
+ final long scalingFactor = scalingFactors[scaleDiff];
+ if (scale < fScale) {
+ value *= scalingFactor;
+ precision *= scalingFactor;
+ } else {
+ value /= scalingFactor;
+ precision /= scalingFactor;
+ }
+ }
+
+ // Then, apply the offset
+ if (offset < 0) {
+ value = (value < Long.MIN_VALUE - offset) ? Long.MIN_VALUE : value + offset;
+ } else {
+ value = (value > Long.MAX_VALUE - offset) ? Long.MAX_VALUE : value + offset;
+ }
+
+ return new TmfTimestamp(value, scale, precision);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#compareTo(org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp, boolean)
+ */
+ @Override
+ public int compareTo(final ITmfTimestamp ts, final boolean withinPrecision) {
+
+ // Check the corner cases (we can't use equals() because it uses compareTo()...)
+ if (ts == null) {
+ return 1;
+ }
+ if (this == ts || (fValue == ts.getValue() && fScale == ts.getScale())) {
+ return 0;
+ }
+ if ((fValue == BIG_BANG.getValue() && fScale == BIG_BANG.getScale()) || (ts.getValue() == BIG_CRUNCH.getValue() && ts.getScale() == BIG_CRUNCH.getScale())) {
+ return -1;
+ }
+ if ((fValue == BIG_CRUNCH.getValue() && fScale == BIG_CRUNCH.getScale()) || (ts.getValue() == BIG_BANG.getValue() && ts.getScale() == BIG_BANG.getScale())) {
+ return 1;
+ }
+
+ try {
+ final ITmfTimestamp nts = ts.normalize(0, fScale);
+ final long delta = fValue - nts.getValue();
+ if ((delta == 0) || (withinPrecision && (Math.abs(delta) <= (fPrecision + nts.getPrecision())))) {
+ return 0;
+ }
+ return (delta > 0) ? 1 : -1;
+ }
+ catch (final ArithmeticException e) {
+ // Scaling error. We can figure it out nonetheless.
+
+ // First, look at the sign of the mantissa
+ final long value = ts.getValue();
+ if (fValue == 0 && value == 0) {
+ return 0;
+ }
+ if (fValue < 0 && value >= 0) {
+ return -1;
+ }
+ if (fValue >= 0 && value < 0) {
+ return 1;
+ }
+
+ // Otherwise, just compare the scales
+ final int scale = ts.getScale();
+ return (fScale > scale) ? (fValue >= 0) ? 1 : -1 : (fValue >= 0) ? -1 : 1;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#getDelta(org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp)
+ */
+ @Override
+ public ITmfTimestamp getDelta(final ITmfTimestamp ts) {
+ final ITmfTimestamp nts = ts.normalize(0, fScale);
+ final long value = fValue - nts.getValue();
+ return new TmfTimestampDelta(value, fScale, fPrecision + nts.getPrecision());
+ }
+
+ // ------------------------------------------------------------------------
+ // Comparable
+ // ------------------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#compareTo(org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp)
+ */
+ @Override
+ public int compareTo(final ITmfTimestamp ts) {
+ return compareTo(ts, false);
+ }
+
+ // ------------------------------------------------------------------------
+ // Object
+ // ------------------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (fValue ^ (fValue >>> 32));
+ result = prime * result + fScale;
+ result = prime * result + fPrecision;
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (other == null) {
+ return false;
+ }
+ if (!(other instanceof TmfTimestamp)) {
+ return false;
+ }
+ final TmfTimestamp ts = (TmfTimestamp) other;
+ return compareTo(ts, false) == 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return toString(TmfTimestampFormat.getDefaulTimeFormat());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#toString(org.eclipse.linuxtools.tmf.core.event.TmfTimestampFormat)
+ */
+ /**
+ * @since 2.0
+ */
+ @Override
+ public String toString(final TmfTimestampFormat format) {
+ try {
+ ITmfTimestamp ts = normalize(0, ITmfTimestamp.NANOSECOND_SCALE);
+ return format.format(ts.getValue());
+ }
+ catch (ArithmeticException e) {
+ return format.format(0);
+ }
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.tmf.core.timestamp;
+
+import java.util.TimeZone;
+
+/**
+ * A generic timestamp implementation for delta between timestamps.
+ * The toString() method takes negative values into consideration.
+ *
+ * @author Bernd Hufmann
+ * @since 2.0
+ */
+public class TmfTimestampDelta extends TmfTimestamp {
+
+ // ------------------------------------------------------------------------
+ // Members
+ // ------------------------------------------------------------------------
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+ /**
+ * Default constructor
+ */
+ public TmfTimestampDelta() {
+ super();
+ }
+
+ /**
+ * Simple constructor (scale = precision = 0)
+ *
+ * @param value the timestamp value
+ */
+
+ public TmfTimestampDelta(long value) {
+ super(value);
+ }
+
+ /**
+ * Simple constructor (precision = 0)
+ *
+ * @param value the timestamp value
+ * @param scale the timestamp scale
+ */
+ public TmfTimestampDelta(long value, int scale) {
+ super(value, scale);
+ }
+
+
+ /**
+ * Copy constructor
+ *
+ * @param timestamp the timestamp to copy
+ */
+ public TmfTimestampDelta(ITmfTimestamp timestamp) {
+ super(timestamp);
+ }
+
+ /**
+ * Full constructor
+ *
+ * @param value the timestamp value
+ * @param scale the timestamp scale
+ * @param precision the timestamp precision
+ */
+ public TmfTimestampDelta(long value, int scale, int precision) {
+ super(value, scale, precision);
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#normalize(long, int)
+ */
+ @Override
+ public ITmfTimestamp normalize(final long offset, final int scale) {
+ ITmfTimestamp nts = super.normalize(offset, scale);
+ return new TmfTimestampDelta(nts.getValue(), nts.getScale(), nts.getPrecision());
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return toString(TmfTimestampFormat.getDefaulIntervalFormat());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#toString(org.eclipse.linuxtools.tmf.core.event.TmfTimestampFormat)
+ */
+ @Override
+ public String toString(TmfTimestampFormat format) {
+ if (getValue() < 0) {
+ TmfTimestampDelta tmpTs = new TmfTimestampDelta(-getValue(), getScale(), getPrecision());
+ return "-" + tmpTs.toString(format); //$NON-NLS-1$
+ }
+ TmfTimestampFormat deltaFormat = new TmfTimestampFormat(format.toPattern());
+ deltaFormat.setTimeZone(TimeZone.getTimeZone("UTC")); //$NON-NLS-1$
+ return super.toString(deltaFormat);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.timestamp;
+
+import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTimestampFormatUpdateSignal;
+
+/**
+ * A formatting and parsing facility that can handle timestamps that span the
+ * epoch with a precision down to the nanosecond. It can be understood as a
+ * simplified and more constrained version of SimpleDateFormat as it limits the
+ * number of allowed pattern characters and the acceptable timestamp formats.
+ * <p>
+ * The timestamp representation is broken down into a number of optional
+ * components that can be assembled into a fairly simple way.
+ *
+ * <h4>Date Pattern</h4>
+ * <blockquote>
+ * <table border=0 cellspacing=3 cellpadding=0 >
+ * <tr bgcolor="#ccccff">
+ * <th align=left>Format
+ * <th align=left>Description
+ * <th align=left>Value Range
+ * <th align=left>Example
+ * <tr>
+ * <td><code>yyyy</code>
+ * <td>Year
+ * <td><code>1970-...</code>
+ * <td><code>2012</code>
+ * <tr bgcolor="#eeeeff">
+ * <td><code>MM</code>
+ * <td>Month in year
+ * <td><code>01-12</code>
+ * <td><code>09</code>
+ * <tr>
+ * <td><code>dd</code>
+ * <td>Day in month
+ * <td><code>01-31</code>
+ * <td><code>22</code>
+ * </table>
+ * </blockquote>
+ *
+ * <h4>Time Pattern</h4>
+ * <blockquote>
+ * <table border=0 cellspacing=3 cellpadding=0 >
+ * <tr bgcolor="#ccccff">
+ * <th align=left>Format
+ * <th align=left>Description
+ * <th align=left>Value Range
+ * <th align=left>Example
+ * <tr>
+ * <td><code>HH</code>
+ * <td>Hour in day
+ * <td><code>00-23</code>
+ * <td><code>07</code>
+ * <tr bgcolor="#eeeeff">
+ * <td><code>mm</code>
+ * <td>Minute in hour
+ * <td><code>00-59</code>
+ * <td><code>35</code>
+ * <tr>
+ * <td><code>ss</code>
+ * <td>Second in minute
+ * <td><code>00-59</code>
+ * <td><code>41</code>
+ * <tr bgcolor="#eeeeff">
+ * <td><code>T</code>
+ * <td>The seconds since the epoch
+ * <td><code>00-...</code>
+ * <td><code>1332170682</code>
+ * </table>
+ * </blockquote>
+ *
+ * <h4>Sub-Seconds Pattern</h4>
+ * <blockquote>
+ * <table border=0 cellspacing=3 cellpadding=0 >
+ * <tr bgcolor="#ccccff">
+ * <th align=left>Format
+ * <th align=left>Description
+ * <th align=left>Value Range
+ * <th align=left>Example
+ * <tr>
+ * <td><code>SSS</code>
+ * <td>Millisecond in second
+ * <td><code>000-999</code>
+ * <td><code>123</code>
+ * <tr bgcolor="#eeeeff">
+ * <td><code>CCC</code>
+ * <td>Microseconds in ms
+ * <td><code>000-999</code>
+ * <td><code>456</code>
+ * <tr>
+ * <td><code>NNN</code>
+ * <td>Nanosecond in µs
+ * <td><code>000-999</code>
+ * <td><code>789</code>
+ * </table>
+ * </blockquote>
+ *
+ * <strong>Note: </strong>If "T" is used, no other Date or Time pattern
+ * can be used. Also, "T" should be used for time intervals.
+ * <p>
+ * <strong>Note: </strong>Each sub-field can be separated by a single,
+ * optional character delimiter. However, the between Date/Time and the
+ * Sub-seconds pattern is mandatory (if there is a fractional part) and
+ * has to be separated from Date/time by "." (period).
+ * <p>
+ * The recognized delimiters are:
+ * <ul>
+ * <li>Space ("<code> </code>")
+ * <li>Period (<code>".</code>")
+ * <li>Comma ("<code>,</code>")
+ * <li>Dash ("<code>-</code>")
+ * <li>Underline ("<code>_</code>")
+ * <li>Colon ("<code>:</code>")
+ * <li>Semicolon ("<code>;</code>")
+ * <li>Slash ("<code>/</code>")
+ * <li>Double-quote ("<code>"</code>")
+ * </ul>
+ *
+ * <h4>Examples</h4>
+ * The following examples show how timestamp patterns are interpreted in
+ * the U.S. locale. The given timestamp is 1332170682539677389L, the number
+ * of nanoseconds since 1970/01/01.
+ *
+ * <blockquote>
+ * <table border=0 cellspacing=3 cellpadding=0>
+ * <tr bgcolor="#ccccff">
+ * <th align=left>Date and Time Pattern
+ * <th align=left>Result
+ * <tr>
+ * <td><code>"yyyy-MM-dd HH:mm:ss.SSS.CCC.NNN"</code>
+ * <td><code>2012-03-19 11:24:42.539.677.389</code>
+ * <tr bgcolor="#eeeeff">
+ * <td><code>"yyyy-MM-dd HH:mm:ss.SSS.CCC"</code>
+ * <td><code>2012-03-19 11:24:42.539.677</code>
+ * <tr>
+ * <td><code>"yyyy-D HH:mm:ss.SSS.CCC"</code>
+ * <td><code>2012-79 11:24:42.539.677</code>
+ * <tr bgcolor="#eeeeff">
+ * <td><code>"ss.SSSCCCNNN"</code>
+ * <td><code>42.539677389</code>
+ * <tr>
+ * <td><code>"T.SSS CCC NNN"</code>
+ * <td><code>1332170682.539 677 389</code>
+ * <tr bgcolor="#eeeeff">
+ * <td><code>"T"</code>
+ * <td><code>1332170682</code>
+ * </table>
+ * </blockquote>
+ * <p>
+ * @version 1.0
+ * @since 2.0
+ * @author Francois Chouinard
+ */
+public class TmfTimestampFormat extends SimpleDateFormat {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ /**
+ * This class' serialization ID
+ */
+ private static final long serialVersionUID = 2835829763122454020L;
+
+ /**
+ * The default timestamp pattern
+ */
+ public static final String DEFAULT_TIME_PATTERN = "HH:mm:ss.SSS CCC NNN"; //$NON-NLS-1$
+
+ /**
+ * The LTTng 0.x legacy timestamp format
+ */
+ public static final String DEFAULT_INTERVAL_PATTERN = "TTT.SSS CCC NNN"; //$NON-NLS-1$
+
+ // Fractions of seconds supported patterns
+ private static final String DOT_RE = "\\."; //$NON-NLS-1$
+ private static final String SEP_RE = "[ \\.,-_:;/\\\"]?"; //$NON-NLS-1$
+ private static final String DGTS_3_RE = "(\\d{3})"; //$NON-NLS-1$
+ private static final String DGTS_13_RE = "(\\d{1,3})"; //$NON-NLS-1$
+
+ private static final String MILLISEC_RE = DOT_RE + DGTS_13_RE;
+ private static final String MICROSEC_RE = DOT_RE + DGTS_3_RE + SEP_RE + DGTS_13_RE;
+ private static final String NANOSEC_RE = DOT_RE + DGTS_3_RE + SEP_RE + DGTS_3_RE + SEP_RE + DGTS_13_RE;
+
+ private static final Pattern MILLISEC_PAT = Pattern.compile(MILLISEC_RE);
+ private static final Pattern MICROSEC_PAT = Pattern.compile(MICROSEC_RE);
+ private static final Pattern NANOSEC_PAT = Pattern.compile(NANOSEC_RE);
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ // The default timestamp pattern
+ private static String fDefaultTimePattern = null;
+ private static TmfTimestampFormat fDefaultTimeFormat = null;
+
+ // The default time interval format
+ private static String fDefaultIntervalPattern = null;
+ private static TmfTimestampFormat fDefaultIntervalFormat = null;
+
+ // The timestamp pattern
+ private String fPattern;
+
+ // The timestamp pattern
+ private List<String> fSupplPatterns = new ArrayList<String>();
+
+ /**
+ * The supplementary pattern letters. Can be redefined by sub-classes
+ * to either override existing letters or augment the letter set.
+ * If so, the format() method must provide the (re-)implementation of the
+ * pattern.
+ */
+ protected String fSupplPatternLetters = "TSCN"; //$NON-NLS-1$
+
+ /*
+ * The bracketing symbols used to mitigate the risk of a format string
+ * that contains escaped sequences that would conflict with our format
+ * extension.
+ */
+ /** The open bracket symbol */
+ protected String fOpenBracket = "[&"; //$NON-NLS-1$
+
+ /** The closing bracket symbol */
+ protected String fCloseBracket = "&]"; //$NON-NLS-1$
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * The default constructor (uses the default pattern)
+ */
+ public TmfTimestampFormat() {
+ this(fDefaultTimePattern);
+ }
+
+ /**
+ * The normal constructor
+ *
+ * @param pattern the format pattern
+ */
+ public TmfTimestampFormat(String pattern) {
+ applyPattern(pattern);
+ }
+
+ /**
+ * The copy constructor
+ *
+ * @param other the other format pattern
+ */
+ public TmfTimestampFormat(TmfTimestampFormat other) {
+ this(other.fPattern);
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/setters
+ // ------------------------------------------------------------------------
+
+ /**
+ * @param pattern the new default time pattern
+ */
+ public static void setDefaultTimeFormat(final String pattern) {
+ fDefaultTimePattern = pattern;
+ fDefaultTimeFormat = new TmfTimestampFormat(fDefaultTimePattern);
+ TmfSignalManager.dispatchSignal(new TmfTimestampFormatUpdateSignal(null));
+ }
+
+ /**
+ * @return the default time format pattern
+ */
+ public static TmfTimestampFormat getDefaulTimeFormat() {
+ if (fDefaultTimeFormat == null) {
+ fDefaultTimeFormat = new TmfTimestampFormat(DEFAULT_TIME_PATTERN);
+ }
+ return fDefaultTimeFormat;
+ }
+
+ /**
+ * @param pattern the new default interval pattern
+ */
+ public static void setDefaultIntervalFormat(final String pattern) {
+ fDefaultIntervalPattern = pattern;
+ fDefaultIntervalFormat = new TmfTimestampFormat(fDefaultIntervalPattern);
+ TmfSignalManager.dispatchSignal(new TmfTimestampFormatUpdateSignal(null));
+ }
+
+ /**
+ * @return the default interval format pattern
+ */
+ public static TmfTimestampFormat getDefaulIntervalFormat() {
+ if (fDefaultIntervalFormat == null) {
+ fDefaultIntervalFormat = new TmfTimestampFormat(DEFAULT_INTERVAL_PATTERN);
+ }
+ return fDefaultIntervalFormat;
+ }
+
+ /* (non-Javadoc)
+ * @see java.text.SimpleDateFormat#applyPattern(java.lang.String)
+ */
+ @Override
+ public void applyPattern(String pattern) {
+ fPattern = pattern;
+ String quotedPattern = quoteSpecificTags(pattern);
+ super.applyPattern(quotedPattern);
+ }
+
+ /* (non-Javadoc)
+ * @see java.text.SimpleDateFormat#toPattern()
+ */
+ @Override
+ public String toPattern() {
+ return fPattern;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Format the timestamp according to its pattern.
+ *
+ * @param value the timestamp value to format (in ns)
+ * @return the formatted timestamp
+ */
+ public synchronized String format(long value) {
+
+ // Split the timestamp value into its sub-components
+ long sec = value / 1000000000; // seconds
+ long ms = value % 1000000000 / 1000000; // milliseconds
+ long cs = value % 1000000 / 1000; // microseconds
+ long ns = value % 1000; // nanoseconds
+
+ // Let the base class fill the stuff it knows about
+ StringBuffer result = new StringBuffer(super.format(sec * 1000 + ms));
+
+ // In the case where there is no separation between 2 supplementary
+ // fields, the pattern will have the form "..'[pat-1]''[pat-2]'.." and
+ // the base class format() will interpret the 2 adjacent quotes as a
+ // wanted character in the result string as ("..[pat-1]'[pat-2]..").
+ // Remove these extra quotes before filling the supplementary fields.
+ int loc = result.indexOf(fCloseBracket + "'" + fOpenBracket); //$NON-NLS-1$
+ while (loc != -1) {
+ result.deleteCharAt(loc + fCloseBracket.length());
+ loc = result.indexOf(fCloseBracket + "'" + fOpenBracket); //$NON-NLS-1$
+ }
+
+ // Fill in our extensions
+ for (String pattern : fSupplPatterns) {
+ int length = pattern.length();
+
+ // Prepare the format buffer
+ StringBuffer fmt = new StringBuffer(length);
+ for (int i = 0; i < length; i++) {
+ fmt.append("0"); //$NON-NLS-1$
+ }
+ DecimalFormat dfmt = new DecimalFormat(fmt.toString());
+ String fmtVal = ""; //$NON-NLS-1$;
+
+ // Format the proper value as per the pattern
+ switch (pattern.charAt(0)) {
+ case 'T':
+ fmtVal = dfmt.format(sec);
+ break;
+ case 'S':
+ fmtVal = dfmt.format(ms);
+ break;
+ case 'C':
+ fmtVal = dfmt.format(cs);
+ break;
+ case 'N':
+ fmtVal = dfmt.format(ns);
+ break;
+ default:
+ break;
+ }
+
+ // Substitute the placeholder with the formatted value
+ String ph = new StringBuffer(fOpenBracket + pattern + fCloseBracket).toString();
+ loc = result.indexOf(ph);
+ result.replace(loc, loc + length + fOpenBracket.length() + fCloseBracket.length(), fmtVal);
+ }
+
+ return result.toString();
+ }
+
+ /**
+ * Parse a string according to the format pattern
+ *
+ * @param string the source string
+ * @param ref the reference (base) time
+ * @return the parsed value
+ * @throws ParseException if the string has an invalid format
+ */
+ public synchronized long parseValue(final String string, final long ref) throws ParseException {
+
+ // Trivial case
+ if (string == null || string.length() == 0) {
+ return 0;
+ }
+
+ // The timestamp sub-components
+ long seconds = -1;
+ long millisec = 0;
+ long microsec = 0;
+ long nanosec = 0;
+
+ // Since we are processing the fractional part, substitute it with
+ // its pattern so the base parser doesn't complain
+ StringBuilder sb = new StringBuilder(string);
+ int dot = string.indexOf('.');
+ if (dot == -1) {
+ sb.append('.');
+ dot = string.length();
+ }
+ sb = new StringBuilder(string.substring(0, dot));
+ String basePattern = super.toPattern();
+ int dot2 = basePattern.indexOf('.');
+ if (dot2 != -1) {
+ sb.append(basePattern.substring(dot2));
+ }
+
+ // Fill in our extensions
+ for (String pattern : fSupplPatterns) {
+ String pat = fOpenBracket + pattern + fCloseBracket;
+ Matcher matcher;
+
+ // Extract the substring corresponding to the extra pattern letters
+ // and replace with the pattern so the base parser can do its job.
+ switch (pattern.charAt(0)) {
+ case 'T':
+ // Remove everything up to the first "." and compute the
+ // number of seconds since the epoch. If there is no period,
+ // assume an integer value and return immediately
+ if (dot < 1) {
+ return new DecimalFormat("0").parse(string).longValue() * 1000000000; //$NON-NLS-1$
+ }
+ seconds = new DecimalFormat("0").parse(string.substring(0, dot)).longValue(); //$NON-NLS-1$
+ sb.delete(0, dot);
+ sb.insert(0, pat);
+ break;
+ case 'S':
+ matcher = MILLISEC_PAT.matcher(string.substring(dot));
+ if (matcher.find()) {
+ millisec = new Long(matcher.group(1));
+ for (int l = matcher.group(1).length(); l < 3; l++) {
+ millisec *= 10;
+ }
+ }
+ stripQuotes(sb, pattern);
+ break;
+ case 'C':
+ matcher = MICROSEC_PAT.matcher(string.substring(dot));
+ if (matcher.find()) {
+ microsec = new Long(matcher.group(2));
+ for (int l = matcher.group(2).length(); l < 3; l++) {
+ microsec *= 10;
+ }
+ }
+ stripQuotes(sb, pattern);
+ break;
+ case 'N':
+ matcher = NANOSEC_PAT.matcher(string.substring(dot));
+ if (matcher.find()) {
+ nanosec = new Long(matcher.group(3));
+ for (int l = matcher.group(3).length(); l < 3; l++) {
+ nanosec *= 10;
+ }
+ }
+ stripQuotes(sb, pattern);
+ break;
+ default:
+ break;
+ }
+ }
+
+ // If there was no "T" (thus not an interval), parse as a date
+ if (seconds == -1) {
+ Date baseDate = super.parse(sb.toString());
+
+ Calendar refTime = Calendar.getInstance(getTimeZone());
+ refTime.setTimeInMillis(ref / 1000000);
+ Calendar newTime = Calendar.getInstance(getTimeZone());
+ newTime.setTimeInMillis(baseDate.getTime());
+
+ int[] fields = new int[] { Calendar.YEAR, Calendar.MONTH, Calendar.DATE, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND };
+ for (int field : fields) {
+ int value = newTime.get(field);
+ // Do some adjustments...
+ if (field == Calendar.YEAR) {
+ value -= 1970;
+ } else if (field == Calendar.DATE) {
+ value -= 1;
+ }
+ // ... and fill-in the empty fields
+ if (value == 0) {
+ newTime.set(field, refTime.get(field));
+ } else {
+ break; // Get out as soon as we have a significant value
+ }
+ }
+ seconds = newTime.getTimeInMillis() / 1000;
+ }
+
+ // Compute the value in ns
+ return seconds * 1000000000 + millisec * 1000000 + microsec * 1000 + nanosec;
+ }
+
+ /**
+ * Parse a string according to the format pattern
+ *
+ * @param string the source string
+ * @return the parsed value
+ * @throws ParseException if the string has an invalid format
+ */
+ public long parseValue(final String string) throws ParseException {
+ long result = parseValue(string, 0);
+ return result;
+
+ }
+
+ // ------------------------------------------------------------------------
+ // Helper functions
+ // ------------------------------------------------------------------------
+
+ /**
+ * Copy the pattern but quote (bracket with "[&" and "&]") the
+ * TmfTimestampFormat specific tags so these fields are treated as
+ * comments by the base class.
+ *
+ * It also keeps track of the corresponding quoted fields so they can be
+ * properly populated later on (by format()).
+ *
+ * @param pattern the 'extended' pattern
+ * @return the quoted and bracketed pattern
+ */
+ private String quoteSpecificTags(final String pattern) {
+
+ StringBuffer result = new StringBuffer();
+
+ int length = pattern.length();
+ boolean inQuote = false;
+
+ for (int i = 0; i < length; i++) {
+ char c = pattern.charAt(i);
+ result.append(c);
+ if (c == '\'') {
+ // '' is treated as a single quote regardless of being
+ // in a quoted section.
+ if ((i + 1) < length) {
+ c = pattern.charAt(i + 1);
+ if (c == '\'') {
+ i++;
+ result.append(c);
+ continue;
+ }
+ }
+ inQuote = !inQuote;
+ continue;
+ }
+ if (!inQuote) {
+ if (fSupplPatternLetters.indexOf(c) != -1) {
+ StringBuilder pat = new StringBuilder();
+ pat.append(c);
+ result.insert(result.length() - 1, "'" + fOpenBracket); //$NON-NLS-1$
+ while ((i + 1) < length && pattern.charAt(i + 1) == c) {
+ result.append(c);
+ pat.append(c);
+ i++;
+ }
+ result.append(fCloseBracket + "'"); //$NON-NLS-1$
+ fSupplPatterns.add(pat.toString());
+ }
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * Remove the quotes from the pattern
+ *
+ * @param sb
+ * @param pattern
+ */
+ private void stripQuotes(StringBuilder sb, String pattern) {
+ String pt = "'" + fOpenBracket + pattern + fCloseBracket + "'"; //$NON-NLS-1$//$NON-NLS-2$
+ int l = sb.indexOf(pt);
+ if (l != -1) {
+ sb.delete(l + pt.length() - 1, l + pt.length());
+ sb.delete(l, l + 1);
+ }
+ }
+
+}
package org.eclipse.linuxtools.tmf.core.trace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
/**
* The basic trace checkpoint structure in TMF. The purpose of the checkpoint is
// ------------------------------------------------------------------------
/**
- * @return the timestamp of the event referred to by the checkpoint
+ * @return the timestamp of the event referred to by the context
+ * @since 2.0
*/
public ITmfTimestamp getTimestamp();
import org.eclipse.core.resources.IResource;
import org.eclipse.linuxtools.tmf.core.component.ITmfDataProvider;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
/**
* The event stream structure in TMF. In its basic form, a trace has:
/**
* @return the trace time range
+ * @since 2.0
*/
public TmfTimeRange getTimeRange();
/**
* @return the timestamp of the first trace event
+ * @since 2.0
*/
public ITmfTimestamp getStartTime();
/**
* @return the timestamp of the last trace event
+ * @since 2.0
*/
public ITmfTimestamp getEndTime();
*
* @param timestamp the timestamp of desired event
* @return a context which can later be used to read the corresponding event
+ * @since 2.0
*/
public ITmfContext seekEvent(ITmfTimestamp timestamp);
package org.eclipse.linuxtools.tmf.core.trace;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
/**
* The generic trace indexer in TMF with support for incremental indexing.
* @param waitForCompletion
* Should we block the calling thread until the build is
* complete?
+ * @since 2.0
*/
public void buildIndex(long offset, TmfTimeRange range, boolean waitForCompletion);
*
* @param context The trace context to save
* @param timestamp The timestamp matching this context
+ * @since 2.0
*/
public void updateIndex(ITmfContext context, ITmfTimestamp timestamp);
*
* @param timestamp the requested timestamp
* @return the checkpoint context
+ * @since 2.0
*/
public ITmfContext seekIndex(ITmfTimestamp timestamp);
package org.eclipse.linuxtools.tmf.core.trace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
/**
* A basic implementation of ITmfCheckpoint. It simply maps an event timestamp
* Full constructor
*
* @param timestamp the checkpoint timestamp
- * @param location the checkpoint location
+ * @param location the corresponding trace location
* @since 2.0
*/
public TmfCheckpoint(final ITmfTimestamp timestamp, final ITmfLocation location) {
// ITmfCheckpoint
// ------------------------------------------------------------------------
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfCheckpoint#getTimestamp()
+ /**
+ * @since 2.0
*/
@Override
public ITmfTimestamp getTimestamp() {
import org.eclipse.linuxtools.internal.tmf.core.Messages;
import org.eclipse.linuxtools.tmf.core.component.TmfDataProvider;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
/**
* A simple indexer that manages the trace index as an array of trace
// ITmfTraceIndexer - buildIndex
// ------------------------------------------------------------------------
- /* (non-Javadoc)
- *
- * The index is a list of contexts that point to events at regular interval
- * (rank-wise) in the trace. After it is built, the index can be used to
- * quickly access any event by rank or timestamp (using seekIndex()).
- *
- * The index is built simply by reading the trace
- *
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTraceIndexer#buildIndex(long, org.eclipse.linuxtools.tmf.core.event.TmfTimeRange, boolean)
+ /**
+ * @since 2.0
*/
@Override
public void buildIndex(final long offset, final TmfTimeRange range, final boolean waitForCompletion) {
// ITmfTraceIndexer - updateIndex
// ------------------------------------------------------------------------
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTraceIndexer#updateIndex(org.eclipse.linuxtools.tmf.core.trace.ITmfContext, org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp)
+ /**
+ * @since 2.0
*/
@Override
public synchronized void updateIndex(final ITmfContext context, final ITmfTimestamp timestamp) {
// ITmfTraceIndexer - seekIndex
// ------------------------------------------------------------------------
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTraceIndexer#seekIndex(org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp)
+ /**
+ * @since 2.0
*/
@Override
public synchronized ITmfContext seekIndex(final ITmfTimestamp timestamp) {
import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentLocation;
import org.eclipse.linuxtools.internal.tmf.core.trace.TmfLocationArray;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceRangeUpdatedSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
/**
* TmfExperiment presents a time-ordered, unified view of a set of ITmfTrace:s
*
* @param index the event index (rank)
* @return the corresponding event timestamp
+ * @since 2.0
*/
public ITmfTimestamp getTimestamp(final int index) {
final ITmfContext context = seekEvent(index);
package org.eclipse.linuxtools.tmf.core.trace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
/**
* A concrete implementation of TmfLocation based on ITmfTimestamp:s
import org.eclipse.core.runtime.IPath;
import org.eclipse.linuxtools.tmf.core.component.TmfEventProvider;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
import org.eclipse.linuxtools.tmf.core.statistics.TmfStateStatistics;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
/**
* Abstract implementation of ITmfTrace.
// ITmfTrace - Trace characteristics getters
// ------------------------------------------------------------------------
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getNbEvents()
- */
@Override
public synchronized long getNbEvents() {
return fNbEvents;
}
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getTimeRange()
+ /**
+ * @since 2.0
*/
@Override
public TmfTimeRange getTimeRange() {
return new TmfTimeRange(fStartTime, fEndTime);
}
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getStartTime()
+ /**
+ * @since 2.0
*/
@Override
public ITmfTimestamp getStartTime() {
return fStartTime;
}
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getEndTime()
+ /**
+ * @since 2.0
*/
@Override
public ITmfTimestamp getEndTime() {
return fEndTime;
}
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentTime()
- */
/**
* @since 2.0
*/
return fCurrentTime;
}
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentRange()
- */
/**
* @since 2.0
*/
return fCurrentRange;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getInitialRangeOffset()
- */
/**
* @since 2.0
*/
* Update the trace events time range
*
* @param range the new time range
+ * @since 2.0
*/
protected void setTimeRange(final TmfTimeRange range) {
fStartTime = range.getStartTime();
* Update the trace chronologically first event timestamp
*
* @param startTime the new first event timestamp
+ * @since 2.0
*/
protected void setStartTime(final ITmfTimestamp startTime) {
fStartTime = startTime;
* Update the trace chronologically last event timestamp
*
* @param endTime the new last event timestamp
+ * @since 2.0
*/
protected void setEndTime(final ITmfTimestamp endTime) {
fEndTime = endTime;
// ITmfTrace - SeekEvent operations (returning a trace context)
// ------------------------------------------------------------------------
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(long)
- */
@Override
public synchronized ITmfContext seekEvent(final long rank) {
return context;
}
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp)
+ /**
+ * @since 2.0
*/
@Override
public synchronized ITmfContext seekEvent(final ITmfTimestamp timestamp) {
// ITmfTrace - Read operations (returning an actual event)
// ------------------------------------------------------------------------
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#readNextEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfContext)
- */
@Override
public synchronized ITmfEvent getNext(final ITmfContext context) {
// parseEvent() does not update the context
*
* @param context the current trace context
* @param timestamp the corresponding timestamp
+ * @since 2.0
*/
protected synchronized void updateAttributes(final ITmfContext context, final ITmfTimestamp timestamp) {
if (fStartTime.equals(TmfTimestamp.BIG_BANG) || (fStartTime.compareTo(timestamp, false) > 0)) {
// toString
// ------------------------------------------------------------------------
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
@Override
@SuppressWarnings("nls")
public synchronized String toString() {
/**********************************************************************
* Copyright (c) 2011 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.tmf.core.uml2sd;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
/**
* <p>
- * Interface for asynchronous sequence diagram events.
+ * Interface for asynchronous sequence diagram events.
* </p>
- *
+ *
* @version 1.0
* @author Bernd Hufmann
*/
public interface ITmfAsyncSequenceDiagramEvent extends ITmfSyncSequenceDiagramEvent {
/**
* Returns end timestamp of message (i.e. receive time)
- *
+ *
* @return end timestamp of message (i.e. receive time)
+ * @since 2.0
*/
public ITmfTimestamp getEndTime();
}
/**********************************************************************
* Copyright (c) 2011 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.tmf.core.uml2sd;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
/**
* <p>
- * Interface for synchronous sequence diagram events.
+ * Interface for synchronous sequence diagram events.
* </p>
- *
+ *
* @version 1.0
* @author Bernd Hufmann
*/
public interface ITmfSyncSequenceDiagramEvent {
-
+
/**
* Returns Name of message.
- *
+ *
* @return Name of message
*/
public String getName();
-
+
/**
* Returns name of sender of message.
- *
+ *
* @return name of sender of message
*/
public String getSender();
-
+
/**
* Returns Name of receiver of message.
- *
+ *
* @return Name of receiver of message
*/
public String getReceiver();
/**
* Returns Start time of message (i.e. send time).
- *
+ *
* @return Start timestamp of message (i.e. send time)
+ * @since 2.0
*/
public ITmfTimestamp getStartTime();
}
package org.eclipse.linuxtools.tmf.core.uml2sd;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
/**
* <p>
// Operations
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.uml2sd.ITmfAsyncSequenceDiagramEvent#getEndTime()
+ /**
+ * @since 2.0
*/
@Override
public ITmfTimestamp getEndTime() {
package org.eclipse.linuxtools.tmf.core.uml2sd;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
/**
* <p>
return fName;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.uml2sd.ITmfSyncSequenceDiagramEvent#getStartTime()
+ /**
+ * @since 2.0
*/
@Override
public ITmfTimestamp getStartTime() {
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.Messages;
import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnData;
import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.Messages;
import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTree;
import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeNode;
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.Messages;
import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTree;
import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeNode;
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.loader;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
/**
* Interface for testing signal handling within TmfUml2SD
import java.util.List;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Lifeline;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.dialogs.Criteria;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import java.util.List;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.loader.TmfSyncMessage;
import org.junit.AfterClass;
package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.loader;
import org.eclipse.linuxtools.tmf.core.component.TmfComponent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.signal.TmfStartSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
/**
* Class to implement that certain signals are sent as well as are sent with correct content.
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.loader;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
/**
* Timestamp implementation for UML2SD test cases.
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.AsyncMessageReturn;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BasicExecutionOccurrence;
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+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.ITmfTrace;
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTraceDefinition.OutputColumn;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
/**
import java.util.List;
import org.eclipse.linuxtools.internal.tmf.ui.Messages;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
/**
* Base class for custom trace definitions.
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputData;
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
/**
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.io.BufferedRandomAccessFile;
+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;
package org.eclipse.linuxtools.internal.tmf.ui.parsers.custom;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
/**
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTraceDefinition.InputAttribute;
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTraceDefinition.InputElement;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.io.BufferedRandomAccessFile;
+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.internal.tmf.ui.parsers.custom.CustomTraceDefinition.OutputColumn;
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTrace;
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTraceDefinition.OutputColumn;
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTrace;
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTraceDefinition;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestampFormat;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestampFormat;
/**
* TMF Time format preferences
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestampFormat;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestampFormat;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.filter.ITmfFilter;
import org.eclipse.linuxtools.tmf.core.filter.model.ITmfFilterTreeNode;
import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterAndNode;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.linuxtools.tmf.core.component.TmfComponent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.signal.TmfStatsUpdatedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceRangeUpdatedSignal;
import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
import org.eclipse.linuxtools.tmf.ui.viewers.TmfViewer;
package org.eclipse.linuxtools.tmf.ui.views.histogram;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestampFormat;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
import org.eclipse.linuxtools.tmf.core.signal.TmfTimestampFormatUpdateSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestampFormat;
import org.eclipse.linuxtools.tmf.ui.views.TmfView;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import java.text.ParseException;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestampFormat;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
import org.eclipse.linuxtools.tmf.core.signal.TmfTimestampFormatUpdateSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestampFormat;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.swt.widgets.Composite;
package org.eclipse.linuxtools.tmf.ui.views.histogram;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
/**
* The number of events per block
* @param execType
* The requested execution priority
+ * @since 2.0
*
*/
public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range,
import java.text.ParseException;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestampFormat;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
import org.eclipse.linuxtools.tmf.core.signal.TmfTimestampFormatUpdateSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestampFormat;
import org.eclipse.swt.widgets.Composite;
/**
package org.eclipse.linuxtools.tmf.ui.views.histogram;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceRangeUpdatedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.ui.editors.ITmfTraceEditor;
import org.eclipse.linuxtools.tmf.ui.views.TmfView;
* Returns the time range of the current selected window (base on default time scale).
*
* @return the time range of current selected window.
+ * @since 2.0
*/
public TmfTimeRange getTimeRange() {
return new TmfTimeRange(
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.signal.TmfEventFilterAppliedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfEventSearchAppliedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.ui.editors.ITmfTraceEditor;
**********************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.uml2sd;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
* @param value the current in the scale
* @param min the scale min
* @param max the scale max
+ * @since 2.0
*/
public void showToolTip(ITmfTimestamp value, ITmfTimestamp min, ITmfTimestamp max) {
fMinMaxRange = new TmfTimeRange(min, max);
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BaseMessage;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BasicExecutionOccurrence;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Frame;
import java.util.List;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.AsyncMessage;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.AsyncMessageReturn;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BaseMessage;
import java.util.Comparator;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
* @see Lifeline Lifeline for more event occurence details
* @version 1.0
* @author sveyrier
+ * @since 2.0
*/
public class AsyncMessage extends BaseMessage implements ITimeRange {
* Set the time when the message end
*
* @param time the time when the message end
+ * @since 2.0
*/
public void setEndTime(ITmfTimestamp time) {
fEndTime = time;
* Set the time when the message start
*
* @param time the time when the message start
+ * @since 2.0
*/
public void setStartTime(ITmfTimestamp time) {
fStartTime = time;
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ITimeRange#getEndTime()
+ /**
+ * @since 2.0
*/
@Override
public ITmfTimestamp getEndTime() {
return fEndTime;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ITimeRange#getStartTime()
+ /**
+ * @since 2.0
*/
@Override
public ITmfTimestamp getStartTime() {
return fStartTime;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ITimeRange#hasTimeInfo()
- */
@Override
public boolean hasTimeInfo() {
return fHasTime;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
* Return the minimum time stored in the frame taking all GraphNodes into account
*
* @return the minimum GraphNode time
+ * @since 2.0
*/
public ITmfTimestamp getMinTime() {
if (fLastExternalTimePref != SDViewPref.getInstance().excludeExternalTime()) {
*
* @param min
* The minimum timestamp
+ * @since 2.0
*/
public void setMin(ITmfTimestamp min) {
fMinTime = min;
*
* @param max
* The maximum timestamp
+ * @since 2.0
*/
public void setMax(ITmfTimestamp max) {
fMaxTime = max;
* Return the maximum time stored in the frame taking all GraphNodes into account
*
* @return the maximum GraphNode time
+ * @since 2.0
*/
public ITmfTimestamp getMaxTime() {
if (fLastExternalTimePref != SDViewPref.getInstance().excludeExternalTime()) {
* Returns the minimum time between consecutive messages.
*
* @return the minimum time between consecutive messages
+ * @since 2.0
*/
public ITmfTimestamp getSDMinTime() {
computeMaxMinTime();
* Returns the maximum time between consecutive messages.
*
* @return the maximum time between consecutive messages
+ * @since 2.0
*/
public ITmfTimestamp getSDMaxTime() {
computeMaxMinTime();
**********************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IImage;
* Set the time when the execution occurrence starts.
*
* @param time the time when the execution occurrence starts
+ * @since 2.0
*/
public void setStartTime(ITmfTimestamp time) {
fStartTime = time;
* Set the time when the execution occurrence ends.
*
* @param time the time when the execution occurrence ends
+ * @since 2.0
*/
public void setEndTime(ITmfTimestamp time) {
fEndTime = time;
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ITimeRange#getStartTime()
+ /**
+ * @since 2.0
*/
@Override
public ITmfTimestamp getStartTime() {
return fStartTime;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ITimeRange#getEndTime()
+ /**
+ * @since 2.0
*/
@Override
public ITmfTimestamp getEndTime() {
import java.util.Iterator;
import java.util.List;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
* @param dateToFind date to be found
* @param bounds a two items array that will receive bounds if found
* @return true if both bounds not null
+ * @since 2.0
*/
public boolean findDateBounds(ITmfTimestamp dateToFind, ITimeRange bounds[]) {
if (hasTimeInfo()) {
/**********************************************************************
* Copyright (c) 2005, 2006 IBM Corporation and others.
* Copyright (c) 2011, 2012 Ericsson.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* IBM - Initial API and implementation
* Bernd Hufmann - Updated for TMF
**********************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
/**
* A interface for handling time ranges.
- *
+ *
* @version 1.0
* @author sveyrier
- *
+ *
*/
public interface ITimeRange {
/**
* Returns the time when the message began.
* @return the time when the message began
+ * @since 2.0
*/
public ITmfTimestamp getStartTime();
/**
* Returns the time when the message ended.
- *
+ *
* @return the time when the message ended
+ * @since 2.0
*/
public ITmfTimestamp getEndTime();
/**
* Returns flag to indicate whether time information is available or not.
- *
- * @return flag to indicate whether time information is available or not
+ *
+ * @return flag to indicate whether time information is available or not
*/
public boolean hasTimeInfo();
}
/**********************************************************************
* Copyright (c) 2005, 2006 IBM Corporation and others.
* Copyright (c) 2011, 2012 Ericsson.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* IBM - Initial API and implementation
* Bernd Hufmann - Updated for TMF
**********************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
/**
- * Class implementation of a sequence diagram time event.
- *
+ * Class implementation of a sequence diagram time event.
+ *
* @version 1.0
* @author sveyrier
- *
+ *
*/
public class SDTimeEvent {
// ------------------------------------------------------------------------
/**
* The default constructor.
- *
+ *
* @param time The time stamp of the event.
* @param event The event index.
* @param node The time range implementing node.
+ * @since 2.0
*/
public SDTimeEvent(ITmfTimestamp time, int event, ITimeRange node) {
fTimestamp = time;
// ------------------------------------------------------------------------
/**
* Returns the timestamp of the event.
- *
+ *
* @return the timestamp of the event.
+ * @since 2.0
*/
public ITmfTimestamp getTime() {
return fTimestamp;
/**
* Returns the event index.
- *
+ *
* @return the event index.
*/
public int getEvent() {
/**
* Returns the time range implementing node.
- *
+ *
* @return the time range implementing node.
*/
public ITimeRange getGraphNode() {
import java.util.Comparator;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
* Set the time when the message occurs
*
* @param time the time when the message occurs
+ * @since 2.0
*/
public void setTime(ITmfTimestamp time) {
fEventTime = time;
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ITimeRange#getEndTime()
+ /**
+ * @since 2.0
*/
@Override
public ITmfTimestamp getEndTime() {
return fEventTime;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ITimeRange#getStartTime()
+ /**
+ * @since 2.0
*/
@Override
public ITmfTimestamp getStartTime() {
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDWidget;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages;
import org.eclipse.swt.SWT;
import org.eclipse.linuxtools.tmf.core.component.TmfComponent;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.uml2sd.ITmfSyncSequenceDiagramEvent;
import org.eclipse.linuxtools.tmf.core.uml2sd.TmfSyncSequenceDiagramEvent;
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
+
/**
* Returns the current time if available else null.
*
* @return the current time if available else null
+ * @since 2.0
*/
public ITmfTimestamp getCurrentTime() {
fLock.lock();
*
* @param time The timestamp
* @return page that contains the time
+ * @since 2.0
*/
protected int getPage(ITmfTimestamp time) {
int page;
*
* @param startTime The start time of time range.
* @return the time range
+ * @since 2.0
*/
protected TmfTimeRange getSignalTimeRange(ITmfTimestamp startTime) {
fLock.lock();
*
* @param findCriteria The search criteria
* @param window Time range to search in
+ * @since 2.0
*/
public SearchJob(Criteria findCriteria, TmfTimeRange window) {
super(Messages.TmfUml2SDSyncLoader_SearchJobDescrition);
* Returns timestamp of found time.
*
* @return timestamp of found time.
+ * @since 2.0
*/
public ITmfTimestamp getFoundTime() {
return fFoundTime;