Merge commit '3a6b7eb9a532100a4cb85e0a81fbc8bd6e91db13' into lttng-luna
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 10 Sep 2013 20:15:51 +0000 (16:15 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 10 Sep 2013 20:28:43 +0000 (16:28 -0400)
These conflicts are a little intense, let's fix them one merge at a time...

Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Conflicts:
lttng/org.eclipse.linuxtools.ctf.core/META-INF/MANIFEST.MF
lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventFactory.java
lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/OpenExperimentHandler.java

Change-Id: If5589c465c299b4f2c718ae25426c5afe446fce1

238 files changed:
org.eclipse.linuxtools.ctf.core.tests/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.ctf.core.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.ctf.core.tests/pom.xml
org.eclipse.linuxtools.ctf.core.tests/shared/org/eclipse/linuxtools/ctf/core/tests/shared/CtfTestTraces.java
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/CTFTraceCallsitePerformanceTest.java
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/CTFTraceTest.java
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/IntegerDefinitionTest.java
org.eclipse.linuxtools.ctf.core.tests/traces/.gitignore
org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.sh
org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.xml
org.eclipse.linuxtools.ctf.core/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.ctf.core/META-INF/MANIFEST.MF
org.eclipse.linuxtools.ctf.core/pom.xml
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/IntegerDefinition.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/CTFCallsiteComparator.java [new file with mode: 0644]
org.eclipse.linuxtools.ctf.parser/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.ctf.parser/META-INF/MANIFEST.MF
org.eclipse.linuxtools.ctf.parser/pom.xml
org.eclipse.linuxtools.ctf/feature.xml
org.eclipse.linuxtools.ctf/pom.xml
org.eclipse.linuxtools.gdbtrace.core.tests/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.gdbtrace.core.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.gdbtrace.core.tests/pom.xml
org.eclipse.linuxtools.gdbtrace.core/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.gdbtrace.core/META-INF/MANIFEST.MF
org.eclipse.linuxtools.gdbtrace.core/pom.xml
org.eclipse.linuxtools.gdbtrace.core/src/org/eclipse/linuxtools/internal/gdbtrace/core/trace/GdbTrace.java
org.eclipse.linuxtools.gdbtrace.help/META-INF/MANIFEST.MF
org.eclipse.linuxtools.gdbtrace.help/pom.xml
org.eclipse.linuxtools.gdbtrace.ui.tests/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.gdbtrace.ui.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.gdbtrace.ui.tests/pom.xml
org.eclipse.linuxtools.gdbtrace.ui/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.gdbtrace.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.gdbtrace.ui/pom.xml
org.eclipse.linuxtools.gdbtrace/feature.xml
org.eclipse.linuxtools.gdbtrace/pom.xml
org.eclipse.linuxtools.lttng.alltests/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.lttng.help/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng.help/pom.xml
org.eclipse.linuxtools.lttng.releng-site/pom.xml
org.eclipse.linuxtools.lttng2.core.tests/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.lttng2.core.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.core.tests/pom.xml
org.eclipse.linuxtools.lttng2.core/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.lttng2.core/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.core/pom.xml
org.eclipse.linuxtools.lttng2.kernel.core.tests/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.lttng2.kernel.core.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.kernel.core.tests/pom.xml
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/AllTests.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/AllTests.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/ExperimentSyncTest.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/MatchAndSyncTest.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.kernel.core/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.lttng2.kernel.core/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.kernel.core/pom.xml
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/Activator.java
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/TcpEventStrings.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpEventMatching.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpLttngEventMatching.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/LttngKernelTrace.java
org.eclipse.linuxtools.lttng2.kernel.ui.tests/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.lttng2.kernel.ui.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.kernel.ui.tests/pom.xml
org.eclipse.linuxtools.lttng2.kernel.ui/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.lttng2.kernel.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.kernel.ui/pom.xml
org.eclipse.linuxtools.lttng2.kernel/feature.xml
org.eclipse.linuxtools.lttng2.kernel/pom.xml
org.eclipse.linuxtools.lttng2.ui.tests/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.lttng2.ui.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.ui.tests/pom.xml
org.eclipse.linuxtools.lttng2.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.ui/pom.xml
org.eclipse.linuxtools.lttng2.ust.core.tests/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.lttng2.ust.core.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.ust.core.tests/pom.xml
org.eclipse.linuxtools.lttng2.ust.core/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.lttng2.ust.core/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.ust.core/pom.xml
org.eclipse.linuxtools.lttng2.ust.ui.tests/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.lttng2.ust.ui.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.ust.ui.tests/pom.xml
org.eclipse.linuxtools.lttng2.ust.ui/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.lttng2.ust.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.ust.ui/pom.xml
org.eclipse.linuxtools.lttng2.ust/feature.xml
org.eclipse.linuxtools.lttng2.ust/pom.xml
org.eclipse.linuxtools.lttng2/feature.xml
org.eclipse.linuxtools.lttng2/pom.xml
org.eclipse.linuxtools.tmf.core.tests/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.tmf.core.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.core.tests/pom.xml
org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/CtfTmfTestTraces.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/AllTmfCoreTests.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/component/TmfEventProviderTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventFieldTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTraceTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/EventContextTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/RequestBenchmark.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/event/TmfEventTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfCoalescedDataRequestTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfCoalescedEventRequestTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfDataRequestTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfEventRequestTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfSchedulerTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/AllTests.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/SyncTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/TsTransformTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/AllTests.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointIndexTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointIndexTest2.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfContextTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentCheckpointIndexTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfLocationTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfStringLocation.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/AllTests.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest2.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfExperimentCheckpointIndexTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/location/AllTests.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/location/TmfLocationTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/location/TmfStringLocation.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfDataProviderStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfEventProviderStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfSyntheticEventProviderStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/event/TmfSyncEventStub.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/request/TmfDataRequestStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/request/TmfEventRequestStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfEmptyTraceStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfIndexerStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java
org.eclipse.linuxtools.tmf.core/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.tmf.core/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.core/pom.xml
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/Activator.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfCoalescedDataRequest.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfCoalescedEventRequest.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/HistoryBuilder.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfExperimentLocation.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfLocationArray.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfDataProvider.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfEventProvider.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfContext.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventFactory.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/ITmfEventField.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfEventField.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/IMatchProcessingUnit.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/ITmfEventMatching.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/ITmfMatchEventDefinition.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventDependency.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventMatches.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventMatching.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfNetworkEventMatching.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfNetworkMatchDefinition.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/request/ITmfDataRequest.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/request/TmfDataRequest.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/request/TmfEventRequest.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/signal/TmfTraceSynchronizedSignal.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statistics/TmfEventsStatistics.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/ITmfTimestampTransform.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SyncAlgorithmFullyIncremental.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationAlgorithm.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationManager.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/TmfTimestampTransform.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/TmfTimestampTransformLinear.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/timestamp/TmfTimestamp.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfCheckpoint.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfContext.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfLocation.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTrace.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceIndexer.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpoint.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpointIndexer.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfContext.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfLocation.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfLongLocation.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTimestampLocation.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/ITmfTraceIndexer.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/ITmfCheckpoint.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/TmfCheckpoint.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/ITmfLocation.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfLocation.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfLongLocation.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfTimestampLocation.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.help/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.help/pom.xml
org.eclipse.linuxtools.tmf.ui.tests/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.tmf.ui.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.ui.tests/pom.xml
org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestFacility.java
org.eclipse.linuxtools.tmf.ui/.settings/org.eclipse.pde.api.tools.prefs
org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.ui/icons/eview16/synced.gif [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ui/plugin.properties
org.eclipse.linuxtools.tmf.ui/plugin.xml
org.eclipse.linuxtools.tmf.ui/pom.xml
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTrace.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTraceContext.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomXmlTrace.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomXmlTraceContext.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/Messages.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/messages.properties
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfWithFolderElement.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsCache.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/environment/TmfEnvironmentView.java [deleted file]
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramRequest.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/TmfSynchronizationView.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/rawviewer/TmfRawEventViewer.java
org.eclipse.linuxtools.tmf/feature.xml
org.eclipse.linuxtools.tmf/pom.xml
org.eclipse.linuxtools.tracing.rcp.ui/.settings/org.eclipse.pde.api.tools.prefs
pom.xml

index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 2293b09131d051924d79cf95fbacdb37cfc9fb3b..e478054115fe47be72bb1f0a90294113878e62c2 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.ctf.core.tests;singleton:=true
 Bundle-Activator: org.eclipse.linuxtools.ctf.core.tests.CtfCoreTestPlugin
@@ -10,7 +10,7 @@ Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.linuxtools.ctf.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.ctf.core.tests;x-friends:="org.eclipse.linuxtools.lttng.alltests",
  org.eclipse.linuxtools.ctf.core.tests.event;x-internal:=true,
  org.eclipse.linuxtools.ctf.core.tests.headless;x-internal:=true,
index a157bce99584f6b57a5f4746d68df5e8a9c5f09d..ee5be12c7dd80e8fd1fe66d8e8d2cbf60475b6bf 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <name>Linux Tools CTF Core Tests Plug-in</name>
   <groupId>org.eclipse.linuxtools.ctf</groupId>
   <artifactId>org.eclipse.linuxtools.ctf.core.tests</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
  <build>
index 1f8f14f99d72fb0bbb33ca8bcfad557990c5d267..9128c73cefd04055a58f63d8bda7833ac39ce3d5 100644 (file)
@@ -30,7 +30,9 @@ public abstract class CtfTestTraces {
     private static final String[] testTracePaths = {
         "../org.eclipse.linuxtools.ctf.core.tests/traces/kernel",
         "../org.eclipse.linuxtools.ctf.core.tests/traces/trace2",
-        "../org.eclipse.linuxtools.ctf.core.tests/traces/kernel_vm"
+        "../org.eclipse.linuxtools.ctf.core.tests/traces/kernel_vm",
+        "../org.eclipse.linuxtools.ctf.core.tests/traces/synctraces/scp_src",
+        "../org.eclipse.linuxtools.ctf.core.tests/traces/synctraces/scp_dest"
     };
 
     private static CTFTrace[] testTraces = new CTFTrace[testTracePaths.length];
index c361ec26481ee7c80085d175d5efd0d61979f056..2d11615d42b86cabec93db18afaea404e1b8df64 100644 (file)
@@ -15,8 +15,8 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
 
-import java.util.List;
 import java.util.Random;
+import java.util.TreeSet;
 
 import org.eclipse.linuxtools.ctf.core.event.CTFCallsite;
 import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
@@ -93,7 +93,7 @@ public class CTFTraceCallsitePerformanceTest {
     }
 
     private long testMain() {
-        List<CTFCallsite> l = fTrace.getCallsiteCandidates(callsites[0]);
+        TreeSet<CTFCallsite> l = fTrace.getCallsiteCandidates(callsites[0]);
         CTFCallsite cs = fTrace.getCallsite(1);
         CTFCallsite cs1 = fTrace.getCallsite(callsites[0]);
         CTFCallsite cs2 = fTrace.getCallsite(callsites[0], 1);
index 6d946000049d32739c2cf3f76bf60949455ce6f3..c0a43790c9531b6a6cde41b5a4833bc39c0d2625 100644 (file)
@@ -8,6 +8,7 @@
  * Contributors:
  *     Matthew Khouzam - Initial API and implementation
  *     Marc-Andre Laperle - Test in traces directory recursively
+ *     Simon Delisle - Add test for getCallsite(eventName, ip)
  *******************************************************************************/
 
 package org.eclipse.linuxtools.ctf.core.tests.trace;
@@ -451,4 +452,26 @@ public class CTFTraceTest {
         }
     }
 
+    /**
+     * Test for getCallsite(eventName, ip)
+     */
+    @Test
+    public void callsitePosition(){
+        long ip1 = 2;
+        long ip2 = 5;
+        long ip3 = 7;
+        CTFTrace callsiteTest = CtfTestTraces.getTestTraceFromFile(TRACE_INDEX);
+        callsiteTest.addCallsite("testEvent", null, ip1, null, 23);
+        callsiteTest.addCallsite("testEvent", null, ip2, null, 50);
+        callsiteTest.addCallsite("testEvent", null, ip3, null, 15);
+
+        assertEquals(2, (callsiteTest.getCallsite("testEvent", 1)).getIp());
+        assertEquals(2, (callsiteTest.getCallsite("testEvent", 2)).getIp());
+        assertEquals(5, (callsiteTest.getCallsite("testEvent", 3)).getIp());
+        assertEquals(5, (callsiteTest.getCallsite("testEvent", 5)).getIp());
+        assertEquals(7, (callsiteTest.getCallsite("testEvent", 6)).getIp());
+        assertEquals(7, (callsiteTest.getCallsite("testEvent", 7)).getIp());
+        assertEquals(7, (callsiteTest.getCallsite("testEvent", 8)).getIp());
+    }
+
 }
index 1ce81fda243948b341c6d1787e5641a33e40231d..74db10edcf9ec3cd8855a465e072d1b3e37fe3fe 100644 (file)
@@ -105,4 +105,45 @@ public class IntegerDefinitionTest {
         String result = fixture.toString();
         assertNotNull(result);
     }
+
+    /**
+     * Run the IntegerDefinition formatNumber(Long, int, boolean) method test
+     * for unsigned values.
+     */
+    @Test
+    public void testFormatNumber_unsignedLong() {
+
+        long unsignedLongValue = -64;
+        String result = IntegerDefinition.formatNumber(unsignedLongValue, 10, false);
+        // -64 + 2^64 = 18446744073709551552
+        assertEquals("18446744073709551552", result);
+
+        unsignedLongValue = -131940199973272L;
+        result = IntegerDefinition.formatNumber(unsignedLongValue, 10, false);
+        // -131940199973272l + 2^64 = 18446612133509578344
+        assertEquals("18446612133509578344", result);
+
+        unsignedLongValue = 123456789L;
+        result = IntegerDefinition.formatNumber(unsignedLongValue, 10, false);
+        assertEquals("123456789", result);
+    }
+
+    /**
+     * Run the IntegerDefinition formatNumber(Long, int, boolean) method test
+     * for signed values.
+     */
+    @Test
+    public void testFormatNumber_signedLong() {
+        long signedValue = -64L;
+        String result = IntegerDefinition.formatNumber(signedValue, 10, true);
+        assertEquals("-64", result);
+
+        signedValue = -131940199973272L;
+        result = IntegerDefinition.formatNumber(signedValue, 10, true);
+        assertEquals("-131940199973272", result);
+
+        signedValue = 123456789L;
+        result = IntegerDefinition.formatNumber(signedValue, 10, true);
+        assertEquals("123456789", result);
+    }
 }
index 0d74bee2233cfec6f08a474264db6a2429eee7b8..4194ab3cbe550654719796b76e1376721234de4e 100644 (file)
@@ -3,6 +3,7 @@
 /ctf-testsuite
 /kernel
 /kernel_vm
+/synctraces
 /trace2
 *.ht
 
index 4abdb9512b48d57a1b53e8b4d703cf1c940991f3..71ef35378d0bb4e17bed3068c8b862917dc422e7 100755 (executable)
@@ -24,3 +24,7 @@ wget http://www.dorsal.polymtl.ca/~alexmont/data/kernel_vm.tar.bz2 -O- | tar xvj
 
 # CTF test suite, used for testing CTF parser compliance
 git clone https://github.com/efficios/ctf-testsuite.git
+
+# Trace used by the lttng2 kernel to match packets and synchronize
+wget http://www.dorsal.polymtl.ca/~gbastien/traces/synctraces.tar.gz -O- | tar xvzf - &&
+
index 09d04104c6336ac1e203019cb529bf7df523c2b7..b860ebaa8433199428147924af0b87fca60b9c33 100644 (file)
@@ -14,6 +14,7 @@
   <get ignoreerrors="true" dest="sample-ctf-trace-20120412.tar.bz2" skipexisting="true" src="http://lttng.org/files/samples/sample-ctf-trace-20120412.tar.bz2"/>
   <get ignoreerrors="true" dest="trace2.tar.bz2" skipexisting="true" src="http://www.dorsal.polymtl.ca/~alexmont/data/trace2.tar.bz2"/>
   <get ignoreerrors="true" dest="kernel_vm.tar.bz2" skipexisting="true" src="http://www.dorsal.polymtl.ca/~alexmont/data/kernel_vm.tar.bz2" />
+  <get ignoreerrors="true" dest="synctraces.tar.gz" skipexisting="true" src="http://www.dorsal.polymtl.ca/~gbastien/traces/synctraces.tar.gz" />
   <exec executable = "git" failifexecutionfails="false">
     <arg value = "clone"/>
     <arg value = "https://github.com/efficios/ctf-testsuite.git"/>
@@ -29,6 +30,7 @@
       <available file="sample-ctf-trace-20120412.tar.bz2"/>
       <available file="trace2.tar.bz2"/>
       <available file="kernel_vm.tar.bz2" />
+      <available file="synctraces.tar.gz" />
     </and>
   </condition>
   <antcall target="extractTraces"/>
     <bunzip2 src="sample-ctf-trace-20120412.tar.bz2"/>
     <bunzip2 src="trace2.tar.bz2"/>
     <bunzip2 src="kernel_vm.tar.bz2" />
+       <gunzip src="synctraces.tar.gz" />
     <untar src="sample-ctf-trace-20120412.tar" dest="." />
     <untar src="trace2.tar" dest="." />
     <untar src="kernel_vm.tar" dest="." />
+       <untar src="synctraces.tar" dest="." />
     <echo message="Traces extracted successfully"/>
 </target>
 </project>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index ac876444c0382c469ff67ec9cc8cc5f27cfe379f..0382f319db6948d69f488f7d6af0ccc8ba00470e 100644 (file)
@@ -2,14 +2,14 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.ctf.core;singleton:=true
 Bundle-Activator: org.eclipse.linuxtools.internal.ctf.core.Activator
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.linuxtools.ctf.parser;bundle-version="1.0.0"
+ org.eclipse.linuxtools.ctf.parser;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.ctf.core,
  org.eclipse.linuxtools.ctf.core.event,
  org.eclipse.linuxtools.ctf.core.event.io,
index c6b69ca9fceccdee49dda26f7ad611c4097b896b..f7211f8db8846e5128534afb89c5a878f54dbe09 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <name>Linux Tools CTF Core Plug-in</name>
   <groupId>org.eclipse.linuxtools.ctf</groupId>
   <artifactId>org.eclipse.linuxtools.ctf.core</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
  <build>
index e0718b2c240bb3e6a3c04f9902ce293c1b64c37f..f9680ee107687d3f1e82be00073673a379b91f93 100644 (file)
@@ -12,6 +12,7 @@
 
 package org.eclipse.linuxtools.ctf.core.event.types;
 
+import java.math.BigInteger;
 import java.nio.ByteOrder;
 
 import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
@@ -19,8 +20,8 @@ import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
 /**
  * A CTF integer definition.
  *
- * The definition of a integer basic data type. It will take the data
- * from a trace and store it (and make it fit) as a long.
+ * The definition of a integer basic data type. It will take the data from a
+ * trace and store it (and make it fit) as a long.
  *
  * @version 1.0
  * @author Matthew Khouzam
@@ -41,9 +42,13 @@ public class IntegerDefinition extends SimpleDatatypeDefinition {
 
     /**
      * Constructor
-     * @param declaration the parent declaration
-     * @param definitionScope the parent scope
-     * @param fieldName the field name
+     *
+     * @param declaration
+     *            the parent declaration
+     * @param definitionScope
+     *            the parent scope
+     * @param fieldName
+     *            the field name
      */
     public IntegerDefinition(IntegerDeclaration declaration,
             IDefinitionScope definitionScope, String fieldName) {
@@ -57,6 +62,7 @@ public class IntegerDefinition extends SimpleDatatypeDefinition {
 
     /**
      * Gets the value of the integer
+     *
      * @return the value of the integer (in long)
      */
     public long getValue() {
@@ -65,7 +71,9 @@ public class IntegerDefinition extends SimpleDatatypeDefinition {
 
     /**
      * Sets the value of an integer
-     * @param val the value
+     *
+     * @param val
+     *            the value
      */
     public void setValue(long val) {
         value = val;
@@ -76,8 +84,6 @@ public class IntegerDefinition extends SimpleDatatypeDefinition {
         return declaration;
     }
 
-
-
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
@@ -152,6 +158,54 @@ public class IntegerDefinition extends SimpleDatatypeDefinition {
             char c = (char) value;
             return Character.toString(c);
         }
-        return String.valueOf(value);
+        return formatNumber(value, declaration.getBase(), declaration.isSigned());
+    }
+
+    /**
+     * Print a numeric value as a string in a given base
+     *
+     * @param value
+     *            The value to print as string
+     * @param base
+     *            The base for this value
+     * @param signed
+     *            Is the value signed or not
+     * @return formatted number string
+     * @since 3.0
+     */
+    public static final String formatNumber(long value, int base, boolean signed) {
+        String s;
+        /* Format the number correctly according to the integer's base */
+        switch (base) {
+        case 2:
+            s = "0b" + Long.toBinaryString(value); //$NON-NLS-1$
+            break;
+        case 8:
+            s = "0" + Long.toOctalString(value); //$NON-NLS-1$
+            break;
+        case 16:
+            s = "0x" + Long.toHexString(value); //$NON-NLS-1$
+            break;
+        case 10:
+        default:
+            /* For non-standard base, we'll just print it as a decimal number */
+            if (!signed && value < 0) {
+                /*
+                 * Since there are no 'unsigned long', handle this case with
+                 * BigInteger
+                 */
+                BigInteger bigInteger = BigInteger.valueOf(value);
+                /*
+                 * we add 2^64 to the negative number to get the real unsigned
+                 * value
+                 */
+                bigInteger = bigInteger.add(BigInteger.valueOf(1).shiftLeft(64));
+                s = bigInteger.toString();
+            } else {
+                s = Long.toString(value);
+            }
+            break;
+        }
+        return s;
     }
 }
index 40b367710bbc2d9af996dbc0a883a53bb8dd6b24..925a6845847faef8b23712071fc163e1dea7d280 100644 (file)
@@ -9,6 +9,7 @@
  * Contributors:
  *     Matthew Khouzam - Initial API and implementation
  *     Alexandre Montplaisir - Initial API and implementation
+ *     Simon Delisle - Replace LinkedList by TreeSet in callsitesByName attribute
  *******************************************************************************/
 
 package org.eclipse.linuxtools.ctf.core.trace;
@@ -23,13 +24,11 @@ import java.nio.MappedByteBuffer;
 import java.nio.channels.FileChannel;
 import java.nio.channels.FileChannel.MapMode;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.ListIterator;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -47,6 +46,7 @@ import org.eclipse.linuxtools.ctf.core.event.types.IDefinitionScope;
 import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
+import org.eclipse.linuxtools.internal.ctf.core.event.CTFCallsiteComparator;
 import org.eclipse.linuxtools.internal.ctf.core.event.metadata.exceptions.ParseException;
 import org.eclipse.linuxtools.internal.ctf.core.trace.StreamInputPacketIndex;
 
@@ -143,7 +143,9 @@ public class CTFTrace implements IDefinitionScope {
     private final Map<StreamInput, StreamInputPacketIndex> indexes = new HashMap<StreamInput, StreamInputPacketIndex>();
 
     /** Callsite helpers */
-    private Map<String, LinkedList<CTFCallsite>> callsitesByName = new HashMap<String, LinkedList<CTFCallsite>>();
+    private CTFCallsiteComparator ctfCallsiteComparator = new CTFCallsiteComparator();
+
+    private Map<String, TreeSet<CTFCallsite>> callsitesByName = new HashMap<String, TreeSet<CTFCallsite>>();
 
     /** Callsite helpers */
     private TreeSet<CTFCallsite> callsitesByIP = new TreeSet<CTFCallsite>();
@@ -852,37 +854,29 @@ public class CTFTrace implements IDefinitionScope {
             String fileName, long lineNumber) {
         final CTFCallsite cs = new CTFCallsite(eventName, funcName, ip,
                 fileName, lineNumber);
-        LinkedList<CTFCallsite> csl = callsitesByName.get(eventName);
+        TreeSet<CTFCallsite> csl = callsitesByName.get(eventName);
         if (csl == null) {
-            csl = new LinkedList<CTFCallsite>();
+            csl = new TreeSet<CTFCallsite>(ctfCallsiteComparator);
             callsitesByName.put(eventName, csl);
         }
 
-        ListIterator<CTFCallsite> iter = csl.listIterator();
-        int index = 0;
-        for (; index < csl.size(); index++) {
-            if (iter.next().compareTo(cs) < 0) {
-                break;
-            }
-        }
-
-        csl.add(index, cs);
+        csl.add(cs);
 
         callsitesByIP.add(cs);
     }
 
     /**
-     * Gets the list of callsites associated to an event name. O(1)
+     * Gets the set of callsites associated to an event name. O(1)
      *
      * @param eventName
      *            the event name
-     * @return the callsite list can be empty
-     * @since 1.2
+     * @return the callsite set can be empty
+     * @since 3.0
      */
-    public List<CTFCallsite> getCallsiteCandidates(String eventName) {
-        LinkedList<CTFCallsite> retVal = callsitesByName.get(eventName);
+    public TreeSet<CTFCallsite> getCallsiteCandidates(String eventName) {
+        TreeSet<CTFCallsite> retVal = callsitesByName.get(eventName);
         if (retVal == null) {
-            retVal = new LinkedList<CTFCallsite>();
+            retVal = new TreeSet<CTFCallsite>(ctfCallsiteComparator);
         }
         return retVal;
     }
@@ -896,9 +890,9 @@ public class CTFTrace implements IDefinitionScope {
      * @since 1.2
      */
     public CTFCallsite getCallsite(String eventName) {
-        LinkedList<CTFCallsite> callsites = callsitesByName.get(eventName);
+        TreeSet<CTFCallsite> callsites = callsitesByName.get(eventName);
         if (callsites != null) {
-            return callsites.getFirst();
+            return callsites.first();
         }
         return null;
     }
@@ -927,15 +921,14 @@ public class CTFTrace implements IDefinitionScope {
      * @return the closest matching callsite, can be null
      */
     public CTFCallsite getCallsite(String eventName, long ip) {
-        final LinkedList<CTFCallsite> candidates = callsitesByName.get(eventName);
+        final TreeSet<CTFCallsite> candidates = callsitesByName.get(eventName);
         final CTFCallsite dummyCs = new CTFCallsite(null, null, ip, null, -1);
-        final int pos = Collections.binarySearch(candidates, dummyCs) + 1;
-        if (pos >= candidates.size()) {
-            return null;
+        final CTFCallsite callsite = candidates.ceiling(dummyCs);
+        if (callsite == null) {
+            return candidates.floor(dummyCs);
         }
-        return candidates.get(pos);
+        return callsite;
     }
-
 }
 
 class MetadataFileFilter implements FileFilter {
diff --git a/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/CTFCallsiteComparator.java b/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/CTFCallsiteComparator.java
new file mode 100644 (file)
index 0000000..ab36f0a
--- /dev/null
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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:
+ *  Simon Delisle - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.ctf.core.event;
+
+import java.util.Comparator;
+
+import org.eclipse.linuxtools.ctf.core.event.CTFCallsite;
+
+/**
+ * Comparator for CTFCallsite
+ *
+ * @author Simon Delisle
+ * @since 3.0
+ *
+ */
+public class CTFCallsiteComparator implements Comparator<CTFCallsite> {
+
+    private static final long MASK32 = 0x00000000ffffffffL;
+
+    /*
+     * The callsites will be sorted by calling addresses. To do this we take IPs
+     * (instruction pointers) and compare them. Java only supports signed
+     * operation and since memory addresses are unsigned, we will convert the
+     * longs into integers that contain the high and low bytes and compare them.
+     */
+    @Override
+    public int compare(CTFCallsite o1, CTFCallsite o2) {
+        /*
+         * mask32 is 32 zeros followed by 32 ones, when we bitwise and this it
+         * will return the lower 32 bits
+         */
+
+        long other = o2.getIp();
+        /*
+         * To get a high int: we downshift by 32 and bitwise and with the mask
+         * to get rid of the sign
+         *
+         * To get the low int: we bitwise and with the mask.
+         */
+        long otherHigh = (other >> 32) & MASK32;
+        long otherLow = other & MASK32;
+        long ownHigh = (o1.getIp() >> 32) & MASK32;
+        long ownLow = o1.getIp() & MASK32;
+        /* are the high values different, if so ignore the lower values */
+        if (ownHigh > otherHigh) {
+            return 1;
+        }
+        if (ownHigh < otherHigh ) {
+            return -1;
+        }
+        /* the high values are the same, compare the lower values */
+        if (ownLow > otherLow) {
+            return 1;
+        }
+        if (ownLow < otherLow) {
+            return -1;
+        }
+        /* the values are identical */
+        return 0;
+    }
+
+}
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 4042466e17f375b13d4c22010a46a5685c12658b..009ef089e08660243aeb18337c1bf45bcda22bac 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.ctf.parser
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
index 543c0b15268d57a262e25ac94419a5d8b310b941..1979902ed50727bada481e22b64527f0b6ae76f3 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <name>Linux Tools CTF Parser Plug-in</name>
   <groupId>org.eclipse.linuxtools.ctf</groupId>
   <artifactId>org.eclipse.linuxtools.ctf.parser</artifactId>
-  <version>1.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <build>
index 32689464d2f25548b929d0c3de43dc1f09cc4be6..5f5179678a9f5b201ef0bbfaeadda5daf505c6cf 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="org.eclipse.linuxtools.ctf"
       label="%featureName"
-      version="2.1.0.qualifier"
+      version="3.0.0.qualifier"
       provider-name="%featureProvider"
       license-feature="org.eclipse.linuxtools.license.feature"
       license-feature-version="1.0.0.qualifier">
index 3b74f7bdb33d1a3fdb8514619a90fbfac2aebd62..be0086185b20e3334c489a83a397371c3e1ca4b8 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <name>Linux Tools CTF (Common Trace Format) Feature</name>
   <artifactId>org.eclipse.linuxtools.ctf</artifactId>
   <groupId>org.eclipse.linuxtools.ctf</groupId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
 
   <packaging>eclipse-feature</packaging>
 
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 887aadcf0831bb9802cc2f89bbc78125dd8ed337..1fb7a378d5e8701ec7e35ad4b38dcd7cc65d83bd 100644 (file)
@@ -2,12 +2,12 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.gdbtrace.core.tests;singleton:=true
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.core.runtime,
- org.eclipse.linuxtools.gdbtrace.core;bundle-version="1.1.0"
+ org.eclipse.linuxtools.gdbtrace.core;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.gdbtrace.core.tests
index 58ce913b03632ba572824806639415294767d37f..6962305ec33ec2771dfa308dcb0c40219fea5045 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.gdbtrace.core.tests</artifactId>
   <groupId>org.eclipse.linuxtools.gdbtrace</groupId>
-  <version>1.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
   <name>Linux Tools GDB Tracepoint Analysis Core Tests Plug-in</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 4a89fd1cdf5660d87611c82f8fdb79b6cc3240e4..8786d48a66c9e61c65016c07f311bd39688033e3 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-SymbolicName: org.eclipse.linuxtools.gdbtrace.core;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-Activator: org.eclipse.linuxtools.internal.gdbtrace.core.GdbTraceCorePlugin
 Require-Bundle: org.eclipse.core.runtime,
@@ -10,8 +10,8 @@ Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.ui.ide,
  org.eclipse.debug.core,
  org.eclipse.debug.ui,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.ui;bundle-version="2.1.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-Vendor: %Bundle-Vendor
index c9c918f0f8809c3af21db85205f567723c3370d1..175b3a5973c526cd5d684ee86151182bc0633d63 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.gdbtrace.core</artifactId>
   <groupId>org.eclipse.linuxtools.gdbtrace</groupId>
-  <version>1.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools GDB Tracepoint Analysis Core Plug-in</name>
index 9f49f3b68d082e6dcceb86ad58588cad311beea1..431930c33ddd8cf632d796a6c843fcfc4cb5a531 100644 (file)
@@ -31,10 +31,10 @@ import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
 
 /**
  * GDB Tracepoint extension of TmfTrace. This class implements the necessary
index de1dfe05914d49fb0bd77df8a45a3bdc89038bda..8b29ff494b495aaa8478abd813136cfbc14c9329 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.gdbtrace.help;singleton:=true
 Require-Bundle: org.eclipse.help
index e6b1a956fa695f8059409f0009d2cdf43a216fc0..33c2c691a7dd5db7a315f31b323f9fa3ca0c9276 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.gdbtrace.help</artifactId>
-  <version>1.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools GDB Tracepoint Analysis Help Plug-in</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index e96aa718c7576a37079b3c49c6bc8d6d8a8e5858..8e729ea5f94f7edc59317410d12f5260c1064d47 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.gdbtrace.ui.tests;singleton:=true
 Bundle-ActivationPolicy: lazy
@@ -10,5 +10,5 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.core.runtime,
  org.eclipse.ui,
- org.eclipse.linuxtools.gdbtrace.ui;bundle-version="1.1.0"
+ org.eclipse.linuxtools.gdbtrace.ui;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.gdbtrace.ui.tests
index 5da006ece2f787ea2fe2185d0f133d7ad1801730..18e399e3d57d5b7fa8bc56fc83f56ffec38614c8 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.gdbtrace.ui.tests</artifactId>
   <groupId>org.eclipse.linuxtools.gdbtrace</groupId>
-  <version>1.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
   <name>Linux Tools GDB Tracepoint Analysis UI Tests Plug-in</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index f506ce32eed0b169964fa194d64783eb20792564..980bae69d4f22e6a843dcc93dcb5db4558dd28b5 100644 (file)
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
 Bundle-SymbolicName: org.eclipse.linuxtools.gdbtrace.ui;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-Activator: org.eclipse.linuxtools.internal.gdbtrace.ui.GdbTraceUIPlugin
 Require-Bundle: org.eclipse.core.runtime,
@@ -12,9 +12,9 @@ Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.ui.console,
  org.eclipse.ui.ide,
  org.eclipse.debug.ui,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.ui;bundle-version="2.1.0",
- org.eclipse.linuxtools.gdbtrace.core;bundle-version="1.1.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0",
+ org.eclipse.linuxtools.gdbtrace.core;bundle-version="3.0.0"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Export-Package: org.eclipse.linuxtools.internal.gdbtrace.ui;x-friends:="org.eclipse.linuxtools.gdbtrace.ui.tests",
index 054d3a444228325d2a06716fb6c78c5ffa7b826f..042281dea32de288b9a8dff97f1761269f671fb4 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.gdbtrace.ui</artifactId>
   <groupId>org.eclipse.linuxtools.gdbtrace</groupId>
-  <version>1.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools GDB Tracepoint Analysis UI Plug-in</name>
index 00a26a1229c6a8f7e7970ccbe0c4170b01975670..58338f28c2d774f0e7cda6849867b9a91d44dfb2 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="org.eclipse.linuxtools.gdbtrace"
       label="%featureName"
-      version="1.1.0.qualifier"
+      version="3.0.0.qualifier"
       provider-name="%featureProvider"
       license-feature="org.eclipse.linuxtools.license.feature"
       license-feature-version="1.0.0.qualifier">
@@ -37,9 +37,9 @@
       <import plugin="org.eclipse.cdt.dsf"/>
       <import plugin="org.eclipse.cdt.dsf.gdb"/>
       <import plugin="org.eclipse.cdt.dsf.gdb.ui"/>
-      <import plugin="org.eclipse.linuxtools.tmf.core" version="2.1.0" match="greaterOrEqual"/>
-      <import plugin="org.eclipse.linuxtools.tmf.ui" version="2.1.0" match="greaterOrEqual"/>
-      <import plugin="org.eclipse.linuxtools.gdbtrace.core" version="1.1.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.tmf.core" version="3.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.tmf.ui" version="3.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.gdbtrace.core" version="3.0.0" match="greaterOrEqual"/>
    </requires>
 
    <plugin
index dbb5b3ddbedbd137b1922e48908b3f29ec04dab5..245f7f9b3744a1d5d97ccdd841d56125b57c8671 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.gdbtrace</artifactId>
   <groupId>org.eclipse.linuxtools.gdbtrace</groupId>
-  <version>1.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-feature</packaging>
 
   <name>Linux Tools GDB Tracepoint Analysis Feature</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 4503273437addc39a22674b07bfd12dfb3ba2d03..f100be9a3f41291085bc2a70fd983ee64d5d672e 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng.help; singleton:=true
 Require-Bundle: org.eclipse.help
index 938fe12baf03ecf6713a97701f0cec73f03a1df5..69e58ce55a2e4967ea7752f1f28611fce630b189 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng.help</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools LTTng Help Plug-in</name>
index bbe60bdb4380016d7c23062b45eb849407521750..395da01b6eb174cb8165f564a87d231bd20952f6 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng.releng-site</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <name>Linux Tools LTTng Repository</name>
   <packaging>eclipse-repository</packaging>
 
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index b3e1a629af43251c967b4227d913d2ae78a9aaf1..d81c7b2860e557639287080b469956b4631e63b1 100644 (file)
@@ -2,13 +2,13 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.core.tests;singleton:=true
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.core.runtime,
- org.eclipse.linuxtools.lttng2.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.lttng2.core;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.lttng2.core.tests;x-friends:="org.eclipse.linuxtools.lttng.alltests",
  org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;x-internal:=true
index 10eb62c38eda5680f2c7660063b48f357ecc2c55..5ec28d9d9b75a08e3c0e303f7ed0e69fb020080a 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.core.tests</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
   <name>Linux Tools LTTng Core Tests Plug-in</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 4d05ddc7b5a106c0fdbbf2c736cfbc31bdd87343..fdf605147985cdaed3ceeb0992aecb041f730315 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.core;singleton:=true
 Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.core.Activator
index bd12565f4fdaf586fe82823b935d47a7a38f54ce..48e03a6f7860895702772cd19c4a00790e056994 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.core</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools LTTng Core Plug-in</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 98651c1fc1456f68d63543d6406f4558d2ee1973..83dd1378d5eeb0bf8cddd8fe0f807f34222df693 100644 (file)
@@ -2,16 +2,18 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.kernel.core.tests;singleton:=true
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.core.runtime,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.core.tests;bundle-version="2.1.0",
- org.eclipse.linuxtools.lttng2.kernel.core;bundle-version="2.1.0"
-Export-Package: org.eclipse.linuxtools.lttng2.kernel.core.tests;x-friends:="org.eclipse.linuxtools.lttng.alltests",
- org.eclipse.linuxtools.lttng2.kernel.core.tests.headless;x-internal:=true,
- org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider;x-internal:=true
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core.tests;bundle-version="3.0.0",
+ org.eclipse.linuxtools.lttng2.kernel.core;bundle-version="3.0.0",
+ org.eclipse.core.resources
+Export-Package: org.eclipse.linuxtools.lttng2.kernel.core.tests,
+ org.eclipse.linuxtools.lttng2.kernel.core.tests.event.matchandsync,
+ org.eclipse.linuxtools.lttng2.kernel.core.tests.headless,
+ org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider
index 44b66ca7a00fada2ae1ba878ac86eb82a284ec81..535c9a68c094a6c26c024f824b672d315c0049fb 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.kernel.core.tests</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
   <name>Linux Tools LTTng Kernel Analysis Core Tests Plug-in</name>
index 682e4000bce198a8d1939d99000fdf25822fa1c7..e6f3cb60bdb1795fdbd02fc89046b3f3faf37c38 100644 (file)
@@ -21,6 +21,7 @@ import org.junit.runners.Suite;
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
     ActivatorTest.class,
-    org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider.TestAll.class
+    org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider.TestAll.class,
+    org.eclipse.linuxtools.lttng2.kernel.core.tests.event.matchandsync.AllTests.class
 })
 public class AllTests { }
diff --git a/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/AllTests.java b/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/AllTests.java
new file mode 100644 (file)
index 0000000..9a37836
--- /dev/null
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng2.kernel.core.tests.event.matchandsync;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for org.eclipse.linuxtools.lttng2.kernel.core.tests.event.matching
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    MatchAndSyncTest.class,
+    ExperimentSyncTest.class
+})
+public class AllTests {
+
+}
diff --git a/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/ExperimentSyncTest.java b/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/ExperimentSyncTest.java
new file mode 100644 (file)
index 0000000..6267b03
--- /dev/null
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng2.kernel.core.tests.event.matchandsync;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpEventMatching;
+import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpLttngEventMatching;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.synchronization.ITmfTimestampTransform;
+import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationAlgorithm;
+import org.eclipse.linuxtools.tmf.core.synchronization.TmfTimestampTransform;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for experiment syncing
+ *
+ * @author Geneviève Bastien
+ */
+@SuppressWarnings("nls")
+public class ExperimentSyncTest {
+
+    private static final String EXPERIMENT   = "MyExperiment";
+    private static int          BLOCK_SIZE   = 1000;
+
+    private static ITmfTrace[] fTraces;
+    private static TmfExperiment fExperiment;
+
+    /**
+     * Setup the traces and experiment
+     */
+    @Before
+    public void setUp() {
+        CtfTmfTrace trace1 = CtfTmfTestTraces.getTestTrace(3);
+        CtfTmfTrace trace2 = CtfTmfTestTraces.getTestTrace(4);
+
+        fTraces = new CtfTmfTrace[2];
+        fTraces[0] = trace1;
+        fTraces[1] = trace2;
+
+        fExperiment = new TmfExperiment(trace1.getEventType(), EXPERIMENT, fTraces, BLOCK_SIZE);
+
+        TmfEventMatching.registerMatchObject(new TcpEventMatching());
+        TmfEventMatching.registerMatchObject(new TcpLttngEventMatching());
+    }
+
+    /**
+     * Reset the timestamp transforms on the traces
+     */
+    @After
+    public void cleanUp() {
+        fTraces[0].setTimestampTransform(TmfTimestampTransform.IDENTITY);
+        fTraces[1].setTimestampTransform(TmfTimestampTransform.IDENTITY);
+    }
+
+    /**
+     * Testing experiment synchronization
+     */
+    @Test
+    public void testExperimentSync() {
+        try {
+            SynchronizationAlgorithm syncAlgo = fExperiment.synchronizeTraces(true);
+
+            ITmfTimestampTransform tt1, tt2;
+
+            tt1 = syncAlgo.getTimestampTransform(fTraces[0]);
+            tt2 = syncAlgo.getTimestampTransform(fTraces[1]);
+
+            fTraces[0].setTimestampTransform(tt1);
+            fTraces[1].setTimestampTransform(tt2);
+
+            assertEquals("TmfTimestampTransform [ IDENTITY ]", tt2.toString());
+            assertEquals("TmfTimestampLinear [ alpha = 0.9999413783703139011056845831168394, beta = 79796507913179.33347660124688298171 ]", tt1.toString());
+
+            assertEquals(syncAlgo.getTimestampTransform(fTraces[0].getName()),fTraces[0].getTimestampTransform());
+            assertEquals(syncAlgo.getTimestampTransform(fTraces[1].getName()),fTraces[1].getTimestampTransform());
+
+        } catch (TmfTraceException e) {
+            fail("Exception thrown in experiment synchronization " + e.getMessage());
+        }
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/MatchAndSyncTest.java b/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/MatchAndSyncTest.java
new file mode 100644 (file)
index 0000000..b036336
--- /dev/null
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng2.kernel.core.tests.event.matchandsync;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpEventMatching;
+import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpLttngEventMatching;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfNetworkEventMatching;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.junit.Test;
+
+/**
+ * Tests for {@link TcpEventMatching}
+ *
+ * @author Geneviève Bastien
+ */
+@SuppressWarnings("nls")
+public class MatchAndSyncTest {
+
+    /**
+     * Testing the packet matching
+     */
+    @Test
+    public void testMatching() {
+        final String cr = System.getProperty("line.separator");
+        CtfTmfTrace trace1 = CtfTmfTestTraces.getTestTrace(3);
+        CtfTmfTrace trace2 = CtfTmfTestTraces.getTestTrace(4);
+
+        CtfTmfTrace[] tracearr = new CtfTmfTrace[2];
+        tracearr[0] = trace1;
+        tracearr[1] = trace2;
+
+        TmfEventMatching.registerMatchObject(new TcpEventMatching());
+        TmfEventMatching.registerMatchObject(new TcpLttngEventMatching());
+
+        TmfNetworkEventMatching twoTraceMatch = new TmfNetworkEventMatching(tracearr);
+        assertTrue(twoTraceMatch.matchEvents());
+
+        String stats = twoTraceMatch.toString();
+        assertEquals("TmfEventMatches [ Number of matches found: 46 ]" +
+                "Trace 0:" + cr +
+                "  3 unmatched incoming events" + cr +
+                "  2 unmatched outgoing events" + cr +
+                "Trace 1:" + cr +
+                "  2 unmatched incoming events" + cr +
+                "  1 unmatched outgoing events" + cr, stats);
+    }
+
+}
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 6e374ae669f2392c6e81ea528dba74788a5bb6d6..2ba6f2e26e00df7eedc5fe9a02fa431fb86e42d2 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.kernel.core;singleton:=true
 Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.kernel.core.Activator
@@ -10,8 +10,9 @@ Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.core.resources,
- org.eclipse.linuxtools.ctf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.internal.lttng2.kernel.core;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui,org.eclipse.linuxtools.lttng2.kernel.core.tests",
  org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider;x-friends:="org.eclipse.linuxtools.lttng2.kernel.core.tests",
- org.eclipse.linuxtools.lttng2.kernel.core.trace
+ org.eclipse.linuxtools.lttng2.kernel.core.trace,
+ org.eclipse.linuxtools.lttng2.kernel.core.event.matching
index 756792cd4e5b67114e24efbed8438452e4f6b78f..b6476317aed274b4b10f5baf474e49eb627e80a9 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.kernel.core</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools LTTng Kernel Analysis Core Plug-in</name>
index d0270fdc245263b233723d2986c17edc52cbc233..8629784bc45043ed70a24186b3bba39728260da9 100644 (file)
@@ -15,6 +15,9 @@ package org.eclipse.linuxtools.internal.lttng2.kernel.core;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Plugin;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpEventMatching;
+import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpLttngEventMatching;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching;
 import org.osgi.framework.BundleContext;
 
 /**
@@ -69,6 +72,8 @@ public class Activator extends Plugin {
     public void start(BundleContext context) throws Exception {
         super.start(context);
         plugin = this;
+        TmfEventMatching.registerMatchObject(new TcpEventMatching());
+        TmfEventMatching.registerMatchObject(new TcpLttngEventMatching());
     }
 
     @Override
diff --git a/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/TcpEventStrings.java b/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/TcpEventStrings.java
new file mode 100644 (file)
index 0000000..2891210
--- /dev/null
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng2.kernel.core;
+
+/**
+ * This file defines all the known event and field names used to trace socket
+ * connection for both the addons module method (
+ * {@link org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpEventMatching}
+ * ) and the net_data_experimental branch (
+ * {@link org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpLttngEventMatching}
+ * ).
+ *
+ * These events should be eventually mainlined and when this happens, this class
+ * won't be necessary anymore and they should be moved to {@link LttngStrings}
+ * class
+ *
+ *
+ * @author Geneviève Bastien
+ */
+@SuppressWarnings({ "javadoc", "nls" })
+public interface TcpEventStrings {
+
+    /* Event names */
+    public static final String INET_CONNECT = "inet_connect";
+    public static final String INET_SOCK_CREATE = "inet_sock_create";
+    public static final String INET_SOCK_LOCAL_OUT = "inet_sock_local_out";
+    public static final String INET_SOCK_LOCAL_IN = "inet_sock_local_in";
+    public static final String INET_SOCK_CLONE = "inet_sock_clone";
+    public static final String INET_ACCEPT = "inet_accept";
+    public static final String INET_SOCK_DELETE = "inet_sock_delete";
+    public static final String NETIF_RECEIVE_SKB = "netif_receive_skb";
+    public static final String NET_DEV_QUEUE = "net_dev_queue";
+
+    /* Field names */
+    public static final String SEQ = "seq";
+    public static final String SK = "sk";
+    public static final String OSK = "osk";
+    public static final String NSK = "nsk";
+    public static final String SPORT = "sport";
+    public static final String DPORT = "dport";
+    public static final String SADDR = "saddr";
+    public static final String DADDR = "daddr";
+    public static final String ACKSEQ = "ack_seq";
+    public static final String CHECK = "check";
+    public static final String WINDOW = "window";
+    public static final String FLAGS = "flags";
+    public static final String TRANSPORT_FIELDS = "transport_fields";
+    public static final String TYPE_TCP = "thtype_tcp";
+
+}
diff --git a/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpEventMatching.java b/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpEventMatching.java
new file mode 100644 (file)
index 0000000..7f9952a
--- /dev/null
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng2.kernel.core.event.matching;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.TcpEventStrings;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching.MatchingType;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfNetworkEventMatching.Direction;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfNetworkMatchDefinition;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * Class to match tcp type events. This matching class applies to traces
+ * obtained with the 'addons' lttng module. This module can be obtained with
+ * lttng-modules to generate traces at
+ * https://github.com/giraldeau/lttng-modules/tree/addons
+ *
+ * Note: this module only allows to generate traces to be read and analyzed by
+ * TMF, no code from this module is being used here
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public class TcpEventMatching extends TmfNetworkMatchDefinition {
+
+    @Override
+    public Direction getDirection(ITmfEvent event) {
+        String evname = event.getType().getName();
+        /* Is the event a tcp socket in or out event */
+        if (evname.equals(TcpEventStrings.INET_SOCK_LOCAL_IN)) {
+            return Direction.IN;
+        } else if (evname.equals(TcpEventStrings.INET_SOCK_LOCAL_OUT)) {
+            return Direction.OUT;
+        }
+        return null;
+    }
+
+    /**
+     * The key to uniquely identify a TCP packet depends on many fields. This
+     * method computes the key for a given event.
+     *
+     * @param event
+     *            The event for which to compute the key
+     * @return the unique key for this event
+     */
+    @Override
+    public List<Object> getUniqueField(ITmfEvent event) {
+        List<Object> keys = new ArrayList<Object>();
+
+        keys.add(event.getContent().getField(TcpEventStrings.SEQ).getValue());
+        keys.add(event.getContent().getField(TcpEventStrings.ACKSEQ).getValue());
+        keys.add(event.getContent().getField(TcpEventStrings.FLAGS).getValue());
+
+        return keys;
+    }
+
+    @Override
+    public boolean canMatchTrace(ITmfTrace trace) {
+        if (!(trace instanceof CtfTmfTrace)) {
+            return false;
+        }
+        CtfTmfTrace ktrace = (CtfTmfTrace) trace;
+        String[] events = { TcpEventStrings.INET_SOCK_LOCAL_IN, TcpEventStrings.INET_SOCK_LOCAL_OUT };
+        return ktrace.hasAtLeastOneOfEvents(events);
+    }
+
+    @Override
+    public MatchingType[] getApplicableMatchingTypes() {
+        MatchingType[] types = { MatchingType.NETWORK };
+        return types;
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpLttngEventMatching.java b/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpLttngEventMatching.java
new file mode 100644 (file)
index 0000000..ca9d95b
--- /dev/null
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng2.kernel.core.event.matching;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.TcpEventStrings;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching.MatchingType;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfNetworkEventMatching.Direction;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfNetworkMatchDefinition;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * Class to match tcp type events. This class applies to traces obtained with
+ * the full network tracepoint data available from an experimental branch of
+ * lttng-modules. This branch is often rebased on lttng-modules master and is
+ * available at
+ * http://git.dorsal.polymtl.ca/~gbastien?p=lttng-modules.git;a=summary
+ * net_data_experimental branch.
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public class TcpLttngEventMatching extends TmfNetworkMatchDefinition {
+
+    private static final String[] key_seq = { TcpEventStrings.TRANSPORT_FIELDS, TcpEventStrings.TYPE_TCP, TcpEventStrings.SEQ };
+    private static final String[] key_ackseq = { TcpEventStrings.TRANSPORT_FIELDS, TcpEventStrings.TYPE_TCP, TcpEventStrings.ACKSEQ };
+    private static final String[] key_flags = { TcpEventStrings.TRANSPORT_FIELDS, TcpEventStrings.TYPE_TCP, TcpEventStrings.FLAGS };
+
+    private static boolean canMatchPacket(final ITmfEvent event) {
+        TmfEventField field = (TmfEventField) event.getContent();
+
+        String[] tcp_data = { TcpEventStrings.TRANSPORT_FIELDS, TcpEventStrings.TYPE_TCP };
+        ITmfEventField data = field.getSubField(tcp_data);
+        if (data != null) {
+            return (data.getValue() != null);
+        }
+        return false;
+    }
+
+    /**
+     * The key to uniquely identify a TCP packet depends on many fields. This
+     * method computes the key for a given event.
+     *
+     * @param event
+     *            The event for which to compute the key
+     * @return the unique key for this event
+     */
+    @Override
+    public List<Object> getUniqueField(ITmfEvent event) {
+        List<Object> keys = new ArrayList<Object>();
+
+        TmfEventField field = (TmfEventField) event.getContent();
+        ITmfEventField data;
+
+        data = field.getSubField(key_seq);
+        if (data != null) {
+            keys.add(data.getValue());
+        }
+        data = field.getSubField(key_ackseq);
+        if (data != null) {
+            keys.add(data.getValue());
+        }
+        data = field.getSubField(key_flags);
+        if (data != null) {
+            keys.add(data.getValue());
+        }
+
+        return keys;
+    }
+
+    @Override
+    public boolean canMatchTrace(ITmfTrace trace) {
+        if (!(trace instanceof CtfTmfTrace)) {
+            return false;
+        }
+        CtfTmfTrace ktrace = (CtfTmfTrace) trace;
+        String[] events = { TcpEventStrings.NET_DEV_QUEUE, TcpEventStrings.NETIF_RECEIVE_SKB };
+        return (ktrace.hasAtLeastOneOfEvents(events));
+    }
+
+    @Override
+    public Direction getDirection(ITmfEvent event) {
+        String evname = event.getType().getName();
+
+        /* Is the event a tcp socket in or out event */
+        if (evname.equals(TcpEventStrings.NETIF_RECEIVE_SKB) && canMatchPacket(event)) {
+            return Direction.IN;
+        } else if (evname.equals(TcpEventStrings.NET_DEV_QUEUE) && canMatchPacket(event)) {
+            return Direction.OUT;
+        }
+        return null;
+    }
+
+    @Override
+    public MatchingType[] getApplicableMatchingTypes() {
+        MatchingType[] types = { MatchingType.NETWORK };
+        return types;
+    }
+
+}
index c9d658179197d627e68fc6ee9991ba10d9eaf258..6ea09e1cbb6e376b56fb531cdd05394f769aec15 100644 (file)
@@ -91,8 +91,11 @@ public class LttngKernelTrace extends CtfTmfTrace {
         return validStatus;
     }
 
+    /**
+     * @since 3.0
+     */
     @Override
-    protected void buildStateSystem() throws TmfTraceException {
+    protected IStatus buildStateSystem() {
         super.buildStateSystem();
 
         /* Build the state system specific to LTTng kernel traces */
@@ -100,8 +103,13 @@ public class LttngKernelTrace extends CtfTmfTrace {
         final File htFile = new File(directory + HISTORY_TREE_FILE_NAME);
         final ITmfStateProvider htInput = new LttngKernelStateProvider(this);
 
-        ITmfStateSystem ss = TmfStateSystemFactory.newFullHistory(htFile, htInput, false);
-        fStateSystems.put(STATE_ID, ss);
+        try {
+            ITmfStateSystem ss = TmfStateSystemFactory.newFullHistory(htFile, htInput, false);
+            fStateSystems.put(STATE_ID, ss);
+        } catch (TmfTraceException e) {
+            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
+        }
+        return Status.OK_STATUS;
     }
 
 }
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index ff453f810ed2eb56980df1a4221f5c34b5134659..e917574461bf3410e714d6d381fba819744c836f 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.kernel.ui.tests;singleton:=true
 Bundle-ActivationPolicy: lazy
@@ -10,5 +10,5 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.core.runtime,
  org.eclipse.ui,
- org.eclipse.linuxtools.lttng2.kernel.ui;bundle-version="2.1.0"
+ org.eclipse.linuxtools.lttng2.kernel.ui;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.lttng2.kernel.ui.tests
index be685d428e249a5b5f54dc4a1243f494dfd9662c..080c2987813a3cbdd370e4acffd5a90ec720812c 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.kernel.ui.tests</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
   <name>Linux Tools LTTng Kernel Analysis UI Tests Plug-in</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 6f157d89f88e3effcaf7f3bed09d2842826a85a2..aa69287ab20f25a32d3ead92007d83373e9f18c6 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.kernel.ui;singleton:=true
 Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.kernel.ui.Activator
@@ -12,11 +12,11 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.ui.ide,
  org.eclipse.core.resources,
  org.eclipse.core.runtime,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.ui;bundle-version="2.1.0",
- org.eclipse.linuxtools.lttng2.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.lttng2.ui;bundle-version="2.1.0",
- org.eclipse.linuxtools.lttng2.kernel.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0",
+ org.eclipse.linuxtools.lttng2.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.lttng2.ui;bundle-version="3.0.0",
+ org.eclipse.linuxtools.lttng2.kernel.core;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.internal.lttng2.kernel.ui;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui.tests",
  org.eclipse.linuxtools.internal.lttng2.kernel.ui.viewers.events;x-internal:=true,
  org.eclipse.linuxtools.internal.lttng2.kernel.ui.views;x-internal:=true,
index f304b81b4ddcf1b5f47da82fb7ec0f700e8d8423..5ac6b5bb8c87c53372d6f29116761e9f587d4a13 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.kernel.ui</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools LTTng Kernel Analysis UI Plug-in</name>
index 4190e61b58b34b7d12d8a700f17e60b84a30b678..eaeedba471822d11d4188620b49c724a4acd3f7f 100644 (file)
@@ -3,7 +3,7 @@
 <feature
       id="org.eclipse.linuxtools.lttng2.kernel"
       label="%featureName"
-      version="2.1.0.qualifier"
+      version="3.0.0.qualifier"
       provider-name="%featureProvider"
       license-feature="org.eclipse.linuxtools.license.feature"
       license-feature-version="1.0.0.qualifier">
    <requires>
       <import plugin="org.eclipse.core.runtime"/>
       <import plugin="org.eclipse.core.resources"/>
-      <import plugin="org.eclipse.linuxtools.ctf.core" version="2.1.0" match="greaterOrEqual"/>
-      <import plugin="org.eclipse.linuxtools.tmf.core" version="2.1.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.ctf.core" version="3.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.tmf.core" version="3.0.0" match="greaterOrEqual"/>
       <import plugin="org.eclipse.ui"/>
       <import plugin="org.eclipse.ui.ide"/>
-      <import plugin="org.eclipse.linuxtools.tmf.ui" version="2.1.0" match="greaterOrEqual"/>
-      <import plugin="org.eclipse.linuxtools.lttng2.core" version="2.1.0" match="greaterOrEqual"/>
-      <import plugin="org.eclipse.linuxtools.lttng2.ui" version="2.1.0" match="greaterOrEqual"/>
-      <import plugin="org.eclipse.linuxtools.lttng2.kernel.core" version="2.1.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.tmf.ui" version="3.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.lttng2.core" version="3.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.lttng2.ui" version="3.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.lttng2.kernel.core" version="3.0.0" match="greaterOrEqual"/>
       <import plugin="org.eclipse.help"/>
    </requires>
 
index 3da81c00ce5340d8cb5653febcb2e9fc5d6feb51..ccfbd533e0385ab13915c5108ba2a0d2419c9f31 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.kernel</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-feature</packaging>
 
   <name>Linux Tools LTTng Kernel Analysis Feature</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index e3c762f5fcf3f03b339fe84e853270d537081325..583ff7057cd063a8e172bf7ad890a6f22c1a3dd5 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ui.tests;singleton:=true
 Bundle-ActivationPolicy: lazy
@@ -12,8 +12,8 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.core.runtime,
  org.eclipse.ui,
  org.eclipse.ui.ide,
- org.eclipse.linuxtools.lttng2.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.lttng2.ui;bundle-version="2.1.0"
+ org.eclipse.linuxtools.lttng2.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.lttng2.ui;bundle-version="3.0.0"
 Import-Package: org.eclipse.rse.core,
  org.eclipse.rse.core.model,
  org.eclipse.rse.core.subsystems,
index a131deeef4b14c7554986a352b9230cbf62be922..7107d2d27fc0bdb1b3af32c3c84ef0d24a154e8e 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.ui.tests</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
   <name>Linux Tools LTTng UI Tests Plug-in</name>
index 42bc460e392b18c57f13a2d59947c6dba4164eb0..2bba394069ae4552bd15e6cbdef2de1396d8c988 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ui;singleton:=true
 Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.ui.Activator
@@ -12,9 +12,9 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.ui.ide,
  org.eclipse.core.resources,
  org.eclipse.core.runtime,
- org.eclipse.linuxtools.lttng2.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.ui;bundle-version="2.1.0"
+ org.eclipse.linuxtools.lttng2.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.internal.lttng2.ui;x-friends:="org.eclipse.linuxtools.lttng2.ui.tests",
  org.eclipse.linuxtools.internal.lttng2.ui.views.control;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui,org.eclipse.linuxtools.lttng2.ui.tests",
  org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs;x-friends:="org.eclipse.linuxtools.lttng2.ui.tests",
index 8336bceb06111050e6c5af456cb25c82a5f9eb4e..da19e0043ddac663687b6fa8b7c25179f9ed553b 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.ui</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools LTTng UI Plug-in</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index ff91d1d990c34c010c0274be70eeceff2c293cc5..b32f5181a1deb2cd6f3c2a75fe4841b4c9a5d059 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ust.core.tests;singleton:=true
 Bundle-ActivationPolicy: lazy
index e706ece19afa9ded30d46f777f9dbd1d6b326677..7f4dcd45fddf2d86ec6092df3c5656561edad8b9 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.ust.core.tests</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
   <name>Linux Tools LTTng Userspace Tracer Analysis Core Test Plug-in</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index ad33466cdd12dc3d4bb9539a2d207cd34d500dc7..06ecec5654570989f5fab63e5d3eed5df3f743a2 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ust.core;singleton:=true
 Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.ust.core.Activator
@@ -12,5 +12,5 @@ Export-Package: org.eclipse.linuxtools.internal.lttng2.ust.core;x-internal:=true
  org.eclipse.linuxtools.lttng2.ust.core.trace
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.core.resources,
- org.eclipse.linuxtools.ctf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0"
index 447bd28c89dc91bea57dd3d141c8368dcc6a7a1d..80a9f9f3c9a0aad765f3136d8919582f40f62ebe 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.ust.core</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools LTTng Userspace Tracer Analysis Core Plug-in</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 496e7f4779e8797f3add7b2ac81fd91292f43f76..c037c5c0408144b3858635c1af522867c324bcb9 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ust.ui.tests;singleton:=true
 Bundle-ActivationPolicy: lazy
@@ -11,5 +11,5 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.ui,
  org.eclipse.core.resources,
  org.eclipse.core.runtime,
- org.eclipse.linuxtools.lttng2.ust.ui;bundle-version="2.1.0"
+ org.eclipse.linuxtools.lttng2.ust.ui;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.lttng2.ust.ui.tests
index 5bf28e9e22c1285da3cb618cd1bee56c98cbc3f5..3671bc56cf0a5c309b2772958382e0dfc278438b 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.ust.ui.tests</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
   <name>Linux Tools LTTng Userspace Tracer Analysis UI Tests Plug-in</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 73a026544c3b137a2f247c55cea32db4f8f228b8..44f3bbc19876b543662c775a6ab720c150669529 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ust.ui;singleton:=true
 Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.ust.ui.Activator
@@ -11,6 +11,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.eclipse.core.resources,
  org.eclipse.core.runtime,
  org.eclipse.ui,
- org.eclipse.linuxtools.lttng2.ust.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.lttng2.ust.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.internal.lttng2.ust.ui;x-friends:="org.eclipse.linuxtools.lttng2.ust.ui.tests"
index 5690d4bc770be4ccafcf42fee282015a7a052854..47c2a54caaf268a9806a0aabe755f97449bc26bf 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.ust.ui</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools LTTng Userspace Tracer Analysis UI Plug-in</name>
index 1d498b14db8ed84498922b8a37675528ef9087de..8f26c95ff2be0bde02e56b546641185491b3e59b 100644 (file)
@@ -3,7 +3,7 @@
 <feature
       id="org.eclipse.linuxtools.lttng2.ust"
       label="%featureName"
-      version="2.1.0.qualifier"
+      version="3.0.0.qualifier"
       provider-name="%featureProvider"
       license-feature="org.eclipse.linuxtools.license.feature"
       license-feature-version="1.0.0.qualifier">
    <requires>
       <import plugin="org.eclipse.core.runtime"/>
       <import plugin="org.eclipse.core.resources"/>
-      <import plugin="org.eclipse.linuxtools.ctf.core" version="2.1.0" match="greaterOrEqual"/>
-      <import plugin="org.eclipse.linuxtools.tmf.core" version="2.1.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.ctf.core" version="3.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.tmf.core" version="3.0.0" match="greaterOrEqual"/>
       <import plugin="org.eclipse.ui"/>
       <import plugin="org.eclipse.ui.ide"/>
-      <import plugin="org.eclipse.linuxtools.tmf.ui" version="2.1.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.tmf.ui" version="3.0.0" match="greaterOrEqual"/>
       <import plugin="org.eclipse.help"/>
    </requires>
 
index f35d31e2dabd232d6312e42579ac05cbd9dae340..167412a842d194e1fd88d1c7e4da33962dc267d0 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2.ust</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-feature</packaging>
 
   <name>Linux Tools LTTng Userspace Tracer Analysis Feature</name>
index f5282429ccf84c0e116beaedbc7e8c37667d43f5..07ddb7c42dbe024829c4f9a2fa46c5564abf658f 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="org.eclipse.linuxtools.lttng2"
       label="%featureName"
-      version="2.1.0.qualifier"
+      version="3.0.0.qualifier"
       provider-name="%featureProvider"
       license-feature="org.eclipse.linuxtools.license.feature"
       license-feature-version="1.0.0.qualifier">
@@ -38,9 +38,9 @@
       <import plugin="org.eclipse.ui"/>
       <import plugin="org.eclipse.ui.ide"/>
       <import plugin="org.eclipse.core.resources"/>
-      <import plugin="org.eclipse.linuxtools.lttng2.core" version="2.0.0" match="greaterOrEqual"/>
-      <import plugin="org.eclipse.linuxtools.tmf.core" version="2.0.0" match="greaterOrEqual"/>
-      <import plugin="org.eclipse.linuxtools.tmf.ui" version="2.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.lttng2.core" version="3.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.tmf.core" version="3.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.tmf.ui" version="3.0.0" match="greaterOrEqual"/>
       <import plugin="org.eclipse.help"/>
       <import feature="org.eclipse.rse" version="3.1.100" match="greaterOrEqual"/>
    </requires>
index 0a5b8cb83bab31402740114aa839d0082196a771..a795fa437f9df322a14cadc6a7beabbd915e11bd 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.lttng2</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-feature</packaging>
 
   <name>Linux Tools LTTng (Linux Tracing Toolkit) Feature</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 9ae86ee5b2ca8c752e58e91d9770c62208739c26..9117e0a55af4a8b699d43e3b199112672cca066a 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.tmf.core.tests;singleton:=true
 Bundle-Activator: org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin
@@ -11,9 +11,9 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.ctf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.ctf.core.tests;bundle-version="2.1.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.ctf.core.tests;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.tmf.core.tests,
  org.eclipse.linuxtools.tmf.core.tests.shared,
  org.eclipse.linuxtools.tmf.tests.stubs.trace;x-friends:="org.eclipse.linuxtools.tmf.ui.tests"
index 76c7cca2772d427d3db262b977a9658035253152..c35cd054ac9320a97c1ffdf59fd15aaddd59424a 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.tmf.core.tests</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
   <name>Linux Tools TMF Core Tests Plug-in</name>
index 9f4146d9f20e5d2808b5b8f54181f4b93dc1daaa..11de9adc4e544a83d3cbbe9146ba174497cefa34 100644 (file)
@@ -34,7 +34,7 @@ public final class CtfTmfTestTraces {
     private static final File emptyFile = new File("");
     private static CtfTmfTrace emptyTrace = new CtfTmfTrace();
 
-    private static CtfTmfTrace[] testTraces = new CtfTmfTrace[3];
+    private static CtfTmfTrace[] testTraces = new CtfTmfTrace[5];
 
     /**
      * Get an empty File (new File("");)
index 7723e75a802de6f1aa44ea67af1640cc6d337820..35dac22ebbfd127c8728c8e31ac574555b6942b4 100644 (file)
@@ -29,7 +29,10 @@ import org.junit.runners.Suite;
     org.eclipse.linuxtools.tmf.core.tests.signal.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.statesystem.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.statistics.AllTests.class,
+    org.eclipse.linuxtools.tmf.core.tests.synchronization.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.trace.AllTests.class,
+    org.eclipse.linuxtools.tmf.core.tests.trace.indexer.checkpoint.AllTests.class,
+    org.eclipse.linuxtools.tmf.core.tests.trace.location.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.uml2sd.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.util.AllTests.class
 })
index f393286cb9b9d35090c956bed79641cfcb641c10..70027e9bb1f16e3459d9246f5b4b3d87431802d3 100644 (file)
@@ -22,6 +22,7 @@ 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.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
 import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfStartSynchSignal;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
@@ -98,7 +99,6 @@ public class TmfEventProviderTest {
      */
     @Test
     public void testGetPlainEvents() {
-        final int BLOCK_SIZE = 100;
         final int NB_EVENTS = 1000;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
@@ -108,7 +108,8 @@ public class TmfEventProviderTest {
         ITmfDataProvider provider = eventProviders[0];
 
         TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+                range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(ITmfEvent event) {
                 super.handleData(event);
@@ -138,8 +139,6 @@ public class TmfEventProviderTest {
      */
     @Test
     public void testCancelRequests() {
-
-        final int BLOCK_SIZE = 100;
         final int NB_EVENTS = 1000;
         final int NUMBER_EVENTS_BEFORE_CANCEL_REQ1 = 10;
         final int NUMBER_EVENTS_BEFORE_CANCEL_REQ2 = 800;
@@ -155,7 +154,8 @@ public class TmfEventProviderTest {
         TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
 
         // Create first request
-        final TmfEventRequest request1 = new TmfEventRequest(ITmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+        final TmfEventRequest request1 = new TmfEventRequest(ITmfEvent.class,
+                range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(ITmfEvent event) {
                 super.handleData(event);
@@ -182,7 +182,8 @@ public class TmfEventProviderTest {
         assertFalse("isRunning", request1.isRunning());
 
         // Create second request
-        final TmfEventRequest request2 = new TmfEventRequest(ITmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+        final TmfEventRequest request2 = new TmfEventRequest(ITmfEvent.class,
+                range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(ITmfEvent event) {
                 super.handleData(event);
@@ -246,7 +247,7 @@ public class TmfEventProviderTest {
     }
 
     private static void getSyntheticData(final TmfTimeRange range,
-            final int nbEvents, final int blockSize) throws InterruptedException {
+            final int nbEvents) throws InterruptedException {
 
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
@@ -256,7 +257,7 @@ public class TmfEventProviderTest {
         ITmfDataProvider provider = eventProviders[0];
 
         final TmfEventRequest request = new TmfEventRequest(TmfSyntheticEventStub.class, range,
-                nbEvents, blockSize) {
+                0, nbEvents, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(ITmfEvent event) {
                 super.handleData(event);
@@ -288,33 +289,7 @@ public class TmfEventProviderTest {
     public void testGetSyntheticEvents_EqualBlockSizes() {
         TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
         try {
-            getSyntheticData(range, 1000, TmfSyntheticEventProviderStub.BLOCK_SIZE);
-        } catch (InterruptedException e) {
-            fail();
-        }
-    }
-
-    /**
-     * Test getSyntheticEvents for smaller block sizes.
-     */
-    @Test
-    public void testGetSyntheticEvents_SmallerBlock() {
-        TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        try {
-            getSyntheticData(range, 1000, TmfSyntheticEventProviderStub.BLOCK_SIZE / 2);
-        } catch (InterruptedException e) {
-            fail();
-        }
-    }
-
-    /**
-     * Test getSyntheticEvents for larger block sizes.
-     */
-    @Test
-    public void testGetSyntheticEvents_LargerBlock() {
-        TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        try {
-            getSyntheticData(range, 1000, TmfSyntheticEventProviderStub.BLOCK_SIZE * 2);
+            getSyntheticData(range, 1000);
         } catch (InterruptedException e) {
             fail();
         }
@@ -329,7 +304,7 @@ public class TmfEventProviderTest {
         TmfTimestamp end = new TmfTimestamp(1000, (byte) -3, 0);
         TmfTimeRange range = new TmfTimeRange(start, end);
         try {
-            getSyntheticData(range, -1, TmfSyntheticEventProviderStub.BLOCK_SIZE);
+            getSyntheticData(range, -1);
         } catch (InterruptedException e) {
             fail();
         }
index d322e15e69685c37e34b7f7fac486571051eca1b..31d1d86d9af74bedae72e8bb936d9395027fd611 100644 (file)
@@ -194,45 +194,4 @@ public class CtfTmfEventFieldTest {
         CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
         assertEquals("test=float=9.551467814359616E-38", result.toString());
     }
-
-    /**
-     * Run the CtfTmfEventField formatNumber(Long, int, boolean) method test for
-     * unsigned values.
-     */
-    @Test
-    public void testFormatNumber_unsignedLong() {
-
-        long unsignedLongValue = -64;
-        String result = CtfTmfEventField.formatNumber(unsignedLongValue, 10, false);
-        // -64 + 2^64 = 18446744073709551552
-        assertEquals("18446744073709551552", result);
-
-        unsignedLongValue = -131940199973272L;
-        result = CtfTmfEventField.formatNumber(unsignedLongValue, 10, false);
-        // -131940199973272l + 2^64 = 18446612133509578344
-        assertEquals("18446612133509578344", result);
-
-        unsignedLongValue = 123456789L;
-        result = CtfTmfEventField.formatNumber(unsignedLongValue, 10, false);
-        assertEquals("123456789", result);
-    }
-
-    /**
-     * Run the CtfTmfEventField formatNumber(Long, int, boolean) method test for
-     * signed values.
-     */
-    @Test
-    public void testFormatNumber_signedLong() {
-        long signedValue = -64L;
-        String result = CtfTmfEventField.formatNumber(signedValue, 10, true);
-        assertEquals("-64", result);
-
-        signedValue = -131940199973272L;
-        result = CtfTmfEventField.formatNumber(signedValue, 10, true);
-        assertEquals("-131940199973272", result);
-
-        signedValue = 123456789L;
-        result = CtfTmfEventField.formatNumber(signedValue, 10, true);
-        assertEquals("123456789", result);
-    }
 }
index 1b6cb640610e2eb6299caf2eefa4f1c76925426b..5278a3978b1f3336a51aab0c2503ab95410c08a4 100644 (file)
@@ -125,6 +125,26 @@ public class CtfTmfEventTest {
         assertArrayEquals(fields2, fields);
     }
 
+    /**
+     * Run the ITmfEventField getSubFieldValue(String[]) method test.
+     */
+    @Test
+    public void testGetSubFieldValue() {
+        /* Field exists */
+        String[] names = { "pid" };
+        assertNotNull(fixture.getContent().getSubField(names));
+
+        /* First field exists, not the second */
+        String[] names2 = { "pid", "abcd" };
+        assertNull(fixture.getContent().getSubField(names2));
+
+        /* Both field do not exist */
+        String[] names3 = { "pfid", "abcd" };
+        assertNull(fixture.getContent().getSubField(names3));
+
+        /* TODO Missing case of embedded field, need event for it */
+    }
+
     /**
      * Run the long getID() method test.
      */
index 913e465d56ed6b2dcd37176ce58ea751feb3e533..235be8b825e36d7a13ae2e72369093f085e82018 100644 (file)
@@ -364,4 +364,14 @@ public class CtfTmfTraceTest {
         assertTrue(fixture.hasAtLeastOneOfEvents(names));
         assertFalse(fixture.hasAllEvents(names));
     }
+
+    /**
+     * Run the String getHostId() method test
+     */
+    @Test
+    public void testCtfHostId() {
+        String a = fixture.getHostId();
+        assertEquals("\"84db105b-b3f4-4821-b662-efc51455106a\"", a);
+    }
+
 }
index 6aeb2b015457427e59fde3628298ae42f6a75f3d..d59a5014e070aca548552f46b8008622f30b18d5 100644 (file)
@@ -227,7 +227,7 @@ public class EventContextTest {
         public EventContextTestRequest(long timestamp) {
             super(CtfTmfEvent.class,
                     new TmfTimeRange(new CtfTmfTimestamp(timestamp), TmfTimestamp.BIG_CRUNCH),
-                    0, 1, 1, ExecutionType.FOREGROUND);
+                    0, 1, ExecutionType.FOREGROUND);
         }
 
         @Override
index 540386c1759b10cf1489901741b8cbb0b2ed572f..ecd8d38fd7bef77bb1396e100ff7aaebade3f3d6 100644 (file)
@@ -30,7 +30,7 @@ public class RequestBenchmark extends TmfEventRequest {
 
     private RequestBenchmark(final Class<? extends ITmfEvent> dataType,
             final TmfTimeRange range, final int nbRequested) {
-        super(dataType, range, nbRequested, 1);
+        super(dataType, range, 0, nbRequested, ExecutionType.FOREGROUND);
     }
 
     // Path of the trace
index 5a22bc6b36e25cbbcf10b90c4c71a8ef89aebfed..2f83a2f727739a614cb162dab3d5a8757c760ad7 100644 (file)
@@ -96,7 +96,7 @@ public class TmfEventTest {
         try {
             final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
             final File test = new File(FileLocator.toFileURL(location).toURI());
-            trace = new TmfTraceStub(test.toURI().getPath(), 500, false);
+            trace = new TmfTraceStub(test.toURI().getPath(), 500, false, null, null);
         } catch (final TmfTraceException e) {
             e.printStackTrace();
         } catch (final URISyntaxException e) {
index 5479df307c220dfda17e65965f523d4e0465f2a6..6869cc84765b4a4e48cf041b14f336b109bc7ed9 100644 (file)
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertTrue;
 import org.eclipse.linuxtools.internal.tmf.core.request.TmfCoalescedDataRequest;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
 import org.eclipse.linuxtools.tmf.tests.stubs.request.TmfDataRequestStub;
 import org.junit.Before;
 import org.junit.Test;
@@ -52,20 +53,20 @@ public class TmfCoalescedDataRequestTest {
     @Before
     public void setUp() {
         TmfDataRequest.reset();
-        fRequest1 = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
-        fRequest2 = new TmfCoalescedDataRequest(ITmfEvent.class, 20, 100, 200);
-        fRequest3 = new TmfCoalescedDataRequest(ITmfEvent.class, 20, 200, 200);
-        fRequest4 = new TmfCoalescedDataRequest(ITmfEvent.class, 20, 200, 300);
+        fRequest1 = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+        fRequest2 = new TmfCoalescedDataRequest(ITmfEvent.class, 20, 100, ExecutionType.FOREGROUND);
+        fRequest3 = new TmfCoalescedDataRequest(ITmfEvent.class, 20, 200, ExecutionType.FOREGROUND);
+        fRequest4 = new TmfCoalescedDataRequest(ITmfEvent.class, 20, 200, ExecutionType.FOREGROUND);
 
-        fRequest1b = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
-        fRequest1c = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
+        fRequest1b = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+        fRequest1c = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
 
         fRequestCount = fRequest1c.getRequestId() + 1;
     }
 
     private static TmfCoalescedDataRequest setupTestRequest(final boolean[] flags) {
 
-        TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200) {
+        TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND) {
             @Override
             public void handleCompleted() {
                 super.handleCompleted();
@@ -94,63 +95,12 @@ public class TmfCoalescedDataRequestTest {
     }
 
     // ------------------------------------------------------------------------
-    // Constructors
+    // Constructor
     // ------------------------------------------------------------------------
 
-    @Test
-    public void testTmfCoalescedDataRequest() {
-        TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class);
-
-        assertEquals("getRequestId", fRequestCount++, request.getRequestId());
-        assertEquals("getDataType", ITmfEvent.class, request.getDataType());
-
-        assertEquals("getIndex", 0, request.getIndex());
-        assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
-
-        assertFalse("isCompleted", request.isCompleted());
-        assertFalse("isFailed", request.isFailed());
-        assertFalse("isCancelled", request.isCancelled());
-
-        assertEquals("getNbRead", 0, request.getNbRead());
-    }
-
-    @Test
-    public void testTmfCoalescedDataRequestIndex() {
-        TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class, 10);
-
-        assertEquals("getRequestId", fRequestCount++, request.getRequestId());
-        assertEquals("getDataType", ITmfEvent.class, request.getDataType());
-
-        assertEquals("getIndex", 10, request.getIndex());
-        assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
-
-        assertFalse("isCompleted", request.isCompleted());
-        assertFalse("isFailed", request.isFailed());
-        assertFalse("isCancelled", request.isCancelled());
-
-        assertEquals("getNbRead", 0, request.getNbRead());
-    }
-
-    @Test
-    public void testTmfCoalescedDataRequestIndexNbRequested() {
-        TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100);
-
-        assertEquals("getRequestId", fRequestCount++, request.getRequestId());
-        assertEquals("getDataType", ITmfEvent.class, request.getDataType());
-
-        assertEquals("getIndex", 10, request.getIndex());
-        assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
-
-        assertFalse("isCompleted", request.isCompleted());
-        assertFalse("isFailed", request.isFailed());
-        assertFalse("isCancelled", request.isCancelled());
-
-        assertEquals("getNbRead", 0, request.getNbRead());
-    }
-
     @Test
     public void testTmfCoalescedDataRequestIndexNbEventsBlocksize() {
-        TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
+        TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
 
         assertEquals("getRequestId", fRequestCount++, request.getRequestId());
         assertEquals("getDataType", ITmfEvent.class, request.getDataType());
@@ -219,10 +169,10 @@ public class TmfCoalescedDataRequestTest {
 
     @Test
     public void testToString() {
-        String expected1 = "[TmfCoalescedDataRequest(0,ITmfEvent,FOREGROUND,10,100,200, [])]";
-        String expected2 = "[TmfCoalescedDataRequest(1,ITmfEvent,FOREGROUND,20,100,200, [])]";
-        String expected3 = "[TmfCoalescedDataRequest(2,ITmfEvent,FOREGROUND,20,200,200, [])]";
-        String expected4 = "[TmfCoalescedDataRequest(3,ITmfEvent,FOREGROUND,20,200,300, [])]";
+        String expected1 = "[TmfCoalescedDataRequest(0,ITmfEvent,FOREGROUND,10,100, [])]";
+        String expected2 = "[TmfCoalescedDataRequest(1,ITmfEvent,FOREGROUND,20,100, [])]";
+        String expected3 = "[TmfCoalescedDataRequest(2,ITmfEvent,FOREGROUND,20,200, [])]";
+        String expected4 = "[TmfCoalescedDataRequest(3,ITmfEvent,FOREGROUND,20,200, [])]";
 
         assertEquals("toString", expected1, fRequest1.toString());
         assertEquals("toString", expected2, fRequest2.toString());
@@ -236,15 +186,15 @@ public class TmfCoalescedDataRequestTest {
 
     @Test
     public void testIsCompatible() {
-        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest request1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest request2 = new TmfDataRequestStub(ITmfEvent.class, 5, 100, 200);
-        TmfDataRequest request3 = new TmfDataRequestStub(ITmfEvent.class, 5, 4, 200);
-        TmfDataRequest request4 = new TmfDataRequestStub(ITmfEvent.class, 5, 5, 200);
-        TmfDataRequest request5 = new TmfDataRequestStub(ITmfEvent.class, 15, 100, 200);
-        TmfDataRequest request6 = new TmfDataRequestStub(ITmfEvent.class, 100, 100, 200);
-        TmfDataRequest request7 = new TmfDataRequestStub(ITmfEvent.class, 110, 100, 200);
-        TmfDataRequest request8 = new TmfDataRequestStub(ITmfEvent.class, 111, 100, 200);
+        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+        TmfDataRequest request1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+        TmfDataRequest request2 = new TmfDataRequestStub(ITmfEvent.class, 5, 100);
+        TmfDataRequest request3 = new TmfDataRequestStub(ITmfEvent.class, 5, 4);
+        TmfDataRequest request4 = new TmfDataRequestStub(ITmfEvent.class, 5, 5);
+        TmfDataRequest request5 = new TmfDataRequestStub(ITmfEvent.class, 15, 100);
+        TmfDataRequest request6 = new TmfDataRequestStub(ITmfEvent.class, 100, 100);
+        TmfDataRequest request7 = new TmfDataRequestStub(ITmfEvent.class, 110, 100);
+        TmfDataRequest request8 = new TmfDataRequestStub(ITmfEvent.class, 111, 100);
 
         assertTrue("isCompatible", coalescedRequest.isCompatible(request1));
         assertTrue("isCompatible", coalescedRequest.isCompatible(request2));
@@ -255,8 +205,8 @@ public class TmfCoalescedDataRequestTest {
         assertTrue("isCompatible", coalescedRequest.isCompatible(request7));
         assertTrue("isCompatible", coalescedRequest.isCompatible(request8));
 
-        TmfDataRequest request9  = new TmfDataRequestStub(ITmfEvent.class,   5,   3, 200);
-        TmfDataRequest request10 = new TmfDataRequestStub(ITmfEvent.class, 112, 100, 200);
+        TmfDataRequest request9  = new TmfDataRequestStub(ITmfEvent.class,   5,   3);
+        TmfDataRequest request10 = new TmfDataRequestStub(ITmfEvent.class, 112, 100);
 
         assertFalse("isCompatible", coalescedRequest.isCompatible(request9));
         assertFalse("isCompatible", coalescedRequest.isCompatible(request10));
@@ -268,98 +218,90 @@ public class TmfCoalescedDataRequestTest {
 
     @Test
     public void testAddRequest1() {
-        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
 
         assertTrue("isCompatible", coalescedRequest.isCompatible(request));
         coalescedRequest.addRequest(request);
         assertEquals("addRequest", 10, coalescedRequest.getIndex());
         assertEquals("addRequest", 100, coalescedRequest.getNbRequested());
-        assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
     }
 
     @Test
     public void testAddRequest2() {
-        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 5, 100, 200);
+        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 5, 100);
 
         assertTrue("isCompatible", coalescedRequest.isCompatible(request));
         coalescedRequest.addRequest(request);
         assertEquals("addRequest", 5, coalescedRequest.getIndex());
         assertEquals("addRequest", 105, coalescedRequest.getNbRequested());
-        assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
     }
 
     @Test
     public void testAddRequest3() {
-        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 5, 4, 200);
+        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 5, 4);
 
         assertTrue("isCompatible", coalescedRequest.isCompatible(request));
         coalescedRequest.addRequest(request);
         assertEquals("addRequest", 5, coalescedRequest.getIndex());
         assertEquals("addRequest", 105, coalescedRequest.getNbRequested());
-        assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
     }
 
     @Test
     public void testAddRequest4() {
-        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 5, 5, 200);
+        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 5, 5);
 
         assertTrue("isCompatible", coalescedRequest.isCompatible(request));
         coalescedRequest.addRequest(request);
         assertEquals("addRequest", 5, coalescedRequest.getIndex());
         assertEquals("addRequest", 105, coalescedRequest.getNbRequested());
-        assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
     }
 
     @Test
     public void testAddRequest5() {
-        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class,  15, 100, 200);
+        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class,  15, 100);
 
         assertTrue("isCompatible", coalescedRequest.isCompatible(request));
         coalescedRequest.addRequest(request);
         assertEquals("addRequest", 10, coalescedRequest.getIndex());
         assertEquals("addRequest", 105, coalescedRequest.getNbRequested());
-        assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
     }
 
     @Test
     public void testAddRequest6() {
-        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 100, 100, 200);
+        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 100, 100);
 
         assertTrue("isCompatible", coalescedRequest.isCompatible(request));
         coalescedRequest.addRequest(request);
         assertEquals("addRequest", 10, coalescedRequest.getIndex());
         assertEquals("addRequest", 190, coalescedRequest.getNbRequested());
-        assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
     }
 
     @Test
     public void testAddRequest7() {
-        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 110, 100, 200);
+        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 110, 100);
 
         assertTrue("isCompatible", coalescedRequest.isCompatible(request));
         coalescedRequest.addRequest(request);
         assertEquals("addRequest", 10, coalescedRequest.getIndex());
         assertEquals("addRequest", 200, coalescedRequest.getNbRequested());
-        assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
     }
 
     @Test
     public void testAddRequest8() {
-        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 111, 100, 200);
+        TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 111, 100);
 
         assertTrue("isCompatible", coalescedRequest.isCompatible(request));
         coalescedRequest.addRequest(request);
         assertEquals("addRequest", 10, coalescedRequest.getIndex());
         assertEquals("addRequest", 201, coalescedRequest.getNbRequested());
-        assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
     }
 
     // ------------------------------------------------------------------------
@@ -371,8 +313,8 @@ public class TmfCoalescedDataRequestTest {
         // Test request
         final boolean[] crFlags = new boolean[4];
         TmfCoalescedDataRequest request = setupTestRequest(crFlags);
-        TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+        TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+        TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
         request.addRequest(subRequest1);
         request.addRequest(subRequest2);
 
@@ -407,8 +349,8 @@ public class TmfCoalescedDataRequestTest {
     public void testFail() {
         final boolean[] crFlags = new boolean[4];
         TmfCoalescedDataRequest request = setupTestRequest(crFlags);
-        TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+        TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+        TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
         request.addRequest(subRequest1);
         request.addRequest(subRequest2);
 
@@ -443,8 +385,8 @@ public class TmfCoalescedDataRequestTest {
     public void testCancel() {
         final boolean[] crFlags = new boolean[4];
         TmfCoalescedDataRequest request = setupTestRequest(crFlags);
-        TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+        TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+        TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
         request.addRequest(subRequest1);
         request.addRequest(subRequest2);
 
@@ -479,8 +421,8 @@ public class TmfCoalescedDataRequestTest {
     public void testCancelSubRequests() {
         final boolean[] crFlags = new boolean[4];
         TmfCoalescedDataRequest request = setupTestRequest(crFlags);
-        TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
-        TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+        TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+        TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
         request.addRequest(subRequest1);
         request.addRequest(subRequest2);
 
index 55b457f9a7852c050d2e7575653d4c9b8edb054e..807117108992e006367dff0b095a0c1469b87ebc 100644 (file)
@@ -75,20 +75,20 @@ public class TmfCoalescedEventRequestTest {
     @Before
     public void setUp() {
         TmfDataRequest.reset();
-        fRequest1 = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100, 200);
-        fRequest2 = new TmfCoalescedEventRequest(ITmfEvent.class, range2, 100, 200);
-        fRequest3 = new TmfCoalescedEventRequest(ITmfEvent.class, range2, 200, 200);
-        fRequest4 = new TmfCoalescedEventRequest(ITmfEvent.class, range2, 200, 300);
+        fRequest1 = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 100, ExecutionType.FOREGROUND);
+        fRequest2 = new TmfCoalescedEventRequest(ITmfEvent.class, range2, 0, 100, ExecutionType.FOREGROUND);
+        fRequest3 = new TmfCoalescedEventRequest(ITmfEvent.class, range2, 0, 200, ExecutionType.FOREGROUND);
+        fRequest4 = new TmfCoalescedEventRequest(ITmfEvent.class, range2, 0, 200, ExecutionType.FOREGROUND);
 
-        fRequest1b = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100, 200);
-        fRequest1c = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100, 200);
+        fRequest1b = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 100, ExecutionType.FOREGROUND);
+        fRequest1c = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 100, ExecutionType.FOREGROUND);
 
         fRequestCount = fRequest1c.getRequestId() + 1;
     }
 
     private TmfCoalescedEventRequest setupTestRequest(final boolean[] flags) {
 
-        TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100, 200) {
+        TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 100, ExecutionType.FOREGROUND) {
             @Override
             public void handleCompleted() {
                 super.handleCompleted();
@@ -117,62 +117,12 @@ public class TmfCoalescedEventRequestTest {
     }
 
     // ------------------------------------------------------------------------
-    // Constructors
+    // Constructor
     // ------------------------------------------------------------------------
 
-    @Test
-    public void testTmfCoalescedEventRequest() {
-        TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class);
-
-        assertEquals("getRequestId", fRequestCount++, request.getRequestId());
-        assertEquals("getDataType", ITmfEvent.class, request.getDataType());
-
-        assertEquals("getRange", range1, request.getRange());
-        assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
-
-        assertFalse("isCompleted", request.isCompleted());
-        assertFalse("isFailed", request.isFailed());
-        assertFalse("isCancelled", request.isCancelled());
-
-        assertEquals("getNbRead", 0, request.getNbRead());
-    }
-
-    @Test
-    public void testTmfCoalescedEventRequestIndex() {
-        TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class, range1);
-
-        assertEquals("getRequestId", fRequestCount++, request.getRequestId());
-        assertEquals("getDataType", ITmfEvent.class, request.getDataType());
-
-        assertEquals("getRange", range1, request.getRange());
-        assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
-
-        assertFalse("isCompleted", request.isCompleted());
-        assertFalse("isFailed", request.isFailed());
-        assertFalse("isCancelled", request.isCancelled());
-
-        assertEquals("getNbRead", 0, request.getNbRead());
-    }
-
-    public void testTmfCoalescedEventRequestIndexNbRequested() {
-        TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100);
-
-        assertEquals("getRequestId", fRequestCount++, request.getRequestId());
-        assertEquals("getDataType", ITmfEvent.class, request.getDataType());
-
-        assertEquals("getRange", range1, request.getRange());
-        assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
-
-        assertFalse("isCompleted", request.isCompleted());
-        assertFalse("isFailed", request.isFailed());
-        assertFalse("isCancelled", request.isCancelled());
-
-        assertEquals("getNbRead", 0, request.getNbRead());
-    }
-
     @Test
     public void testTmfCoalescedEventRequestIndexNbEventsBlocksize() {
-        TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100, 200);
+        TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 100, ExecutionType.FOREGROUND);
 
         assertEquals("getRequestId", fRequestCount++, request.getRequestId());
         assertEquals("getDataType", ITmfEvent.class, request.getDataType());
@@ -227,11 +177,20 @@ public class TmfCoalescedEventRequestTest {
     @Test
     public void testEqualsSuper() {
         TmfCoalescedDataRequest dataRequest1 = new TmfCoalescedDataRequest(
-                fRequest1.getDataType(), fRequest1.getIndex(), fRequest1.getNbRequested());
+                fRequest1.getDataType(),
+                fRequest1.getIndex(),
+                fRequest1.getNbRequested(),
+                ExecutionType.FOREGROUND);
         TmfCoalescedDataRequest dataRequest2 = new TmfCoalescedDataRequest(
-                fRequest1.getDataType(), fRequest1.getIndex(), fRequest1.getNbRequested());
+                fRequest1.getDataType(),
+                fRequest1.getIndex(),
+                fRequest1.getNbRequested(),
+                ExecutionType.FOREGROUND);
         TmfCoalescedDataRequest dataRequest3 = new TmfCoalescedDataRequest(
-                fRequest3.getDataType(), fRequest3.getIndex(), fRequest3.getNbRequested());
+                fRequest3.getDataType(),
+                fRequest3.getIndex(),
+                fRequest3.getNbRequested(),
+                ExecutionType.FOREGROUND);
 
         assertTrue("equals", fRequest1.equals(dataRequest2));
         assertTrue("equals", fRequest2.equals(dataRequest1));
@@ -256,10 +215,10 @@ public class TmfCoalescedEventRequestTest {
 
     @Test
     public void testToString() {
-        String expected1 = "[TmfCoalescedEventRequest(0,ITmfEvent,FOREGROUND," + range1 + ",0,100,200, [])]";
-        String expected2 = "[TmfCoalescedEventRequest(1,ITmfEvent,FOREGROUND," + range2 + ",0,100,200, [])]";
-        String expected3 = "[TmfCoalescedEventRequest(2,ITmfEvent,FOREGROUND," + range2 + ",0,200,200, [])]";
-        String expected4 = "[TmfCoalescedEventRequest(3,ITmfEvent,FOREGROUND," + range2 + ",0,200,300, [])]";
+        String expected1 = "[TmfCoalescedEventRequest(0,ITmfEvent,FOREGROUND," + range1 + ",0,100, [])]";
+        String expected2 = "[TmfCoalescedEventRequest(1,ITmfEvent,FOREGROUND," + range2 + ",0,100, [])]";
+        String expected3 = "[TmfCoalescedEventRequest(2,ITmfEvent,FOREGROUND," + range2 + ",0,200, [])]";
+        String expected4 = "[TmfCoalescedEventRequest(3,ITmfEvent,FOREGROUND," + range2 + ",0,200, [])]";
 
         assertEquals("toString", expected1, fRequest1.toString());
         assertEquals("toString", expected2, fRequest2.toString());
@@ -273,7 +232,7 @@ public class TmfCoalescedEventRequestTest {
 
     @Test
     public void testIsCompatible() {
-        TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100, 200);
+        TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 100, ExecutionType.FOREGROUND);
         TmfEventRequest req1 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200);
         TmfEventRequest req2 = new TmfEventRequestStub(ITmfEvent.class, range2, 100, 200);
         TmfEventRequest req3 = new TmfEventRequestStub(ITmfEvent.class, range1, 101, 200);
@@ -289,7 +248,7 @@ public class TmfCoalescedEventRequestTest {
 
     @Test
     public void testAddEvent1() {
-        TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 2147483647, 200, ExecutionType.FOREGROUND);
+        TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 2147483647, ExecutionType.FOREGROUND);
         TmfEventRequest req1 = new TmfEventRequestStub(ITmfEvent.class, range1, 0, 2147483647, 200);
         TmfEventRequest req2 = new TmfEventRequestStub(ITmfEvent.class, range1, 1, 2147483647, 200);
 
@@ -301,13 +260,11 @@ public class TmfCoalescedEventRequestTest {
 
         assertEquals("addRequest", 0, coalescedRequest.getIndex());
         assertEquals("addRequest", 2147483647, coalescedRequest.getNbRequested());
-        assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
-
     }
 
     @Test
     public void testAddEvent2() {
-        TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 1, 2147483647, 200, ExecutionType.FOREGROUND);
+        TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 1, 2147483647, ExecutionType.FOREGROUND);
         TmfEventRequest req1 = new TmfEventRequestStub(ITmfEvent.class, range1, 1, 2147483647, 200);
         TmfEventRequest req2 = new TmfEventRequestStub(ITmfEvent.class, range1, 0, 2147483647, 200);
 
@@ -319,8 +276,6 @@ public class TmfCoalescedEventRequestTest {
 
         assertEquals("addRequest", 0, coalescedRequest.getIndex());
         assertEquals("addRequest", 2147483647, coalescedRequest.getNbRequested());
-        assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
-
     }
 
     // ------------------------------------------------------------------------
@@ -439,7 +394,6 @@ public class TmfCoalescedEventRequestTest {
     private static final String DIRECTORY = "testfiles";
     private static final String TEST_STREAM = "A-Test-10K";
     private static final int NB_EVENTS = 5000;
-    private static final int BLOCK_SIZE = 100;
 
     // Initialize the test trace
     private TmfTraceStub fTrace = null;
@@ -449,7 +403,7 @@ public class TmfCoalescedEventRequestTest {
             try {
                 URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
                 File test = new File(FileLocator.toFileURL(location).toURI());
-                fTrace = new TmfTraceStub(test.getPath(), 500);
+                fTrace = new TmfTraceStub(test.getPath(), 500, false, null, null);
             } catch (TmfTraceException e) {
                 e.printStackTrace();
             } catch (URISyntaxException e) {
@@ -489,14 +443,14 @@ public class TmfCoalescedEventRequestTest {
         final long REQUEST_OFFSET = 1000;
 
         requestedEvents1 = new Vector<ITmfEvent>();
-        request1 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex, NB_EVENTS, BLOCK_SIZE) {
-               int nbRead = 0;
+        request1 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex,
+                NB_EVENTS, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(ITmfEvent event) {
                 super.handleData(event);
                 if (!isCompleted()) {
                     requestedEvents1.add(event);
-                    if (++nbRead >= BLOCK_SIZE && signal.forceCancel) {
+                    if (signal.forceCancel) {
                         cancel();
                     }
                 }
@@ -504,7 +458,8 @@ public class TmfCoalescedEventRequestTest {
         };
 
         requestedEvents2 = new Vector<ITmfEvent>();
-        request2 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex + REQUEST_OFFSET, NB_EVENTS, BLOCK_SIZE) {
+        request2 = new TmfEventRequest(ITmfEvent.class, range,
+                signal.fIndex + REQUEST_OFFSET, NB_EVENTS, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(ITmfEvent event) {
                 super.handleData(event);
@@ -515,7 +470,8 @@ public class TmfCoalescedEventRequestTest {
         };
 
         requestedEvents3 = new Vector<ITmfEvent>();
-        request3 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex + 2 * REQUEST_OFFSET, NB_EVENTS, BLOCK_SIZE) {
+        request3 = new TmfEventRequest(ITmfEvent.class, range,
+                signal.fIndex + 2 * REQUEST_OFFSET, NB_EVENTS, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(ITmfEvent event) {
                 super.handleData(event);
@@ -590,7 +546,6 @@ public class TmfCoalescedEventRequestTest {
         request2.waitForCompletion();
         request3.waitForCompletion();
 
-        assertEquals("Request1: nbEvents", BLOCK_SIZE, requestedEvents1.size());
         assertTrue("Request1: isCompleted", request1.isCompleted());
         assertTrue("Request1: isCancelled", request1.isCancelled());
 
@@ -604,9 +559,6 @@ public class TmfCoalescedEventRequestTest {
 
         // Ensure that we have distinct events.
         // Don't go overboard: we are not validating the stub!
-        for (int i = 0; i < BLOCK_SIZE; i++) {
-            assertEquals("Distinct events", i + 1 + request1.getIndex(), requestedEvents1.get(i).getTimestamp().getValue());
-        }
         for (int i = 0; i < NB_EVENTS; i++) {
             assertEquals("Distinct events", i + 1 + request2.getIndex(), requestedEvents2.get(i).getTimestamp().getValue());
             assertEquals("Distinct events", i + 1 + request3.getIndex(), requestedEvents3.get(i).getTimestamp().getValue());
index 520649a1dfe0d768c0c45109bdaf28d55ddb36c9..b42c0be66727e7adc2bebd919125bbe1a52e534e 100644 (file)
@@ -49,18 +49,18 @@ public class TmfDataRequestTest {
     @Before
     public void setUp() {
         TmfDataRequest.reset();
-        fRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
-        fRequest2 = new TmfDataRequestStub(ITmfEvent.class, 20, 100, 200);
-        fRequest3 = new TmfDataRequestStub(ITmfEvent.class, 20, 200, 200);
-        fRequest4 = new TmfDataRequestStub(ITmfEvent.class, 20, 200, 300);
-        fRequest1b = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
-        fRequest1c = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+        fRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+        fRequest2 = new TmfDataRequestStub(ITmfEvent.class, 20, 100);
+        fRequest3 = new TmfDataRequestStub(ITmfEvent.class, 20, 200);
+        fRequest4 = new TmfDataRequestStub(ITmfEvent.class, 20, 200);
+        fRequest1b = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+        fRequest1c = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
         fRequestCount = fRequest1c.getRequestId() + 1;
     }
 
     private static TmfDataRequest setupTestRequest(final boolean[] flags) {
 
-        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200) {
+        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 10, 100) {
             @Override
             public void handleCompleted() {
                 super.handleCompleted();
@@ -145,7 +145,7 @@ public class TmfDataRequestTest {
 
     @Test
     public void testTmfDataRequestIndexNbEventsBlocksize() {
-        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+        TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
 
         assertEquals("getRequestId", fRequestCount++, request.getRequestId());
         assertEquals("getDataType", ITmfEvent.class, request.getDataType());
@@ -214,10 +214,10 @@ public class TmfDataRequestTest {
 
     @Test
     public void testToString() {
-        String expected1 = "[TmfDataRequestStub(0,ITmfEvent,FOREGROUND,10,100,200)]";
-        String expected2 = "[TmfDataRequestStub(1,ITmfEvent,FOREGROUND,20,100,200)]";
-        String expected3 = "[TmfDataRequestStub(2,ITmfEvent,FOREGROUND,20,200,200)]";
-        String expected4 = "[TmfDataRequestStub(3,ITmfEvent,FOREGROUND,20,200,300)]";
+        String expected1 = "[TmfDataRequestStub(0,ITmfEvent,FOREGROUND,10,100)]";
+        String expected2 = "[TmfDataRequestStub(1,ITmfEvent,FOREGROUND,20,100)]";
+        String expected3 = "[TmfDataRequestStub(2,ITmfEvent,FOREGROUND,20,200)]";
+        String expected4 = "[TmfDataRequestStub(3,ITmfEvent,FOREGROUND,20,200)]";
 
         assertEquals("toString", expected1, fRequest1.toString());
         assertEquals("toString", expected2, fRequest2.toString());
index ff66f6d8c0c0c40359b4a39d56b28bca13332241..aff6b7c0b4e4041a18725c4305d5f47a1f9e1011 100644 (file)
@@ -235,10 +235,10 @@ public class TmfEventRequestTest {
 
     @Test
     public void testToString() {
-        String expected1 = "[TmfEventRequestStub(0,ITmfEvent,FOREGROUND," + range1 + ",0,100,200)]";
-        String expected2 = "[TmfEventRequestStub(1,ITmfEvent,FOREGROUND," + range2 + ",0,100,200)]";
-        String expected3 = "[TmfEventRequestStub(2,ITmfEvent,FOREGROUND," + range2 + ",0,200,200)]";
-        String expected4 = "[TmfEventRequestStub(3,ITmfEvent,FOREGROUND," + range2 + ",0,200,300)]";
+        String expected1 = "[TmfEventRequestStub(0,ITmfEvent,FOREGROUND," + range1 + ",0,100)]";
+        String expected2 = "[TmfEventRequestStub(1,ITmfEvent,FOREGROUND," + range2 + ",0,100)]";
+        String expected3 = "[TmfEventRequestStub(2,ITmfEvent,FOREGROUND," + range2 + ",0,200)]";
+        String expected4 = "[TmfEventRequestStub(3,ITmfEvent,FOREGROUND," + range2 + ",0,200)]";
 
         assertEquals("toString", expected1, fRequest1.toString());
         assertEquals("toString", expected2, fRequest2.toString());
index 8573765caa1de1705f407b3cfca7be1b66ec55a1..94d57166eda077192ea21b9291337549086e60d0 100644 (file)
@@ -377,14 +377,14 @@ public class TmfSchedulerTest {
     // ------------------------------------------------------------------------
 
     private class BackgroundRequest extends TmfEventRequest {
-        private static final int CHUNK_SIZE = 0;
         private int nbEvents = 0;
         private String backgroundName;
 
         BackgroundRequest(TmfTimeRange timeRange) {
-            super(fixture.getEventType(), timeRange,
+            super(fixture.getEventType(),
+                    timeRange,
+                    0,
                     TmfDataRequest.ALL_DATA,
-                    CHUNK_SIZE,
                     ExecutionType.BACKGROUND);
             backgroundName = getExecType().toString() + ++fBackgroundId;
         }
@@ -404,14 +404,14 @@ public class TmfSchedulerTest {
     }
 
     private class ForegroundRequest extends TmfEventRequest {
-        private static final int CHUNK_SIZE = 0;
         private int nbEvents = 0;
         private String foregroundName;
 
         ForegroundRequest(TmfTimeRange timeRange) {
-            super(fixture.getEventType(), timeRange,
+            super(fixture.getEventType(),
+                    timeRange,
+                    0,
                     TmfDataRequest.ALL_DATA,
-                    CHUNK_SIZE,
                     ExecutionType.FOREGROUND);
             foregroundName = getExecType().toString() + ++fForegroundId;
         }
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/AllTests.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/AllTests.java
new file mode 100644 (file)
index 0000000..6a264ab
--- /dev/null
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.synchronization;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for org.eclipse.linuxtools.tmf.core.synchronization
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ TsTransformTest.class,
+        SyncTest.class })
+public class AllTests {
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/SyncTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/SyncTest.java
new file mode 100644 (file)
index 0000000..46742f4
--- /dev/null
@@ -0,0 +1,240 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.synchronization;
+
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventDependency;
+import org.eclipse.linuxtools.tmf.core.synchronization.ITmfTimestampTransform;
+import org.eclipse.linuxtools.tmf.core.synchronization.SyncAlgorithmFullyIncremental;
+import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationAlgorithm;
+import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationAlgorithm.SyncQuality;
+import org.eclipse.linuxtools.tmf.core.synchronization.TmfTimestampTransform;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.tests.stubs.event.TmfSyncEventStub;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for {@link SynchronizationAlgorithm} and its descendants
+ *
+ * @author Geneviève Bastien
+ */
+@SuppressWarnings("nls")
+public class SyncTest {
+
+    private TmfTraceStub t1, t2;
+    private TmfTraceStub[] fTraces;
+
+    /**
+     * Initializing the traces
+     */
+    @Before
+    public void init() {
+        t1 = new TmfTraceStub();
+        t1.init("t1");
+        t2 = new TmfTraceStub();
+        t2.init("t2");
+        TmfTraceStub[] traces = { t1, t2 };
+        fTraces = traces;
+    }
+
+    /**
+     * Testing fully incremental algorithm with communication between the two
+     * traces
+     */
+    @Test
+    public void testFullyIncremental() {
+
+        SynchronizationAlgorithm syncAlgo = new SyncAlgorithmFullyIncremental();
+
+        syncAlgo.init(fTraces);
+
+        assertEquals(SyncQuality.ABSENT, syncAlgo.getSynchronizationQuality(t1, t2));
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t2, new TmfTimestamp(1)),
+                        new TmfSyncEventStub(t1, new TmfTimestamp(1))
+                ));
+        assertEquals("SyncAlgorithmFullyIncremental [Between t1 and t2 [ alpha 1 beta 0 ]]", syncAlgo.toString());
+        assertEquals(SyncQuality.INCOMPLETE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(1)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(3))
+                ));
+        assertEquals("SyncAlgorithmFullyIncremental [Between t1 and t2 [ alpha 1 beta 0 ]]", syncAlgo.toString());
+        assertEquals(SyncQuality.INCOMPLETE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t2, new TmfTimestamp(2)),
+                        new TmfSyncEventStub(t1, new TmfTimestamp(3))
+                ));
+        assertEquals("SyncAlgorithmFullyIncremental [Between t1 and t2 [ alpha 1 beta 0.5 ]]", syncAlgo.toString());
+        assertEquals(SyncQuality.APPROXIMATE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(3)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(5))
+                ));
+        assertEquals("SyncAlgorithmFullyIncremental [Between t1 and t2 [ alpha 0.75 beta 1.25 ]]", syncAlgo.toString());
+        assertEquals(SyncQuality.ACCURATE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(4)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(8))
+                ));
+        assertEquals("SyncAlgorithmFullyIncremental [Between t1 and t2 [ alpha 0.75 beta 1.25 ]]", syncAlgo.toString());
+        assertEquals(SyncQuality.ACCURATE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t2, new TmfTimestamp(4)),
+                        new TmfSyncEventStub(t1, new TmfTimestamp(5))
+                ));
+        assertEquals("SyncAlgorithmFullyIncremental [Between t1 and t2 [ alpha 1.125 beta 0.875 ]]", syncAlgo.toString());
+        assertEquals(SyncQuality.ACCURATE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t2, new TmfTimestamp(4)),
+                        new TmfSyncEventStub(t1, new TmfTimestamp(6))
+                ));
+        assertEquals("SyncAlgorithmFullyIncremental [Between t1 and t2 [ alpha 1.125 beta 0.875 ]]", syncAlgo.toString());
+        assertEquals(SyncQuality.ACCURATE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(6)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(7))
+                ));
+        assertEquals("SyncAlgorithmFullyIncremental [Between t1 and t2 [ alpha 0.725 beta 1.275 ]]", syncAlgo.toString());
+        assertEquals(SyncQuality.ACCURATE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        ITmfTimestampTransform tt2 = syncAlgo.getTimestampTransform(t2);
+        ITmfTimestampTransform tt1 = syncAlgo.getTimestampTransform(t1);
+
+        assertEquals(syncAlgo.getTimestampTransform("t1"), tt1);
+        assertEquals(TmfTimestampTransform.IDENTITY, tt1);
+        assertEquals(syncAlgo.getTimestampTransform("t2"), tt2);
+
+        /* Make the two hulls intersect */
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(7)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(4))
+                ));
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t2, new TmfTimestamp(7)),
+                        new TmfSyncEventStub(t1, new TmfTimestamp(3))
+                ));
+        assertEquals(SyncQuality.FAIL, syncAlgo.getSynchronizationQuality(t1, t2));
+    }
+
+    /**
+     * Testing the fully incremental synchronization algorithm when
+     * communication goes in only one direction
+     */
+    @Test
+    public void testOneHull() {
+
+        SynchronizationAlgorithm syncAlgo = new SyncAlgorithmFullyIncremental();
+
+        syncAlgo.init(fTraces);
+
+        assertEquals(SyncQuality.ABSENT, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(1)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(3)))
+                );
+        assertEquals(SyncQuality.INCOMPLETE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(2)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(5)))
+                );
+
+        assertEquals(SyncQuality.INCOMPLETE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(3)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(5)))
+                );
+        assertEquals(SyncQuality.INCOMPLETE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(4)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(7)))
+                );
+        assertEquals(SyncQuality.INCOMPLETE, syncAlgo.getSynchronizationQuality(t1, t2));
+        assertEquals("SyncAlgorithmFullyIncremental [Between t1 and t2 [ alpha 1 beta 0 ]]", syncAlgo.toString());
+
+    }
+
+    /**
+     * Testing the fully incremental synchronization algorithm when all
+     * communication from trace1 to trace2 happens before all communication from
+     * trace2 to trace1
+     */
+    @Test
+    public void testDisjoint() {
+
+        SynchronizationAlgorithm syncAlgo = new SyncAlgorithmFullyIncremental();
+
+        syncAlgo.init(fTraces);
+
+        assertEquals(SyncQuality.ABSENT, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(1)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(3)))
+                );
+        assertEquals(SyncQuality.INCOMPLETE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(2)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(5)))
+                );
+
+        assertEquals(SyncQuality.INCOMPLETE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(3)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(5)))
+                );
+        assertEquals(SyncQuality.INCOMPLETE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t1, new TmfTimestamp(4)),
+                        new TmfSyncEventStub(t2, new TmfTimestamp(7)))
+                );
+        assertEquals(SyncQuality.INCOMPLETE, syncAlgo.getSynchronizationQuality(t1, t2));
+        assertEquals("SyncAlgorithmFullyIncremental [Between t1 and t2 [ alpha 1 beta 0 ]]", syncAlgo.toString());
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t2, new TmfTimestamp(7)),
+                        new TmfSyncEventStub(t1, new TmfTimestamp(6)))
+                );
+        assertEquals(SyncQuality.APPROXIMATE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t2, new TmfTimestamp(8)),
+                        new TmfSyncEventStub(t1, new TmfTimestamp(6)))
+                );
+        assertEquals(SyncQuality.APPROXIMATE, syncAlgo.getSynchronizationQuality(t1, t2));
+
+        syncAlgo.addMatch(
+                new TmfEventDependency(new TmfSyncEventStub(t2, new TmfTimestamp(10)),
+                        new TmfSyncEventStub(t1, new TmfTimestamp(8)))
+                );
+        assertEquals(SyncQuality.APPROXIMATE, syncAlgo.getSynchronizationQuality(t1, t2));
+        assertEquals("SyncAlgorithmFullyIncremental [Between t1 and t2 [ alpha 1 beta 2.5 ]]", syncAlgo.toString());
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/TsTransformTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/TsTransformTest.java
new file mode 100644 (file)
index 0000000..4e91a4a
--- /dev/null
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.synchronization;
+
+import static org.junit.Assert.*;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.linuxtools.tmf.core.synchronization.ITmfTimestampTransform;
+import org.eclipse.linuxtools.tmf.core.synchronization.TmfTimestampTransform;
+import org.eclipse.linuxtools.tmf.core.synchronization.TmfTimestampTransformLinear;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.junit.Test;
+
+/**
+ * Tests for {@link TmfTimestampTransform} and its descendants
+ *
+ * @author Geneviève Bastien
+ */
+@SuppressWarnings("nls")
+public class TsTransformTest {
+
+    private long ts = 1361657893526374091L;
+    private ITmfTimestamp oTs = new TmfTimestamp(ts);
+
+    /**
+     * Test the linear transform
+     */
+    @Test
+    public void testLinearTransform() {
+        /* Default constructor */
+        TmfTimestampTransformLinear ttl = new TmfTimestampTransformLinear();
+        assertEquals(1361657893526374091L, ttl.transform(ts));
+        assertEquals(1361657893526374091L, ttl.transform(oTs).getValue());
+
+        /* Just an offset */
+        ttl = new TmfTimestampTransformLinear(BigDecimal.valueOf(1.0), BigDecimal.valueOf(3));
+        assertEquals(1361657893526374094L, ttl.transform(ts));
+        assertEquals(1361657893526374094L, ttl.transform(oTs).getValue());
+
+        /* Just a slope */
+        ttl = new TmfTimestampTransformLinear(BigDecimal.valueOf(2.0), BigDecimal.valueOf(0));
+        assertEquals(2723315787052748182L, ttl.transform(ts));
+        assertEquals(2723315787052748182L, ttl.transform(oTs).getValue());
+
+        /* Offset and slope */
+        ttl = new TmfTimestampTransformLinear(BigDecimal.valueOf(2.0), BigDecimal.valueOf(3));
+        assertEquals(2723315787052748185L, ttl.transform(ts));
+        assertEquals(2723315787052748185L, ttl.transform(oTs).getValue());
+
+        /* Offset and slope */
+        ttl = new TmfTimestampTransformLinear(BigDecimal.valueOf(0.5), BigDecimal.valueOf(0));
+        assertEquals(680828946763187045L, ttl.transform(ts));
+        assertEquals(680828946763187045L, ttl.transform(oTs).getValue());
+    }
+
+    /**
+     * Test for the identity transform
+     */
+    @Test
+    public void testIdentityTransform() {
+        ITmfTimestampTransform tt = TmfTimestampTransform.IDENTITY;
+        assertEquals(ts, tt.transform(ts));
+        assertEquals(oTs, tt.transform(oTs));
+    }
+
+    /**
+     * Test hash and equals function
+     */
+    @Test
+    public void testEquality() {
+        Map<ITmfTimestampTransform, String> map = new HashMap<ITmfTimestampTransform, String>();
+        ITmfTimestampTransform ttl = new TmfTimestampTransformLinear(BigDecimal.valueOf(2.0), BigDecimal.valueOf(3));
+        ITmfTimestampTransform ttl2 = new TmfTimestampTransformLinear(BigDecimal.valueOf(2.0), BigDecimal.valueOf(3));
+        ITmfTimestampTransform ttl3 = new TmfTimestampTransformLinear(BigDecimal.valueOf(3), BigDecimal.valueOf(3));
+        assertEquals(ttl, ttl2);
+        assertFalse(ttl.equals(ttl3));
+        assertFalse(ttl2.equals(ttl3));
+
+        map.put(ttl, "a");
+        assertTrue(map.containsKey(ttl2));
+        assertEquals("a", map.get(ttl));
+
+        ITmfTimestampTransform ti = TmfTimestampTransform.IDENTITY;
+        assertEquals(TmfTimestampTransform.IDENTITY, ti);
+        assertFalse(TmfTimestampTransform.IDENTITY.equals(ttl));
+
+        map.put(ti, "b");
+        assertTrue(map.containsKey(TmfTimestampTransform.IDENTITY));
+        assertEquals("b", map.get(ti));
+
+        assertFalse(ti.equals(ttl));
+        assertFalse(ttl.equals(ti));
+
+    }
+
+    /**
+     * Test the transform composition function
+     */
+    @Test
+    public void testComposition() {
+        long t = 100;
+        ITmfTimestampTransform ti = TmfTimestampTransform.IDENTITY;
+        ITmfTimestampTransform ttl = new TmfTimestampTransformLinear(BigDecimal.valueOf(2.0), BigDecimal.valueOf(3));
+        ITmfTimestampTransform ttl2 = new TmfTimestampTransformLinear(BigDecimal.valueOf(1.5), BigDecimal.valueOf(8));
+
+        ITmfTimestampTransform tc1 = ti.composeWith(ttl);
+        /* Should be ttl */
+        assertEquals(ttl, tc1);
+        assertEquals(203, tc1.transform(t));
+
+        tc1 = ttl.composeWith(ti);
+        /* Should be ttl also */
+        assertEquals(ttl, tc1);
+        assertEquals(203, tc1.transform(t));
+
+        tc1 = ti.composeWith(ti);
+        /* Should be identity */
+        assertEquals(tc1, TmfTimestampTransform.IDENTITY);
+        assertEquals(100, tc1.transform(t));
+
+        tc1 = ttl.composeWith(ttl2);
+        assertEquals(ttl.transform(ttl2.transform(t)), tc1.transform(t));
+        assertEquals(319, tc1.transform(t));
+
+        tc1 = ttl2.composeWith(ttl);
+        assertEquals(ttl2.transform(ttl.transform(t)), tc1.transform(t));
+        assertEquals(312, tc1.transform(t));
+
+    }
+}
index 52eb7f0000a5e9a59ccec890ecbf164741e5b4d5..8317efe92b8faba2a047a98ab772692c06cfdacd 100644 (file)
@@ -22,17 +22,10 @@ import org.junit.runners.Suite;
  */
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
-    TmfCheckpointIndexTest.class,
-    TmfCheckpointIndexTest2.class,
-    TmfCheckpointTest.class,
     TmfContextTest.class,
-    TmfExperimentCheckpointIndexTest.class,
     TmfExperimentTest.class,
-    TmfLocationTest.class,
     TmfMultiTraceExperimentTest.class,
     TmfTraceManagerTest.class,
     TmfTraceTest.class
 })
-public class AllTests {
-
-}
\ No newline at end of file
+public class AllTests {}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointIndexTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointIndexTest.java
deleted file mode 100644 (file)
index c727241..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2013 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 - Adapted for TMF Trace Model 1.0
- *   Alexandre Montplaisir - Port to JUnit4
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-
-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.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.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfEmptyTraceStub;
-import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test suite for the TmfCheckpointIndexTest class.
- */
-@SuppressWarnings("javadoc")
-public class TmfCheckpointIndexTest {
-
-    // ------------------------------------------------------------------------
-    // Variables
-    // ------------------------------------------------------------------------
-
-    private static final String    DIRECTORY   = "testfiles";
-    private static final String    TEST_STREAM = "A-Test-10K";
-    private static final int       BLOCK_SIZE  = 100;
-    private static final int       NB_EVENTS   = 10000;
-    private static TestTrace       fTrace      = null;
-    private static EmptyTestTrace  fEmptyTrace = null;
-
-    // ------------------------------------------------------------------------
-    // Housekeeping
-    // ------------------------------------------------------------------------
-
-    @Before
-    public void setUp() {
-        setupTrace(DIRECTORY + File.separator + TEST_STREAM);
-    }
-
-    @After
-    public void tearDown() {
-        fTrace.dispose();
-        fTrace = null;
-        fEmptyTrace.dispose();
-        fEmptyTrace = null;
-    }
-
-    // ------------------------------------------------------------------------
-    // Helper classes
-    // ------------------------------------------------------------------------
-
-    private static class TestIndexer extends TmfCheckpointIndexer {
-        @SuppressWarnings({ })
-        public TestIndexer(TestTrace testTrace) {
-            super(testTrace, BLOCK_SIZE);
-        }
-        @SuppressWarnings({ })
-        public TestIndexer(EmptyTestTrace testTrace) {
-            super(testTrace, BLOCK_SIZE);
-        }
-        public List<ITmfCheckpoint> getCheckpoints() {
-            return getTraceIndex();
-        }
-    }
-
-    private class TestTrace extends TmfTraceStub {
-        public TestTrace(String path, int blockSize) throws TmfTraceException {
-            super(path, blockSize);
-            setIndexer(new TestIndexer(this));
-        }
-        @Override
-        public TestIndexer getIndexer() {
-            return (TestIndexer) super.getIndexer();
-        }
-    }
-
-    private class EmptyTestTrace extends TmfEmptyTraceStub {
-        public EmptyTestTrace() {
-            super();
-            setIndexer(new TestIndexer(this));
-        }
-        @Override
-        public TestIndexer getIndexer() {
-            return (TestIndexer) super.getIndexer();
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Helper functions
-    // ------------------------------------------------------------------------
-
-    private synchronized void setupTrace(final String path) {
-        if (fTrace == null) {
-            try {
-                final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
-                final File test = new File(FileLocator.toFileURL(location).toURI());
-                fTrace = new TestTrace(test.toURI().getPath(), BLOCK_SIZE);
-                fTrace.indexTrace(true);
-            } catch (final TmfTraceException e) {
-                e.printStackTrace();
-            } catch (final URISyntaxException e) {
-                e.printStackTrace();
-            } catch (final IOException e) {
-                e.printStackTrace();
-            }
-        }
-
-        if (fEmptyTrace == null) {
-            fEmptyTrace = new EmptyTestTrace();
-            fEmptyTrace.indexTrace(true);
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Verify checkpoints
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testTmfTraceIndexing() {
-        assertEquals("getCacheSize",   BLOCK_SIZE, fTrace.getCacheSize());
-        assertEquals("getTraceSize",   NB_EVENTS,  fTrace.getNbEvents());
-        assertEquals("getRange-start", 1,          fTrace.getTimeRange().getStartTime().getValue());
-        assertEquals("getRange-end",   NB_EVENTS,  fTrace.getTimeRange().getEndTime().getValue());
-        assertEquals("getStartTime",   1,          fTrace.getStartTime().getValue());
-        assertEquals("getEndTime",     NB_EVENTS,  fTrace.getEndTime().getValue());
-
-        List<ITmfCheckpoint> checkpoints = fTrace.getIndexer().getCheckpoints();
-        int pageSize = fTrace.getCacheSize();
-        assertTrue("Checkpoints exist",  checkpoints != null);
-        assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
-
-        // Validate that each checkpoint points to the right event
-        for (int i = 0; i < checkpoints.size(); i++) {
-            ITmfCheckpoint checkpoint = checkpoints.get(i);
-            TmfContext context = new TmfContext(checkpoint.getLocation(), i * pageSize);
-            ITmfEvent event = fTrace.parseEvent(context);
-            assertTrue(context.getRank() == i * pageSize);
-            assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
-        }
-    }
-
-    @Test
-    public void testEmptyTmfTraceIndexing() {
-        assertEquals("getCacheSize",   ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, fEmptyTrace.getCacheSize());
-        assertEquals("getTraceSize",   0,  fEmptyTrace.getNbEvents());
-        assertEquals("getRange-start", TmfTimestamp.BIG_BANG, fEmptyTrace.getTimeRange().getStartTime());
-        assertEquals("getRange-end",   TmfTimestamp.BIG_BANG, fEmptyTrace.getTimeRange().getEndTime());
-        assertEquals("getStartTime",   TmfTimestamp.BIG_BANG, fEmptyTrace.getStartTime());
-        assertEquals("getEndTime",     TmfTimestamp.BIG_BANG, fEmptyTrace.getEndTime());
-
-        List<ITmfCheckpoint> checkpoints = fEmptyTrace.getIndexer().getCheckpoints();
-        int pageSize = fEmptyTrace.getCacheSize();
-        assertTrue("Checkpoints exist",  checkpoints != null);
-        assertEquals("Checkpoints size", 0, checkpoints.size());
-
-        // Validate that each checkpoint points to the right event
-        for (int i = 0; i < checkpoints.size(); i++) {
-            ITmfCheckpoint checkpoint = checkpoints.get(i);
-            TmfContext context = new TmfContext(checkpoint.getLocation(), i * pageSize);
-            ITmfEvent event = fEmptyTrace.parseEvent(context);
-            assertTrue(context.getRank() == i * pageSize);
-            assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
-        }
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointIndexTest2.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointIndexTest2.java
deleted file mode 100644 (file)
index fd150ca..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 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
- *   Alexandre Montplaisir - Port to JUnit4
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-
-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.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 org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfEmptyTraceStub;
-import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test suite for the TmfCheckpointIndexer class (events with same
- * timestamp around checkpoint).
- */
-@SuppressWarnings("javadoc")
-public class TmfCheckpointIndexTest2 {
-
-    // ------------------------------------------------------------------------
-    // Variables
-    // ------------------------------------------------------------------------
-
-    private static final String    DIRECTORY   = "testfiles";
-    // Trace has 3 events at t=101 at rank 99, 100, 101
-    // Trace has events with same timestamp (ts=102) for ranks 102..702 -> 2 checkpoints with same timestamp are created
-    private static final String    TEST_STREAM = "A-Test-10K-2";
-    private static final int       BLOCK_SIZE  = 100;
-    private static final int       NB_EVENTS   = 702;
-    private static TestTrace       fTrace      = null;
-    private static EmptyTestTrace  fEmptyTrace = null;
-
-    // ------------------------------------------------------------------------
-    // Housekeeping
-    // ------------------------------------------------------------------------
-
-    @Before
-    public void setUp() {
-        setupTrace(DIRECTORY + File.separator + TEST_STREAM);
-    }
-
-    @After
-    public void tearDown() {
-        fTrace.dispose();
-        fTrace = null;
-        fEmptyTrace.dispose();
-        fEmptyTrace = null;
-    }
-
-    // ------------------------------------------------------------------------
-    // Helper classes
-    // ------------------------------------------------------------------------
-
-    private static class TestIndexer extends TmfCheckpointIndexer {
-        @SuppressWarnings({ })
-        public TestIndexer(TestTrace testTrace) {
-            super(testTrace, BLOCK_SIZE);
-        }
-        @SuppressWarnings({ })
-        public TestIndexer(EmptyTestTrace testTrace) {
-            super(testTrace, BLOCK_SIZE);
-        }
-        public List<ITmfCheckpoint> getCheckpoints() {
-            return getTraceIndex();
-        }
-    }
-
-    private class TestTrace extends TmfTraceStub {
-        public TestTrace(String path, int blockSize) throws TmfTraceException {
-            super(path, blockSize);
-            setIndexer(new TestIndexer(this));
-        }
-        @Override
-        public TestIndexer getIndexer() {
-            return (TestIndexer) super.getIndexer();
-        }
-    }
-
-    private class EmptyTestTrace extends TmfEmptyTraceStub {
-        public EmptyTestTrace() {
-            super();
-            setIndexer(new TestIndexer(this));
-        }
-        @Override
-        public TestIndexer getIndexer() {
-            return (TestIndexer) super.getIndexer();
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Helper functions
-    // ------------------------------------------------------------------------
-
-    private synchronized void setupTrace(final String path) {
-        if (fTrace == null) {
-            try {
-                final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
-                final File test = new File(FileLocator.toFileURL(location).toURI());
-                fTrace = new TestTrace(test.toURI().getPath(), BLOCK_SIZE);
-                fTrace.indexTrace(true);
-            } catch (final TmfTraceException e) {
-                e.printStackTrace();
-            } catch (final URISyntaxException e) {
-                e.printStackTrace();
-            } catch (final IOException e) {
-                e.printStackTrace();
-            }
-        }
-
-        if (fEmptyTrace == null) {
-            fEmptyTrace = new EmptyTestTrace();
-            fEmptyTrace.indexTrace(true);
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Verify checkpoints
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testTmfTraceMultiTimestamps() {
-        assertEquals("getCacheSize",   BLOCK_SIZE, fTrace.getCacheSize());
-        assertEquals("getTraceSize",   NB_EVENTS,  fTrace.getNbEvents());
-        assertEquals("getRange-start", 1,          fTrace.getTimeRange().getStartTime().getValue());
-        assertEquals("getRange-end",   102,        fTrace.getTimeRange().getEndTime().getValue());
-        assertEquals("getStartTime",   1,          fTrace.getStartTime().getValue());
-        assertEquals("getEndTime",     102,        fTrace.getEndTime().getValue());
-
-        List<ITmfCheckpoint> checkpoints = fTrace.getIndexer().getCheckpoints();
-        assertTrue("Checkpoints exist",  checkpoints != null);
-        assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE + 1, checkpoints.size());
-
-        // Trace has 3 events with same timestamp (ts=101) at rank 99, 100, 101
-
-        // Verify that the event at rank=99 is returned when seeking to ts=101 (first event with this timestamp)
-        // and not the event at checkpoint boundary
-        TmfTimestamp seekTs = new TmfTimestamp(101, -3, 0);
-        ITmfContext ctx = fTrace.seekEvent(seekTs);
-        ITmfEvent event = fTrace.getNext(ctx);
-
-        assertEquals(99, ctx.getRank());
-        assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
-
-        event = fTrace.getNext(ctx);
-
-        assertEquals(100, ctx.getRank());
-        assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
-
-        event = fTrace.getNext(ctx);
-
-        assertEquals(101, ctx.getRank());
-        assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
-
-        // Trace has events with same timestamp (ts=102) for ranks 102..702 -> 2 checkpoints with same timestamp are created
-        // Verify that the event at rank=102 is returned when seeking to ts=102 (first event with this timestamp)
-        // and not the event at checkpoint boundary
-        seekTs = new TmfTimestamp(102, -3, 0);
-        ctx = fTrace.seekEvent(seekTs);
-        event = fTrace.getNext(ctx);
-
-        assertEquals(102, ctx.getRank());
-        assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
-
-        // Verify seek to first checkpoint
-        seekTs = new TmfTimestamp(1, -3, 0);
-        ctx = fTrace.seekEvent(seekTs);
-        event = fTrace.getNext(ctx);
-
-        assertEquals(1, ctx.getRank());
-        assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
-
-        // Verify seek to timestamp before first event
-        seekTs = new TmfTimestamp(0, -3, 0);
-        ctx = fTrace.seekEvent(seekTs);
-        event = fTrace.getNext(ctx);
-
-        assertEquals(1, ctx.getRank());
-        assertEquals(0, new TmfTimestamp(1, -3, 0).compareTo(event.getTimestamp(), false));
-
-        // Verify seek to timestamp between first and second checkpoint
-        seekTs = new TmfTimestamp(50, -3, 0);
-        ctx = fTrace.seekEvent(seekTs);
-        event = fTrace.getNext(ctx);
-
-        assertEquals(50, ctx.getRank());
-        assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
-
-        // Verify seek to timestamp after last event in trace
-        seekTs = new TmfTimestamp(103, -3, 0);
-        ctx = fTrace.seekEvent(seekTs);
-        event = fTrace.getNext(ctx);
-
-        assertEquals(-1, ctx.getRank());
-        assertNull(event);
-    }
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointTest.java
deleted file mode 100644 (file)
index ce86292..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2013 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 - Adapted for TMF Trace Model 1.0
- *   Alexandre Montplaisir - Port to JUnit4
- *   Patrick Tasse - Updated for location in checkpoint
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-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 org.junit.Test;
-
-/**
- * Test suite for the TmfCheckpoint class.
- */
-@SuppressWarnings("javadoc")
-public class TmfCheckpointTest {
-
-    // ------------------------------------------------------------------------
-    // Variables
-    // ------------------------------------------------------------------------
-
-    private ITmfTimestamp fTimestamp1 = new TmfTimestamp();
-    private ITmfTimestamp fTimestamp2 = TmfTimestamp.BIG_BANG;
-    private ITmfTimestamp fTimestamp3 = TmfTimestamp.BIG_CRUNCH;
-
-    private Long aLong1 = 12345L;
-    private Long aLong2 = 23456L;
-    private Long aLong3 = 34567L;
-    private ITmfLocation fLocation1 = new TmfLongLocation(aLong1);
-    private ITmfLocation fLocation2 = new TmfLongLocation(aLong2);
-    private ITmfLocation fLocation3 = new TmfLongLocation(aLong3);
-
-    private TmfCheckpoint fCheckpoint1 = new TmfCheckpoint(fTimestamp1, fLocation1);
-    private TmfCheckpoint fCheckpoint2 = new TmfCheckpoint(fTimestamp2, fLocation2);
-    private TmfCheckpoint fCheckpoint3 = new TmfCheckpoint(fTimestamp3, fLocation3);
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testTmfCheckpoint() {
-        assertEquals("TmfCheckpoint", fTimestamp1, fCheckpoint1.getTimestamp());
-        assertEquals("TmfCheckpoint", fLocation1,  fCheckpoint1.getLocation());
-    }
-
-    public void testTmfLocationCopy() {
-        final TmfCheckpoint checkpoint = new TmfCheckpoint(fCheckpoint1);
-
-        assertEquals("TmfCheckpoint", fTimestamp1, checkpoint.getTimestamp());
-        assertEquals("TmfCheckpoint", fLocation1,  checkpoint.getLocation());
-    }
-
-    @Test
-    public void testTmfLocationCopy2() {
-        try {
-            new TmfCheckpoint(null);
-            fail("null copy");
-        }
-        catch (final IllegalArgumentException e) {
-            // Success
-        }
-        catch (final Exception e) {
-            fail("wrong exception");
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // compareTo
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testCompareTo() {
-        assertEquals("compareTo",  0, fCheckpoint1.compareTo(fCheckpoint1));
-        assertEquals("compareTo",  1, fCheckpoint1.compareTo(fCheckpoint2));
-        assertEquals("compareTo", -1, fCheckpoint1.compareTo(fCheckpoint3));
-
-        assertEquals("compareTo", -1, fCheckpoint2.compareTo(fCheckpoint1));
-        assertEquals("compareTo",  0, fCheckpoint2.compareTo(fCheckpoint2));
-        assertEquals("compareTo", -1, fCheckpoint2.compareTo(fCheckpoint3));
-
-        assertEquals("compareTo",  1, fCheckpoint3.compareTo(fCheckpoint1));
-        assertEquals("compareTo",  1, fCheckpoint3.compareTo(fCheckpoint2));
-        assertEquals("compareTo",  0, fCheckpoint3.compareTo(fCheckpoint3));
-    }
-
-    @Test
-    public void testCompareToNull() {
-        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, fLocation1);
-        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(null, fLocation2);
-        final TmfCheckpoint checkpoint3 = new TmfCheckpoint(null, fLocation3);
-        final TmfCheckpoint checkpoint4 = new TmfCheckpoint(null, fLocation1);
-
-        // Test the various 'null' vs. '!null' combinations
-        assertEquals("compareTo",  0, checkpoint1.compareTo(fCheckpoint1));
-        assertEquals("compareTo",  0, fCheckpoint1.compareTo(checkpoint1));
-        assertEquals("compareTo", -1, checkpoint1.compareTo(fCheckpoint2));
-        assertEquals("compareTo",  1, fCheckpoint2.compareTo(checkpoint1));
-        assertEquals("compareTo", -1, checkpoint1.compareTo(fCheckpoint3));
-        assertEquals("compareTo",  1, fCheckpoint3.compareTo(checkpoint1));
-
-        // Test the 'null' vs. 'null' combinations
-        assertEquals("compareTo",  0, checkpoint1.compareTo(checkpoint4));
-        assertEquals("compareTo",  0, checkpoint4.compareTo(checkpoint1));
-        assertEquals("compareTo", -1, checkpoint1.compareTo(checkpoint2));
-        assertEquals("compareTo",  1, checkpoint2.compareTo(checkpoint1));
-        assertEquals("compareTo", -1, checkpoint1.compareTo(checkpoint3));
-        assertEquals("compareTo",  1, checkpoint3.compareTo(checkpoint1));
-    }
-
-    // ------------------------------------------------------------------------
-    // hashCode
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testHashCode() {
-        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
-        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fCheckpoint2);
-
-        assertTrue("hashCode", fCheckpoint1.hashCode() == checkpoint1.hashCode());
-        assertTrue("hashCode", fCheckpoint2.hashCode() == checkpoint2.hashCode());
-
-        assertTrue("hashCode", fCheckpoint1.hashCode() != checkpoint2.hashCode());
-        assertTrue("hashCode", fCheckpoint2.hashCode() != checkpoint1.hashCode());
-    }
-
-    @Test
-    public void testHashCodeNull() {
-        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, fLocation1);
-        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp1, null);
-        final TmfCheckpoint checkpoint3 = new TmfCheckpoint(checkpoint1);
-        final TmfCheckpoint checkpoint4 = new TmfCheckpoint(checkpoint2);
-
-        assertTrue("hashCode", fCheckpoint1.hashCode() != checkpoint1.hashCode());
-        assertTrue("hashCode", fCheckpoint1.hashCode() != checkpoint2.hashCode());
-
-        assertTrue("hashCode", checkpoint1.hashCode() == checkpoint3.hashCode());
-        assertTrue("hashCode", checkpoint2.hashCode() == checkpoint4.hashCode());
-    }
-
-    // ------------------------------------------------------------------------
-    // equals
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testEqualsReflexivity() {
-        assertTrue("equals", fCheckpoint1.equals(fCheckpoint1));
-        assertTrue("equals", fCheckpoint2.equals(fCheckpoint2));
-
-        assertTrue("equals", !fCheckpoint1.equals(fCheckpoint2));
-        assertTrue("equals", !fCheckpoint2.equals(fCheckpoint1));
-    }
-
-    @Test
-    public void testEqualsSymmetry() {
-        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
-        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fCheckpoint2);
-
-        assertTrue("equals", checkpoint1.equals(fCheckpoint1));
-        assertTrue("equals", fCheckpoint1.equals(checkpoint1));
-
-        assertTrue("equals", checkpoint2.equals(fCheckpoint2));
-        assertTrue("equals", fCheckpoint2.equals(checkpoint2));
-    }
-
-    @Test
-    public void testEqualsTransivity() {
-        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
-        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(checkpoint1);
-        final TmfCheckpoint checkpoint3 = new TmfCheckpoint(checkpoint2);
-
-        assertTrue("equals", checkpoint1.equals(checkpoint2));
-        assertTrue("equals", checkpoint2.equals(checkpoint3));
-        assertTrue("equals", checkpoint1.equals(checkpoint3));
-    }
-
-    @Test
-    public void testNotEqual() {
-        // Various checkpoints
-        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fTimestamp1, fLocation1);
-        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp2, fLocation1);
-        final TmfCheckpoint checkpoint3 = new TmfCheckpoint(fTimestamp1, fLocation2);
-        final TmfCheckpoint checkpoint4 = new TmfCheckpoint(fTimestamp1, null);
-        final TmfCheckpoint checkpoint5 = new TmfCheckpoint(null, fLocation1);
-
-        // Null check
-        assertFalse("equals", checkpoint1.equals(null));
-
-        // Different types
-        assertFalse("equals", checkpoint1.equals(new TmfTimestamp()));
-
-        // Null locations/location
-        assertFalse("equals", checkpoint1.equals(checkpoint4));
-        assertFalse("equals", checkpoint1.equals(checkpoint5));
-        assertFalse("equals", checkpoint4.equals(checkpoint1));
-        assertFalse("equals", checkpoint5.equals(checkpoint1));
-
-        // Different locations/location
-        assertFalse("equals", checkpoint1.equals(checkpoint2));
-        assertFalse("equals", checkpoint1.equals(checkpoint3));
-    }
-
-    // ------------------------------------------------------------------------
-    // toString
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testToString() {
-        final String expected1 = "TmfCheckpoint [fLocation=" + fCheckpoint1.getLocation() +
-                ", fTimestamp=" + fCheckpoint1.getTimestamp() + "]";
-        final String expected2 = "TmfCheckpoint [fLocation=" + fCheckpoint2.getLocation() +
-                ", fTimestamp=" + fCheckpoint2.getTimestamp() + "]";
-        final String expected3 = "TmfCheckpoint [fLocation=" + fCheckpoint3.getLocation() +
-                ", fTimestamp=" + fCheckpoint3.getTimestamp() + "]";
-
-        assertEquals("toString", expected1, fCheckpoint1.toString());
-        assertEquals("toString", expected2, fCheckpoint2.toString());
-        assertEquals("toString", expected3, fCheckpoint3.toString());
-    }
-
-}
index 17be19fe846f3372a2e14f27a5959fe71ab59f70..27038945252745d11ee7c13d009fd2d014b1d025 100644 (file)
@@ -20,11 +20,12 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import org.eclipse.linuxtools.tmf.core.tests.trace.location.TmfStringLocation;
 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.linuxtools.tmf.core.trace.TmfTimestampLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfTimestampLocation;
 import org.junit.Test;
 
 /**
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentCheckpointIndexTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentCheckpointIndexTest.java
deleted file mode 100644 (file)
index 1ca14b0..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 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
- *   Alexandre Montplaisir - Port to JUnit4
- *   Patrick Tasse - Updated for ranks in experiment location
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-
-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.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.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfExperimentStub;
-import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test suite for the TmfCheckpointIndexTest class.
- */
-@SuppressWarnings("javadoc")
-public class TmfExperimentCheckpointIndexTest {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private static final String DIRECTORY    = "testfiles";
-    private static final String TEST_STREAM1 = "O-Test-10K";
-    private static final String TEST_STREAM2 = "E-Test-10K";
-    private static final String EXPERIMENT   = "MyExperiment";
-    private static int          NB_EVENTS    = 20000;
-    private static int          BLOCK_SIZE   = 1000;
-
-    private static ITmfTrace[] fTestTraces;
-    private static TmfExperimentStub fExperiment;
-
-    // ------------------------------------------------------------------------
-    // Housekeeping
-    // ------------------------------------------------------------------------
-
-    @Before
-    public void setUp() {
-        setupTraces();
-        fExperiment = new TmfExperimentStub(EXPERIMENT, fTestTraces, BLOCK_SIZE);
-        fExperiment.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, true);
-    }
-
-    @After
-    public void tearDown() {
-        fExperiment.dispose();
-        fExperiment = null;
-        for (ITmfTrace trace : fTestTraces) {
-            trace.dispose();
-        }
-        fTestTraces = null;
-    }
-
-    private static void setupTraces() {
-        final String path1 = DIRECTORY + File.separator + TEST_STREAM1;
-        final String path2 = DIRECTORY + File.separator + TEST_STREAM2;
-
-        fTestTraces = new ITmfTrace[2];
-        try {
-            URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path1), null);
-            File test = new File(FileLocator.toFileURL(location).toURI());
-            final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true);
-            fTestTraces[0] = trace1;
-            location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path2), null);
-            test = new File(FileLocator.toFileURL(location).toURI());
-            final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true);
-            fTestTraces[1] = trace2;
-        } catch (final TmfTraceException e) {
-            e.printStackTrace();
-        } catch (final URISyntaxException e) {
-            e.printStackTrace();
-        } catch (final IOException e) {
-            e.printStackTrace();
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Verify checkpoints
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testTmfTraceIndexing() {
-        assertEquals("getCacheSize",   BLOCK_SIZE, fExperiment.getCacheSize());
-        assertEquals("getTraceSize",   NB_EVENTS,  fExperiment.getNbEvents());
-        assertEquals("getRange-start", 1,          fExperiment.getTimeRange().getStartTime().getValue());
-        assertEquals("getRange-end",   NB_EVENTS,  fExperiment.getTimeRange().getEndTime().getValue());
-        assertEquals("getStartTime",   1,          fExperiment.getStartTime().getValue());
-        assertEquals("getEndTime",     NB_EVENTS,  fExperiment.getEndTime().getValue());
-
-        List<ITmfCheckpoint> checkpoints = fExperiment.getIndexer().getCheckpoints();
-        int pageSize = fExperiment.getCacheSize();
-        assertTrue("Checkpoints exist",  checkpoints != null);
-        assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
-
-        // Validate that each checkpoint points to the right event
-        for (int i = 0; i < checkpoints.size(); i++) {
-            ITmfCheckpoint checkpoint = checkpoints.get(i);
-            ITmfLocation location = checkpoint.getLocation();
-            ITmfContext context = fExperiment.seekEvent(location);
-            ITmfEvent event = fExperiment.parseEvent(context);
-            assertTrue(context.getRank() == i * pageSize);
-            assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Streaming
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testGrowingIndex() {
-        ITmfTrace[] testTraces = new TmfTraceStub[2];
-        try {
-            URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM1), null);
-            File test = new File(FileLocator.toFileURL(location).toURI());
-            final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, false);
-            testTraces[0] = trace1;
-            location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM2), null);
-            test = new File(FileLocator.toFileURL(location).toURI());
-            final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, false);
-            testTraces[1] = trace2;
-        } catch (final TmfTraceException e) {
-            e.printStackTrace();
-        } catch (final URISyntaxException e) {
-            e.printStackTrace();
-        } catch (final IOException e) {
-            e.printStackTrace();
-        }
-
-        TmfExperimentStub experiment = new TmfExperimentStub(EXPERIMENT, testTraces, BLOCK_SIZE);
-        int pageSize = experiment.getCacheSize();
-
-        // Build the first half of the index
-        TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(1, -3), new TmfTimestamp(NB_EVENTS / 2 - 1, -3));
-        experiment.getIndexer().buildIndex(0, range, true);
-
-        // Validate that each checkpoint points to the right event
-        List<ITmfCheckpoint> checkpoints = experiment.getIndexer().getCheckpoints();
-        assertTrue("Checkpoints exist",  checkpoints != null);
-        assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE / 2, checkpoints.size());
-
-        // Build the second half of the index
-        experiment.getIndexer().buildIndex(NB_EVENTS / 2, TmfTimeRange.ETERNITY, true);
-
-        // Validate that each checkpoint points to the right event
-        assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
-        for (int i = 0; i < checkpoints.size(); i++) {
-            ITmfCheckpoint checkpoint = checkpoints.get(i);
-            ITmfLocation location = checkpoint.getLocation();
-            ITmfContext context = experiment.seekEvent(location);
-            ITmfEvent event = experiment.parseEvent(context);
-            assertTrue(context.getRank() == i * pageSize);
-            assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
-            assertEquals("Checkpoint value", i * pageSize + 1, checkpoint.getTimestamp().getValue());
-        }
-
-        /* Clean up (since we didn't use the class-specific fixtures) */
-        experiment.dispose();
-        for (ITmfTrace trace : testTraces) {
-            trace.dispose();
-        }
-    }
-
-}
\ No newline at end of file
index 15e06d87fcbbe66ee5e020fd6a352e0a26f2e61a..7f26716ff32ebd0e511cd1f493b069028c8913b7 100644 (file)
@@ -35,16 +35,17 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 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.request.ITmfDataRequest.ExecutionType;
 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 org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
 import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfExperimentStub;
 import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
 import org.junit.Before;
@@ -83,7 +84,7 @@ public class TmfExperimentTest {
             try {
                 final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
                 final File test = new File(FileLocator.toFileURL(location).toURI());
-                final TmfTraceStub trace = new TmfTraceStub(test.getPath(), 0, true);
+                final TmfTraceStub trace = new TmfTraceStub(test.getPath(), 0, true, null, null);
                 fTestTraces[0] = trace;
             } catch (final TmfTraceException e) {
                 e.printStackTrace();
@@ -824,40 +825,12 @@ public class TmfExperimentTest {
 
     @Test
     public void testProcessRequestForNbEvents() throws InterruptedException {
-        final int blockSize = 100;
         final int nbEvents  = 1000;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
-            @Override
-            public void handleData(final ITmfEvent event) {
-                super.handleData(event);
-                requestedEvents.add(event);
-            }
-        };
-        fExperiment.sendRequest(request);
-        request.waitForCompletion();
-
-        assertEquals("nbEvents", nbEvents, requestedEvents.size());
-        assertTrue("isCompleted",  request.isCompleted());
-        assertFalse("isCancelled", request.isCancelled());
-
-        // Ensure that we have distinct events.
-        // Don't go overboard: we are not validating the stub!
-        for (int i = 0; i < nbEvents; i++) {
-            assertEquals("Distinct events", i+1, requestedEvents.get(i).getTimestamp().getValue());
-        }
-    }
-
-    @Test
-    public void testProcessRequestForNbEvents2() throws InterruptedException {
-        final int blockSize = 2 * NB_EVENTS;
-        final int nbEvents = 1000;
-        final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
-
-        final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+                range, 0, nbEvents, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
@@ -881,12 +854,12 @@ public class TmfExperimentTest {
     @Test
     public void testProcessRequestForAllEvents() throws InterruptedException {
         final int nbEvents  = TmfDataRequest.ALL_DATA;
-        final int blockSize =  1;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
         final long nbExpectedEvents = NB_EVENTS;
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+                range, 0, nbEvents, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
@@ -913,24 +886,27 @@ public class TmfExperimentTest {
 
     @Test
     public void testCancel() throws InterruptedException {
-        final int nbEvents  = NB_EVENTS;
-        final int blockSize = BLOCK_SIZE;
+        final int nbEvents = NB_EVENTS;
+        final int limit = BLOCK_SIZE;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+                range, 0, nbEvents, ExecutionType.FOREGROUND) {
             int nbRead = 0;
+
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
-                if (++nbRead == blockSize) {
+                if (++nbRead == limit) {
                     cancel();
                 }
             }
+
             @Override
             public void handleCancel() {
-                if (requestedEvents.size() < blockSize) {
+                if (requestedEvents.size() < limit) {
                     System.out.println("aie");
                 }
             }
@@ -938,7 +914,7 @@ public class TmfExperimentTest {
         fExperiment.sendRequest(request);
         request.waitForCompletion();
 
-        assertEquals("nbEvents",  blockSize, requestedEvents.size());
+        assertEquals("nbEvents",  limit, requestedEvents.size());
         assertTrue("isCompleted", request.isCompleted());
         assertTrue("isCancelled", request.isCancelled());
     }
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfLocationTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfLocationTest.java
deleted file mode 100644 (file)
index 82ff267..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2013 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
- *   Alexandre Montplaisir - Port to JUnit4
- *   Patrick Tasse - Add tests for TmfExperimentLocation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentLocation;
-import org.eclipse.linuxtools.internal.tmf.core.trace.TmfLocationArray;
-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.junit.Before;
-import org.junit.Test;
-
-/**
- * Test suite for the TmfLocation class.
- */
-@SuppressWarnings("javadoc")
-public class TmfLocationTest {
-
-    // ------------------------------------------------------------------------
-    // Variables
-    // ------------------------------------------------------------------------
-
-    private String aString = "some location";
-    private Long aLong = 12345L;
-    private TmfTimestamp aTimestamp = new TmfTimestamp();
-    private TmfLocationArray aLocationArray;
-
-    private TmfStringLocation fLocation1;
-    private TmfStringLocation fLocation2;
-    private TmfLongLocation fLocation3;
-    private TmfTimestampLocation fLocation4;
-    private TmfExperimentLocation fExpLocation;
-
-    // ------------------------------------------------------------------------
-    // Housekeeping
-    // ------------------------------------------------------------------------
-
-    @Before
-    public void setUp() {
-        fLocation1 = new TmfStringLocation((String) null);
-        fLocation2 = new TmfStringLocation(aString);
-        fLocation3 = new TmfLongLocation(aLong);
-        fLocation4 = new TmfTimestampLocation(aTimestamp);
-        aLocationArray = new TmfLocationArray(
-                new ITmfLocation[] { fLocation1, fLocation2, fLocation3, fLocation4 },
-                new long[] { 1, 2, 3, 4 }
-                );
-        fExpLocation = new TmfExperimentLocation(aLocationArray);
-    }
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testTmfLocation() {
-        assertNull("TmfLocation", fLocation1.getLocationInfo());
-        assertEquals("TmfLocation", aString, fLocation2.getLocationInfo());
-        assertEquals("TmfLocation", aLong, fLocation3.getLocationInfo());
-        assertEquals("TmfLocation", aTimestamp, fLocation4.getLocationInfo());
-        assertEquals("TmfLocation", aLocationArray, fExpLocation.getLocationInfo());
-    }
-
-    @Test
-    public void testTmfLocationCopy() {
-        TmfStringLocation location1 = new TmfStringLocation(fLocation1);
-        TmfStringLocation location2 = new TmfStringLocation(fLocation2);
-        TmfLongLocation location3 = new TmfLongLocation(fLocation3);
-        TmfTimestampLocation location4 = new TmfTimestampLocation(fLocation4);
-        TmfExperimentLocation expLocation = new TmfExperimentLocation(fExpLocation);
-
-        assertNull("TmfLocation", location1.getLocationInfo());
-        assertEquals("TmfLocation", aString, location2.getLocationInfo());
-        assertEquals("TmfLocation", aLong, location3.getLocationInfo());
-        assertEquals("TmfLocation", aTimestamp, location4.getLocationInfo());
-        assertEquals("TmfLocation", aLocationArray, expLocation.getLocationInfo());
-    }
-
-    // ------------------------------------------------------------------------
-    // hashCode
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testHashCode() {
-        TmfStringLocation location1 = new TmfStringLocation((String) null);
-        TmfStringLocation location2 = new TmfStringLocation(aString);
-        TmfLongLocation location3 = new TmfLongLocation(aLong);
-        TmfExperimentLocation expLocation = new TmfExperimentLocation(fExpLocation);
-        TmfLocationArray locationArray1 = new TmfLocationArray(aLocationArray, 3, fLocation4, 5);
-        TmfExperimentLocation expLocation1 = new TmfExperimentLocation(locationArray1);
-        TmfLocationArray locationArray2 = new TmfLocationArray(aLocationArray, 3, fLocation3, 4);
-        TmfExperimentLocation expLocation2 = new TmfExperimentLocation(locationArray2);
-        TmfLocationArray locationArray3 = new TmfLocationArray(
-                new ITmfLocation[] { fLocation1, fLocation2, fLocation3 },
-                new long[] { 1, 2, 3 }
-                );
-        TmfExperimentLocation expLocation3 = new TmfExperimentLocation(locationArray3);
-
-        assertTrue("hashCode", fLocation1.hashCode() == location1.hashCode());
-        assertTrue("hashCode", fLocation2.hashCode() == location2.hashCode());
-        assertTrue("hashCode", fLocation3.hashCode() == location3.hashCode());
-        assertTrue("hashCode", fExpLocation.hashCode() == expLocation.hashCode());
-
-        assertTrue("hashCode", fLocation2.hashCode() != location3.hashCode());
-        assertTrue("hashCode", fLocation3.hashCode() != location2.hashCode());
-        assertTrue("hashCode", fExpLocation.hashCode() != expLocation1.hashCode());
-        assertTrue("hashCode", fExpLocation.hashCode() != expLocation2.hashCode());
-        assertTrue("hashCode", fExpLocation.hashCode() != expLocation3.hashCode());
-    }
-
-    // ------------------------------------------------------------------------
-    // toEquals
-    // ------------------------------------------------------------------------
-
-    private static class TmfLocation2 extends TmfStringLocation {
-        public TmfLocation2(String location) {
-            super(location);
-        }
-    }
-
-    @Test
-    public void testEqualsWrongTypes() {
-        ITmfLocation location1 = new TmfStringLocation(aString);
-        TmfLocation2 location2 = new TmfLocation2(aString);
-
-        assertFalse("equals", location1.equals(location2));
-        assertFalse("equals", location2.equals(location1));
-    }
-
-    @Test
-    public void testEqualsWithNulls() {
-        TmfStringLocation location1 = new TmfStringLocation(aString);
-        TmfStringLocation location2 = new TmfStringLocation((String) null);
-
-        assertFalse("equals", location1.equals(location2));
-        assertFalse("equals", location2.equals(location1));
-    }
-
-    @Test
-    public void testEqualsReflexivity() {
-        assertTrue("equals", fLocation2.equals(fLocation2));
-        assertTrue("equals", fLocation3.equals(fLocation3));
-        assertTrue("equals", fExpLocation.equals(fExpLocation));
-
-        assertTrue("equals", !fLocation2.equals(fLocation3));
-        assertTrue("equals", !fLocation3.equals(fLocation2));
-        TmfLocationArray locationArray1 = new TmfLocationArray(aLocationArray, 3, fLocation4, 5);
-        TmfExperimentLocation expLocation1 = new TmfExperimentLocation(locationArray1);
-        TmfLocationArray locationArray2 = new TmfLocationArray(aLocationArray, 3, fLocation3, 4);
-        TmfExperimentLocation expLocation2 = new TmfExperimentLocation(locationArray2);
-        TmfLocationArray locationArray3 = new TmfLocationArray(
-                new ITmfLocation[] { fLocation1, fLocation2, fLocation3 },
-                new long[] { 1, 2, 3 }
-                );
-        TmfExperimentLocation expLocation3 = new TmfExperimentLocation(locationArray3);
-        assertTrue("equals", !fExpLocation.equals(expLocation1));
-        assertTrue("equals", !expLocation1.equals(fExpLocation));
-        assertTrue("equals", !fExpLocation.equals(expLocation2));
-        assertTrue("equals", !expLocation2.equals(fExpLocation));
-        assertTrue("equals", !fExpLocation.equals(expLocation3));
-        assertTrue("equals", !expLocation3.equals(fExpLocation));
-    }
-
-    @Test
-    public void testEqualsSymmetry() {
-        TmfStringLocation location2 = new TmfStringLocation(aString);
-        TmfLongLocation location3 = new TmfLongLocation(aLong);
-        TmfExperimentLocation expLocation = new TmfExperimentLocation(fExpLocation);
-
-        assertTrue("equals", location2.equals(fLocation2));
-        assertTrue("equals", fLocation2.equals(location2));
-
-        assertTrue("equals", location3.equals(fLocation3));
-        assertTrue("equals", fLocation3.equals(location3));
-
-        assertTrue("equals", expLocation.equals(fExpLocation));
-        assertTrue("equals", fExpLocation.equals(expLocation));
-    }
-
-    @Test
-    public void testEqualsTransivity() {
-        TmfStringLocation location1 = new TmfStringLocation(aString);
-        TmfStringLocation location2 = new TmfStringLocation(aString);
-        TmfStringLocation location3 = new TmfStringLocation(aString);
-        TmfExperimentLocation expLocation1 = new TmfExperimentLocation(aLocationArray);
-        TmfExperimentLocation expLocation2 = new TmfExperimentLocation(aLocationArray);
-        TmfExperimentLocation expLocation3 = new TmfExperimentLocation(aLocationArray);
-
-        assertTrue("equals", location1.equals(location2));
-        assertTrue("equals", location2.equals(location3));
-        assertTrue("equals", location3.equals(location1));
-        assertTrue("equals", expLocation1.equals(expLocation2));
-        assertTrue("equals", expLocation2.equals(expLocation3));
-        assertTrue("equals", expLocation3.equals(expLocation1));
-    }
-
-    @Test
-    public void testEqualsNull() {
-        assertTrue("equals", !fLocation2.equals(null));
-        assertTrue("equals", !fLocation2.equals(null));
-        assertTrue("equals", !fExpLocation.equals(null));
-    }
-
-    // ------------------------------------------------------------------------
-    // toString
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testToString() {
-        String str = "some location";
-        Long lng = 12345L;
-        TmfTimestamp ts = new TmfTimestamp();
-
-        TmfStringLocation location1 = new TmfStringLocation(str);
-        TmfLongLocation location2 = new TmfLongLocation(lng);
-        TmfTimestampLocation location3 = new TmfTimestampLocation(ts);
-        TmfExperimentLocation expLocation = new TmfExperimentLocation(aLocationArray);
-
-        String expected1 = "TmfStringLocation [fLocationInfo=" + str + "]";
-        String expected2 = "TmfLongLocation [fLocationInfo=" + lng + "]";
-        String expected3 = "TmfTimestampLocation [fLocationInfo=" + ts + "]";
-        String expected4 = "TmfExperimentLocation [" + aLocationArray + "]";
-
-        assertEquals("toString", expected1, location1.toString());
-        assertEquals("toString", expected2, location2.toString());
-        assertEquals("toString", expected3, location3.toString());
-        assertEquals("toString", expected4, expLocation.toString());
-    }
-
-}
index 44a3d3abbc6b581c0d4ee563f897a5de5300cd20..356fadb598eddf8961e38983cd4376dd2ab9af3a 100644 (file)
@@ -33,13 +33,14 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 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.request.ITmfDataRequest.ExecutionType;
 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.trace.location.ITmfLocation;
 import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfExperimentStub;
 import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
 import org.junit.AfterClass;
@@ -92,12 +93,12 @@ public class TmfMultiTraceExperimentTest {
 
             URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path1), null);
             File test = new File(FileLocator.toFileURL(location).toURI());
-            final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true);
+            final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true, null, null);
             traces[0] = trace1;
 
             location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path2), null);
             test = new File(FileLocator.toFileURL(location).toURI());
-            final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true);
+            final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true, null, null);
             traces[1] = trace2;
 
             return traces;
@@ -677,40 +678,12 @@ public class TmfMultiTraceExperimentTest {
 
     @Test
     public void testProcessRequestForNbEvents() throws InterruptedException {
-        final int blockSize = 100;
         final int nbEvents  = 1000;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
-            @Override
-            public void handleData(final ITmfEvent event) {
-                super.handleData(event);
-                requestedEvents.add(event);
-            }
-        };
-        fExperiment.sendRequest(request);
-        request.waitForCompletion();
-
-        assertEquals("nbEvents", nbEvents, requestedEvents.size());
-        assertTrue("isCompleted",  request.isCompleted());
-        assertFalse("isCancelled", request.isCancelled());
-
-        // Ensure that we have distinct events.
-        // Don't go overboard: we are not validating the stub!
-        for (int i = 0; i < nbEvents; i++) {
-            assertEquals("Distinct events", i+1, requestedEvents.get(i).getTimestamp().getValue());
-        }
-    }
-
-    @Test
-    public void testProcessRequestForNbEvents2() throws InterruptedException {
-        final int blockSize = 2 * NB_EVENTS;
-        final int nbEvents = 1000;
-        final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
-
-        final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+                range, 0, nbEvents, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
@@ -734,12 +707,12 @@ public class TmfMultiTraceExperimentTest {
     @Test
     public void testProcessRequestForAllEvents() throws InterruptedException {
         final int nbEvents  = TmfDataRequest.ALL_DATA;
-        final int blockSize =  1;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
         final long nbExpectedEvents = NB_EVENTS;
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+                range, 0, nbEvents, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
@@ -767,31 +740,27 @@ public class TmfMultiTraceExperimentTest {
     @Test
     public void testCancel() throws InterruptedException {
         final int nbEvents  = NB_EVENTS;
-        final int blockSize = BLOCK_SIZE;
+        final int limit = BLOCK_SIZE;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+                range, 0, nbEvents, ExecutionType.FOREGROUND) {
             int nbRead = 0;
+
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
-                if (++nbRead == blockSize) {
+                if (++nbRead == limit) {
                     cancel();
                 }
             }
-            @Override
-            public void handleCancel() {
-                if (requestedEvents.size() < blockSize) {
-                    System.out.println("aie");
-                }
-            }
         };
         fExperiment.sendRequest(request);
         request.waitForCompletion();
 
-        assertEquals("nbEvents",  blockSize, requestedEvents.size());
+        assertEquals("nbEvents",  limit, requestedEvents.size());
         assertTrue("isCompleted", request.isCompleted());
         assertTrue("isCancelled", request.isCancelled());
     }
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfStringLocation.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfStringLocation.java
deleted file mode 100644 (file)
index aa707fb..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 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.tests.trace;
-
-import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
-
-/**
- * <b><u>TmfStringLocation</u></b>
- * <p>
- * Implement me. Please.
- * <p>
- */
-public class TmfStringLocation extends TmfLocation {
-
-    /**
-     * @param location the concrete trace location
-     */
-    public TmfStringLocation(String location) {
-        super(location);
-    }
-
-    /**
-     * @param other the other location
-     */
-    public TmfStringLocation(TmfStringLocation other) {
-        super(other.getLocationInfo());
-    }
-
-    @Override
-    public String getLocationInfo() {
-        return (String) super.getLocationInfo();
-    }
-
-}
index e3b027792bc9bf170cee09c2f9f883a9281d9a08..7c058325052595fcfa13803e85db3e75b6eecab5 100644 (file)
@@ -35,6 +35,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 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.request.ITmfDataRequest.ExecutionType;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
 import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
@@ -42,10 +43,10 @@ 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.trace.TmfCheckpointIndexer;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
 import org.junit.After;
 import org.junit.Before;
@@ -64,7 +65,6 @@ public class TmfTraceTest {
     private static final long   DEFAULT_INITIAL_OFFSET_VALUE = (1L * 100 * 1000 * 1000); // .1sec
     private static final String DIRECTORY   = "testfiles";
     private static final String TEST_STREAM = "A-Test-10K";
-    private static final int    BLOCK_SIZE  = 500;
     private static final int    NB_EVENTS   = 10000;
     private static TmfTraceStub fTrace      = null;
 
@@ -94,7 +94,7 @@ public class TmfTraceTest {
             try {
                 final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
                 final File test = new File(FileLocator.toFileURL(location).toURI());
-                fTrace = new TmfTraceStub(test.toURI().getPath(), BLOCK_SIZE);
+                fTrace = new TmfTraceStub(test.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null);
                 fTrace.indexTrace(true);
             } catch (final TmfTraceException e) {
                 e.printStackTrace();
@@ -111,99 +111,18 @@ public class TmfTraceTest {
     // Constructors
     // ------------------------------------------------------------------------
 
-    @Test
-    public void testStandardConstructor() throws TmfTraceException {
-        try {
-            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
-            File testfile = new File(FileLocator.toFileURL(location).toURI());
-            TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath());
-            trace.indexTrace(true);
-
-            assertEquals("getType", ITmfEvent.class, trace.getType());
-            assertNull("getResource", trace.getResource());
-            assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
-            assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
-            assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
-            assertEquals("getName", TEST_STREAM, trace.getName());
-
-            assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
-            assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
-            assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
-            assertEquals("getStartTime", 1, trace.getStartTime().getValue());
-            assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
-
-        } catch (final URISyntaxException e) {
-            fail("URISyntaxException");
-        } catch (final IOException e) {
-            fail("IOException");
-        }
-    }
-
-    @Test
-    public void testStandardConstructorCacheSize() throws TmfTraceException {
-        try {
-            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
-            File testfile = new File(FileLocator.toFileURL(location).toURI());
-            TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), 0);
-            trace.indexTrace(true);
-
-            assertEquals("getType", ITmfEvent.class, trace.getType());
-            assertNull("getResource", trace.getResource());
-            assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
-            assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
-            assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
-            assertEquals("getName", TEST_STREAM, trace.getName());
-
-            assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
-            assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
-            assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
-            assertEquals("getStartTime", 1, trace.getStartTime().getValue());
-            assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
-
-        } catch (final URISyntaxException e) {
-            fail("URISyntaxException");
-        } catch (final IOException e) {
-            fail("IOException");
-        }
-
-        try {
-            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
-            File testfile = new File(FileLocator.toFileURL(location).toURI());
-            TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE);
-            trace.indexTrace(true);
-
-            assertEquals("getType", ITmfEvent.class, trace.getType());
-            assertNull("getResource", trace.getResource());
-            assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
-            assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize());
-            assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
-            assertEquals("getName", TEST_STREAM, trace.getName());
-
-            assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
-            assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
-            assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
-            assertEquals("getStartTime", 1, trace.getStartTime().getValue());
-            assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
-
-        } catch (final URISyntaxException e) {
-            fail("URISyntaxException");
-        } catch (final IOException e) {
-            fail("IOException");
-        }
-    }
-
     @Test
     public void testFullConstructor() throws TmfTraceException {
         try {
             final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
             File testfile = new File(FileLocator.toFileURL(location).toURI());
-            TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, null);
+            TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null);
             trace.indexTrace(true);
 
             assertEquals("getType", ITmfEvent.class, trace.getType());
             assertNull("getResource", trace.getResource());
             assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
-            assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize());
+            assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
             assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
             assertEquals("getName", TEST_STREAM, trace.getName());
 
@@ -226,13 +145,13 @@ public class TmfTraceTest {
         try {
             final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
             File testfile = new File(FileLocator.toFileURL(location).toURI());
-            TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, interval);
+            TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, interval);
             trace.indexTrace(true);
 
             assertEquals("getType", ITmfEvent.class, trace.getType());
             assertNull("getResource", trace.getResource());
             assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
-            assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize());
+            assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
             assertEquals("getStreamingInterval", interval, trace.getStreamingInterval());
             assertEquals("getName", TEST_STREAM, trace.getName());
 
@@ -254,14 +173,14 @@ public class TmfTraceTest {
         try {
             final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
             File testfile = new File(FileLocator.toFileURL(location).toURI());
-            TmfTraceStub original = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, new TmfCheckpointIndexer(null));
+            TmfTraceStub original = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, new TmfCheckpointIndexer(null), null);
             TmfTraceStub trace = new TmfTraceStub(original);
             trace.indexTrace(true);
 
             assertEquals("getType", ITmfEvent.class, trace.getType());
             assertNull("getResource", trace.getResource());
             assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
-            assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize());
+            assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
             assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
             assertEquals("getName", TEST_STREAM, trace.getName());
 
@@ -1223,11 +1142,11 @@ public class TmfTraceTest {
 
     @Test
     public void testProcessEventRequestForAllEvents() throws InterruptedException {
-        final int blockSize = 1;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, NB_EVENTS, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+                range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
@@ -1251,12 +1170,12 @@ public class TmfTraceTest {
 
     @Test
     public void testProcessEventRequestForNbEvents() throws InterruptedException {
-        final int blockSize = 100;
         final int nbEvents  = 1000;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+                range, 0, nbEvents, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
@@ -1280,13 +1199,13 @@ public class TmfTraceTest {
 
     @Test
     public void testProcessEventRequestForSomeEvents() throws InterruptedException {
-        final int blockSize = 1;
         final long startTime = 100;
         final int nbEvents  = 1000;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(startTime, SCALE), TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+                range, 0, nbEvents, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
@@ -1310,14 +1229,14 @@ public class TmfTraceTest {
 
     @Test
     public void testProcessEventRequestForOtherEvents() throws InterruptedException {
-        final int blockSize =  1;
         final int startIndex = 99;
         final long startTime = 100;
         final int nbEvents  = 1000;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(startTime, SCALE), TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, startIndex, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+                range, startIndex, nbEvents, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
@@ -1345,7 +1264,10 @@ public class TmfTraceTest {
         final int nbEvents  = 1000;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
-        final TmfDataRequest request = new TmfDataRequest(ITmfEvent.class, startIndex, nbEvents) {
+        final TmfDataRequest request = new TmfDataRequest(ITmfEvent.class,
+                startIndex,
+                nbEvents,
+                TmfDataRequest.ExecutionType.FOREGROUND) {
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
@@ -1373,16 +1295,19 @@ public class TmfTraceTest {
 
     @Test
     public void testCancel() throws InterruptedException {
+        final int limit = 500;
         final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+        final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+                range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
             int nbRead = 0;
+
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
-                if (++nbRead == BLOCK_SIZE) {
+                if (++nbRead == limit) {
                     cancel();
                 }
             }
@@ -1391,7 +1316,7 @@ public class TmfTraceTest {
         providers[0].sendRequest(request);
         request.waitForCompletion();
 
-        assertEquals("nbEvents",  BLOCK_SIZE, requestedEvents.size());
+        assertEquals("nbEvents",  limit, requestedEvents.size());
         assertTrue("isCompleted", request.isCompleted());
         assertTrue("isCancelled", request.isCancelled());
     }
@@ -1405,7 +1330,6 @@ public class TmfTraceTest {
         assertFalse ("Open trace", fTrace == null);
         assertEquals("getType",  ITmfEvent.class, fTrace.getType());
         assertNull  ("getResource", fTrace.getResource());
-        assertEquals("getCacheSize", BLOCK_SIZE, fTrace.getCacheSize());
         assertEquals("getStreamingInterval", 0, fTrace.getStreamingInterval());
         assertEquals("getName", TEST_STREAM, fTrace.getName());
 
@@ -1434,20 +1358,29 @@ public class TmfTraceTest {
         try {
             final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
             testfile = new File(FileLocator.toFileURL(location).toURI());
-            trace = new TmfTraceStub(testfile.toURI().getPath());
+            trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null);
             // verify initial values
             TmfTimestamp defaultInitRange = new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE, ITmfTimestamp.NANOSECOND_SCALE);
             assertEquals("getInitialRangeOffset", defaultInitRange, trace.getInitialRangeOffset());
             trace.setInitialRangeOffset(new TmfTimestamp(5, ITmfTimestamp.MILLISECOND_SCALE));
             trace.indexTrace(true);
+
+            TmfTimestamp initRange = new TmfTimestamp(5, ITmfTimestamp.MILLISECOND_SCALE);
+            assertEquals("getInitialRangeOffset", initRange, trace.getInitialRangeOffset());
+
         } catch (final URISyntaxException e) {
             fail("URISyntaxException");
         } catch (final IOException e) {
             fail("IOException");
         }
-        assertFalse ("Open trace", trace == null);
+    }
 
-        TmfTimestamp initRange = new TmfTimestamp(5, ITmfTimestamp.MILLISECOND_SCALE);
-        assertEquals("getInitialRangeOffset", initRange, trace.getInitialRangeOffset());
+    /**
+     * Run the String getHostId() method test
+     */
+    @Test
+    public void testTraceHostId() {
+        String a = fTrace.getHostId();
+        assertEquals("A-Test-10K", a);
     }
 }
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/AllTests.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/AllTests.java
new file mode 100644 (file)
index 0000000..0c5856a
--- /dev/null
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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:
+ *   Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.indexer.checkpoint;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TmfCheckpointIndexTest.class,
+    TmfCheckpointIndexTest2.class,
+    TmfCheckpointTest.class,
+    TmfExperimentCheckpointIndexTest.class,
+})
+public class AllTests {}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest.java
new file mode 100644 (file)
index 0000000..9ff4898
--- /dev/null
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 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 - Adapted for TMF Trace Model 1.0
+ *   Alexandre Montplaisir - Port to JUnit4
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.indexer.checkpoint;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+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.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.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfEmptyTraceStub;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test suite for the TmfCheckpointIndexTest class.
+ */
+@SuppressWarnings("javadoc")
+public class TmfCheckpointIndexTest {
+
+    // ------------------------------------------------------------------------
+    // Variables
+    // ------------------------------------------------------------------------
+
+    private static final String    DIRECTORY   = "testfiles";
+    private static final String    TEST_STREAM = "A-Test-10K";
+    private static final int       BLOCK_SIZE  = 100;
+    private static final int       NB_EVENTS   = 10000;
+    private static TestTrace       fTrace      = null;
+    private static EmptyTestTrace  fEmptyTrace = null;
+
+    // ------------------------------------------------------------------------
+    // Housekeeping
+    // ------------------------------------------------------------------------
+
+    @Before
+    public void setUp() {
+        setupTrace(DIRECTORY + File.separator + TEST_STREAM);
+    }
+
+    @After
+    public void tearDown() {
+        fTrace.dispose();
+        fTrace = null;
+        fEmptyTrace.dispose();
+        fEmptyTrace = null;
+    }
+
+    // ------------------------------------------------------------------------
+    // Helper classes
+    // ------------------------------------------------------------------------
+
+    private static class TestIndexer extends TmfCheckpointIndexer {
+        @SuppressWarnings({ })
+        public TestIndexer(TestTrace testTrace) {
+            super(testTrace, BLOCK_SIZE);
+        }
+        @SuppressWarnings({ })
+        public TestIndexer(EmptyTestTrace testTrace) {
+            super(testTrace, BLOCK_SIZE);
+        }
+        public List<ITmfCheckpoint> getCheckpoints() {
+            return getTraceIndex();
+        }
+    }
+
+    private class TestTrace extends TmfTraceStub {
+        public TestTrace(String path, int blockSize) throws TmfTraceException {
+            super(path, blockSize, false, null, null);
+            setIndexer(new TestIndexer(this));
+        }
+        @Override
+        public TestIndexer getIndexer() {
+            return (TestIndexer) super.getIndexer();
+        }
+    }
+
+    private class EmptyTestTrace extends TmfEmptyTraceStub {
+        public EmptyTestTrace() {
+            super();
+            setIndexer(new TestIndexer(this));
+        }
+        @Override
+        public TestIndexer getIndexer() {
+            return (TestIndexer) super.getIndexer();
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Helper functions
+    // ------------------------------------------------------------------------
+
+    private synchronized void setupTrace(final String path) {
+        if (fTrace == null) {
+            try {
+                final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
+                final File test = new File(FileLocator.toFileURL(location).toURI());
+                fTrace = new TestTrace(test.toURI().getPath(), BLOCK_SIZE);
+                fTrace.indexTrace(true);
+            } catch (final TmfTraceException e) {
+                e.printStackTrace();
+            } catch (final URISyntaxException e) {
+                e.printStackTrace();
+            } catch (final IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        if (fEmptyTrace == null) {
+            fEmptyTrace = new EmptyTestTrace();
+            fEmptyTrace.indexTrace(true);
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Verify checkpoints
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testTmfTraceIndexing() {
+        assertEquals("getCacheSize",   BLOCK_SIZE, fTrace.getCacheSize());
+        assertEquals("getTraceSize",   NB_EVENTS,  fTrace.getNbEvents());
+        assertEquals("getRange-start", 1,          fTrace.getTimeRange().getStartTime().getValue());
+        assertEquals("getRange-end",   NB_EVENTS,  fTrace.getTimeRange().getEndTime().getValue());
+        assertEquals("getStartTime",   1,          fTrace.getStartTime().getValue());
+        assertEquals("getEndTime",     NB_EVENTS,  fTrace.getEndTime().getValue());
+
+        List<ITmfCheckpoint> checkpoints = fTrace.getIndexer().getCheckpoints();
+        int pageSize = fTrace.getCacheSize();
+        assertTrue("Checkpoints exist",  checkpoints != null);
+        assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
+
+        // Validate that each checkpoint points to the right event
+        for (int i = 0; i < checkpoints.size(); i++) {
+            ITmfCheckpoint checkpoint = checkpoints.get(i);
+            TmfContext context = new TmfContext(checkpoint.getLocation(), i * pageSize);
+            ITmfEvent event = fTrace.parseEvent(context);
+            assertTrue(context.getRank() == i * pageSize);
+            assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
+        }
+    }
+
+    @Test
+    public void testEmptyTmfTraceIndexing() {
+        assertEquals("getCacheSize",   ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, fEmptyTrace.getCacheSize());
+        assertEquals("getTraceSize",   0,  fEmptyTrace.getNbEvents());
+        assertEquals("getRange-start", TmfTimestamp.BIG_BANG, fEmptyTrace.getTimeRange().getStartTime());
+        assertEquals("getRange-end",   TmfTimestamp.BIG_BANG, fEmptyTrace.getTimeRange().getEndTime());
+        assertEquals("getStartTime",   TmfTimestamp.BIG_BANG, fEmptyTrace.getStartTime());
+        assertEquals("getEndTime",     TmfTimestamp.BIG_BANG, fEmptyTrace.getEndTime());
+
+        List<ITmfCheckpoint> checkpoints = fEmptyTrace.getIndexer().getCheckpoints();
+        int pageSize = fEmptyTrace.getCacheSize();
+        assertTrue("Checkpoints exist",  checkpoints != null);
+        assertEquals("Checkpoints size", 0, checkpoints.size());
+
+        // Validate that each checkpoint points to the right event
+        for (int i = 0; i < checkpoints.size(); i++) {
+            ITmfCheckpoint checkpoint = checkpoints.get(i);
+            TmfContext context = new TmfContext(checkpoint.getLocation(), i * pageSize);
+            ITmfEvent event = fEmptyTrace.parseEvent(context);
+            assertTrue(context.getRank() == i * pageSize);
+            assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest2.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest2.java
new file mode 100644 (file)
index 0000000..2e5c2f6
--- /dev/null
@@ -0,0 +1,224 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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
+ *   Alexandre Montplaisir - Port to JUnit4
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.indexer.checkpoint;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+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.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.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfEmptyTraceStub;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test suite for the TmfCheckpointIndexer class (events with same
+ * timestamp around checkpoint).
+ */
+@SuppressWarnings("javadoc")
+public class TmfCheckpointIndexTest2 {
+
+    // ------------------------------------------------------------------------
+    // Variables
+    // ------------------------------------------------------------------------
+
+    private static final String    DIRECTORY   = "testfiles";
+    // Trace has 3 events at t=101 at rank 99, 100, 101
+    // Trace has events with same timestamp (ts=102) for ranks 102..702 -> 2 checkpoints with same timestamp are created
+    private static final String    TEST_STREAM = "A-Test-10K-2";
+    private static final int       BLOCK_SIZE  = 100;
+    private static final int       NB_EVENTS   = 702;
+    private static TestTrace       fTrace      = null;
+    private static EmptyTestTrace  fEmptyTrace = null;
+
+    // ------------------------------------------------------------------------
+    // Housekeeping
+    // ------------------------------------------------------------------------
+
+    @Before
+    public void setUp() {
+        setupTrace(DIRECTORY + File.separator + TEST_STREAM);
+    }
+
+    @After
+    public void tearDown() {
+        fTrace.dispose();
+        fTrace = null;
+        fEmptyTrace.dispose();
+        fEmptyTrace = null;
+    }
+
+    // ------------------------------------------------------------------------
+    // Helper classes
+    // ------------------------------------------------------------------------
+
+    private static class TestIndexer extends TmfCheckpointIndexer {
+        @SuppressWarnings({ })
+        public TestIndexer(TestTrace testTrace) {
+            super(testTrace, BLOCK_SIZE);
+        }
+        @SuppressWarnings({ })
+        public TestIndexer(EmptyTestTrace testTrace) {
+            super(testTrace, BLOCK_SIZE);
+        }
+        public List<ITmfCheckpoint> getCheckpoints() {
+            return getTraceIndex();
+        }
+    }
+
+    private class TestTrace extends TmfTraceStub {
+        public TestTrace(String path, int blockSize) throws TmfTraceException {
+            super(path, blockSize, false, null, null);
+            setIndexer(new TestIndexer(this));
+        }
+        @Override
+        public TestIndexer getIndexer() {
+            return (TestIndexer) super.getIndexer();
+        }
+    }
+
+    private class EmptyTestTrace extends TmfEmptyTraceStub {
+        public EmptyTestTrace() {
+            super();
+            setIndexer(new TestIndexer(this));
+        }
+        @Override
+        public TestIndexer getIndexer() {
+            return (TestIndexer) super.getIndexer();
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Helper functions
+    // ------------------------------------------------------------------------
+
+    private synchronized void setupTrace(final String path) {
+        if (fTrace == null) {
+            try {
+                final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
+                final File test = new File(FileLocator.toFileURL(location).toURI());
+                fTrace = new TestTrace(test.toURI().getPath(), BLOCK_SIZE);
+                fTrace.indexTrace(true);
+            } catch (final TmfTraceException e) {
+                e.printStackTrace();
+            } catch (final URISyntaxException e) {
+                e.printStackTrace();
+            } catch (final IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        if (fEmptyTrace == null) {
+            fEmptyTrace = new EmptyTestTrace();
+            fEmptyTrace.indexTrace(true);
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Verify checkpoints
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testTmfTraceMultiTimestamps() {
+        assertEquals("getCacheSize",   BLOCK_SIZE, fTrace.getCacheSize());
+        assertEquals("getTraceSize",   NB_EVENTS,  fTrace.getNbEvents());
+        assertEquals("getRange-start", 1,          fTrace.getTimeRange().getStartTime().getValue());
+        assertEquals("getRange-end",   102,        fTrace.getTimeRange().getEndTime().getValue());
+        assertEquals("getStartTime",   1,          fTrace.getStartTime().getValue());
+        assertEquals("getEndTime",     102,        fTrace.getEndTime().getValue());
+
+        List<ITmfCheckpoint> checkpoints = fTrace.getIndexer().getCheckpoints();
+        assertTrue("Checkpoints exist",  checkpoints != null);
+        assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE + 1, checkpoints.size());
+
+        // Trace has 3 events with same timestamp (ts=101) at rank 99, 100, 101
+
+        // Verify that the event at rank=99 is returned when seeking to ts=101 (first event with this timestamp)
+        // and not the event at checkpoint boundary
+        TmfTimestamp seekTs = new TmfTimestamp(101, -3, 0);
+        ITmfContext ctx = fTrace.seekEvent(seekTs);
+        ITmfEvent event = fTrace.getNext(ctx);
+
+        assertEquals(99, ctx.getRank());
+        assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
+
+        event = fTrace.getNext(ctx);
+
+        assertEquals(100, ctx.getRank());
+        assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
+
+        event = fTrace.getNext(ctx);
+
+        assertEquals(101, ctx.getRank());
+        assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
+
+        // Trace has events with same timestamp (ts=102) for ranks 102..702 -> 2 checkpoints with same timestamp are created
+        // Verify that the event at rank=102 is returned when seeking to ts=102 (first event with this timestamp)
+        // and not the event at checkpoint boundary
+        seekTs = new TmfTimestamp(102, -3, 0);
+        ctx = fTrace.seekEvent(seekTs);
+        event = fTrace.getNext(ctx);
+
+        assertEquals(102, ctx.getRank());
+        assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
+
+        // Verify seek to first checkpoint
+        seekTs = new TmfTimestamp(1, -3, 0);
+        ctx = fTrace.seekEvent(seekTs);
+        event = fTrace.getNext(ctx);
+
+        assertEquals(1, ctx.getRank());
+        assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
+
+        // Verify seek to timestamp before first event
+        seekTs = new TmfTimestamp(0, -3, 0);
+        ctx = fTrace.seekEvent(seekTs);
+        event = fTrace.getNext(ctx);
+
+        assertEquals(1, ctx.getRank());
+        assertEquals(0, new TmfTimestamp(1, -3, 0).compareTo(event.getTimestamp(), false));
+
+        // Verify seek to timestamp between first and second checkpoint
+        seekTs = new TmfTimestamp(50, -3, 0);
+        ctx = fTrace.seekEvent(seekTs);
+        event = fTrace.getNext(ctx);
+
+        assertEquals(50, ctx.getRank());
+        assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
+
+        // Verify seek to timestamp after last event in trace
+        seekTs = new TmfTimestamp(103, -3, 0);
+        ctx = fTrace.seekEvent(seekTs);
+        event = fTrace.getNext(ctx);
+
+        assertEquals(-1, ctx.getRank());
+        assertNull(event);
+    }
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointTest.java
new file mode 100644 (file)
index 0000000..cb0871c
--- /dev/null
@@ -0,0 +1,239 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 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 - Adapted for TMF Trace Model 1.0
+ *   Alexandre Montplaisir - Port to JUnit4
+ *   Patrick Tasse - Updated for location in checkpoint
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.indexer.checkpoint;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpoint;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
+import org.junit.Test;
+
+/**
+ * Test suite for the TmfCheckpoint class.
+ */
+@SuppressWarnings("javadoc")
+public class TmfCheckpointTest {
+
+    // ------------------------------------------------------------------------
+    // Variables
+    // ------------------------------------------------------------------------
+
+    private ITmfTimestamp fTimestamp1 = new TmfTimestamp();
+    private ITmfTimestamp fTimestamp2 = TmfTimestamp.BIG_BANG;
+    private ITmfTimestamp fTimestamp3 = TmfTimestamp.BIG_CRUNCH;
+
+    private Long aLong1 = 12345L;
+    private Long aLong2 = 23456L;
+    private Long aLong3 = 34567L;
+    private ITmfLocation fLocation1 = new TmfLongLocation(aLong1);
+    private ITmfLocation fLocation2 = new TmfLongLocation(aLong2);
+    private ITmfLocation fLocation3 = new TmfLongLocation(aLong3);
+
+    private TmfCheckpoint fCheckpoint1 = new TmfCheckpoint(fTimestamp1, fLocation1);
+    private TmfCheckpoint fCheckpoint2 = new TmfCheckpoint(fTimestamp2, fLocation2);
+    private TmfCheckpoint fCheckpoint3 = new TmfCheckpoint(fTimestamp3, fLocation3);
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testTmfCheckpoint() {
+        assertEquals("TmfCheckpoint", fTimestamp1, fCheckpoint1.getTimestamp());
+        assertEquals("TmfCheckpoint", fLocation1,  fCheckpoint1.getLocation());
+    }
+
+    public void testTmfLocationCopy() {
+        final TmfCheckpoint checkpoint = new TmfCheckpoint(fCheckpoint1);
+
+        assertEquals("TmfCheckpoint", fTimestamp1, checkpoint.getTimestamp());
+        assertEquals("TmfCheckpoint", fLocation1,  checkpoint.getLocation());
+    }
+
+    @Test
+    public void testTmfLocationCopy2() {
+        try {
+            new TmfCheckpoint(null);
+            fail("null copy");
+        }
+        catch (final IllegalArgumentException e) {
+            // Success
+        }
+        catch (final Exception e) {
+            fail("wrong exception");
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // compareTo
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testCompareTo() {
+        assertEquals("compareTo",  0, fCheckpoint1.compareTo(fCheckpoint1));
+        assertEquals("compareTo",  1, fCheckpoint1.compareTo(fCheckpoint2));
+        assertEquals("compareTo", -1, fCheckpoint1.compareTo(fCheckpoint3));
+
+        assertEquals("compareTo", -1, fCheckpoint2.compareTo(fCheckpoint1));
+        assertEquals("compareTo",  0, fCheckpoint2.compareTo(fCheckpoint2));
+        assertEquals("compareTo", -1, fCheckpoint2.compareTo(fCheckpoint3));
+
+        assertEquals("compareTo",  1, fCheckpoint3.compareTo(fCheckpoint1));
+        assertEquals("compareTo",  1, fCheckpoint3.compareTo(fCheckpoint2));
+        assertEquals("compareTo",  0, fCheckpoint3.compareTo(fCheckpoint3));
+    }
+
+    @Test
+    public void testCompareToNull() {
+        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, fLocation1);
+        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(null, fLocation2);
+        final TmfCheckpoint checkpoint3 = new TmfCheckpoint(null, fLocation3);
+        final TmfCheckpoint checkpoint4 = new TmfCheckpoint(null, fLocation1);
+
+        // Test the various 'null' vs. '!null' combinations
+        assertEquals("compareTo",  0, checkpoint1.compareTo(fCheckpoint1));
+        assertEquals("compareTo",  0, fCheckpoint1.compareTo(checkpoint1));
+        assertEquals("compareTo", -1, checkpoint1.compareTo(fCheckpoint2));
+        assertEquals("compareTo",  1, fCheckpoint2.compareTo(checkpoint1));
+        assertEquals("compareTo", -1, checkpoint1.compareTo(fCheckpoint3));
+        assertEquals("compareTo",  1, fCheckpoint3.compareTo(checkpoint1));
+
+        // Test the 'null' vs. 'null' combinations
+        assertEquals("compareTo",  0, checkpoint1.compareTo(checkpoint4));
+        assertEquals("compareTo",  0, checkpoint4.compareTo(checkpoint1));
+        assertEquals("compareTo", -1, checkpoint1.compareTo(checkpoint2));
+        assertEquals("compareTo",  1, checkpoint2.compareTo(checkpoint1));
+        assertEquals("compareTo", -1, checkpoint1.compareTo(checkpoint3));
+        assertEquals("compareTo",  1, checkpoint3.compareTo(checkpoint1));
+    }
+
+    // ------------------------------------------------------------------------
+    // hashCode
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testHashCode() {
+        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
+        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fCheckpoint2);
+
+        assertTrue("hashCode", fCheckpoint1.hashCode() == checkpoint1.hashCode());
+        assertTrue("hashCode", fCheckpoint2.hashCode() == checkpoint2.hashCode());
+
+        assertTrue("hashCode", fCheckpoint1.hashCode() != checkpoint2.hashCode());
+        assertTrue("hashCode", fCheckpoint2.hashCode() != checkpoint1.hashCode());
+    }
+
+    @Test
+    public void testHashCodeNull() {
+        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, fLocation1);
+        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp1, null);
+        final TmfCheckpoint checkpoint3 = new TmfCheckpoint(checkpoint1);
+        final TmfCheckpoint checkpoint4 = new TmfCheckpoint(checkpoint2);
+
+        assertTrue("hashCode", fCheckpoint1.hashCode() != checkpoint1.hashCode());
+        assertTrue("hashCode", fCheckpoint1.hashCode() != checkpoint2.hashCode());
+
+        assertTrue("hashCode", checkpoint1.hashCode() == checkpoint3.hashCode());
+        assertTrue("hashCode", checkpoint2.hashCode() == checkpoint4.hashCode());
+    }
+
+    // ------------------------------------------------------------------------
+    // equals
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testEqualsReflexivity() {
+        assertTrue("equals", fCheckpoint1.equals(fCheckpoint1));
+        assertTrue("equals", fCheckpoint2.equals(fCheckpoint2));
+
+        assertTrue("equals", !fCheckpoint1.equals(fCheckpoint2));
+        assertTrue("equals", !fCheckpoint2.equals(fCheckpoint1));
+    }
+
+    @Test
+    public void testEqualsSymmetry() {
+        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
+        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fCheckpoint2);
+
+        assertTrue("equals", checkpoint1.equals(fCheckpoint1));
+        assertTrue("equals", fCheckpoint1.equals(checkpoint1));
+
+        assertTrue("equals", checkpoint2.equals(fCheckpoint2));
+        assertTrue("equals", fCheckpoint2.equals(checkpoint2));
+    }
+
+    @Test
+    public void testEqualsTransivity() {
+        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
+        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(checkpoint1);
+        final TmfCheckpoint checkpoint3 = new TmfCheckpoint(checkpoint2);
+
+        assertTrue("equals", checkpoint1.equals(checkpoint2));
+        assertTrue("equals", checkpoint2.equals(checkpoint3));
+        assertTrue("equals", checkpoint1.equals(checkpoint3));
+    }
+
+    @Test
+    public void testNotEqual() {
+        // Various checkpoints
+        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fTimestamp1, fLocation1);
+        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp2, fLocation1);
+        final TmfCheckpoint checkpoint3 = new TmfCheckpoint(fTimestamp1, fLocation2);
+        final TmfCheckpoint checkpoint4 = new TmfCheckpoint(fTimestamp1, null);
+        final TmfCheckpoint checkpoint5 = new TmfCheckpoint(null, fLocation1);
+
+        // Null check
+        assertFalse("equals", checkpoint1.equals(null));
+
+        // Different types
+        assertFalse("equals", checkpoint1.equals(new TmfTimestamp()));
+
+        // Null locations/location
+        assertFalse("equals", checkpoint1.equals(checkpoint4));
+        assertFalse("equals", checkpoint1.equals(checkpoint5));
+        assertFalse("equals", checkpoint4.equals(checkpoint1));
+        assertFalse("equals", checkpoint5.equals(checkpoint1));
+
+        // Different locations/location
+        assertFalse("equals", checkpoint1.equals(checkpoint2));
+        assertFalse("equals", checkpoint1.equals(checkpoint3));
+    }
+
+    // ------------------------------------------------------------------------
+    // toString
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testToString() {
+        final String expected1 = "TmfCheckpoint [fLocation=" + fCheckpoint1.getLocation() +
+                ", fTimestamp=" + fCheckpoint1.getTimestamp() + "]";
+        final String expected2 = "TmfCheckpoint [fLocation=" + fCheckpoint2.getLocation() +
+                ", fTimestamp=" + fCheckpoint2.getTimestamp() + "]";
+        final String expected3 = "TmfCheckpoint [fLocation=" + fCheckpoint3.getLocation() +
+                ", fTimestamp=" + fCheckpoint3.getTimestamp() + "]";
+
+        assertEquals("toString", expected1, fCheckpoint1.toString());
+        assertEquals("toString", expected2, fCheckpoint2.toString());
+        assertEquals("toString", expected3, fCheckpoint3.toString());
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfExperimentCheckpointIndexTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfExperimentCheckpointIndexTest.java
new file mode 100644 (file)
index 0000000..e02aa7e
--- /dev/null
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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
+ *   Alexandre Montplaisir - Port to JUnit4
+ *   Patrick Tasse - Updated for ranks in experiment location
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.indexer.checkpoint;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+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.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.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfExperimentStub;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test suite for the TmfCheckpointIndexTest class.
+ */
+@SuppressWarnings("javadoc")
+public class TmfExperimentCheckpointIndexTest {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private static final String DIRECTORY    = "testfiles";
+    private static final String TEST_STREAM1 = "O-Test-10K";
+    private static final String TEST_STREAM2 = "E-Test-10K";
+    private static final String EXPERIMENT   = "MyExperiment";
+    private static int          NB_EVENTS    = 20000;
+    private static int          BLOCK_SIZE   = 1000;
+
+    private static ITmfTrace[] fTestTraces;
+    private static TmfExperimentStub fExperiment;
+
+    // ------------------------------------------------------------------------
+    // Housekeeping
+    // ------------------------------------------------------------------------
+
+    @Before
+    public void setUp() {
+        setupTraces();
+        fExperiment = new TmfExperimentStub(EXPERIMENT, fTestTraces, BLOCK_SIZE);
+        fExperiment.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, true);
+    }
+
+    @After
+    public void tearDown() {
+        fExperiment.dispose();
+        fExperiment = null;
+        for (ITmfTrace trace : fTestTraces) {
+            trace.dispose();
+        }
+        fTestTraces = null;
+    }
+
+    private static void setupTraces() {
+        final String path1 = DIRECTORY + File.separator + TEST_STREAM1;
+        final String path2 = DIRECTORY + File.separator + TEST_STREAM2;
+
+        fTestTraces = new ITmfTrace[2];
+        try {
+            URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path1), null);
+            File test = new File(FileLocator.toFileURL(location).toURI());
+            final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true, null, null);
+            fTestTraces[0] = trace1;
+            location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path2), null);
+            test = new File(FileLocator.toFileURL(location).toURI());
+            final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true, null, null);
+            fTestTraces[1] = trace2;
+        } catch (final TmfTraceException e) {
+            e.printStackTrace();
+        } catch (final URISyntaxException e) {
+            e.printStackTrace();
+        } catch (final IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Verify checkpoints
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testTmfTraceIndexing() {
+        assertEquals("getCacheSize",   BLOCK_SIZE, fExperiment.getCacheSize());
+        assertEquals("getTraceSize",   NB_EVENTS,  fExperiment.getNbEvents());
+        assertEquals("getRange-start", 1,          fExperiment.getTimeRange().getStartTime().getValue());
+        assertEquals("getRange-end",   NB_EVENTS,  fExperiment.getTimeRange().getEndTime().getValue());
+        assertEquals("getStartTime",   1,          fExperiment.getStartTime().getValue());
+        assertEquals("getEndTime",     NB_EVENTS,  fExperiment.getEndTime().getValue());
+
+        List<ITmfCheckpoint> checkpoints = fExperiment.getIndexer().getCheckpoints();
+        int pageSize = fExperiment.getCacheSize();
+        assertTrue("Checkpoints exist",  checkpoints != null);
+        assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
+
+        // Validate that each checkpoint points to the right event
+        for (int i = 0; i < checkpoints.size(); i++) {
+            ITmfCheckpoint checkpoint = checkpoints.get(i);
+            ITmfLocation location = checkpoint.getLocation();
+            ITmfContext context = fExperiment.seekEvent(location);
+            ITmfEvent event = fExperiment.parseEvent(context);
+            assertTrue(context.getRank() == i * pageSize);
+            assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Streaming
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testGrowingIndex() {
+        ITmfTrace[] testTraces = new TmfTraceStub[2];
+        try {
+            URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM1), null);
+            File test = new File(FileLocator.toFileURL(location).toURI());
+            final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, false, null, null);
+            testTraces[0] = trace1;
+            location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM2), null);
+            test = new File(FileLocator.toFileURL(location).toURI());
+            final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, false, null, null);
+            testTraces[1] = trace2;
+        } catch (final TmfTraceException e) {
+            e.printStackTrace();
+        } catch (final URISyntaxException e) {
+            e.printStackTrace();
+        } catch (final IOException e) {
+            e.printStackTrace();
+        }
+
+        TmfExperimentStub experiment = new TmfExperimentStub(EXPERIMENT, testTraces, BLOCK_SIZE);
+        int pageSize = experiment.getCacheSize();
+
+        // Build the first half of the index
+        TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(1, -3), new TmfTimestamp(NB_EVENTS / 2 - 1, -3));
+        experiment.getIndexer().buildIndex(0, range, true);
+
+        // Validate that each checkpoint points to the right event
+        List<ITmfCheckpoint> checkpoints = experiment.getIndexer().getCheckpoints();
+        assertTrue("Checkpoints exist",  checkpoints != null);
+        assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE / 2, checkpoints.size());
+
+        // Build the second half of the index
+        experiment.getIndexer().buildIndex(NB_EVENTS / 2, TmfTimeRange.ETERNITY, true);
+
+        // Validate that each checkpoint points to the right event
+        assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
+        for (int i = 0; i < checkpoints.size(); i++) {
+            ITmfCheckpoint checkpoint = checkpoints.get(i);
+            ITmfLocation location = checkpoint.getLocation();
+            ITmfContext context = experiment.seekEvent(location);
+            ITmfEvent event = experiment.parseEvent(context);
+            assertTrue(context.getRank() == i * pageSize);
+            assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
+            assertEquals("Checkpoint value", i * pageSize + 1, checkpoint.getTimestamp().getValue());
+        }
+
+        /* Clean up (since we didn't use the class-specific fixtures) */
+        experiment.dispose();
+        for (ITmfTrace trace : testTraces) {
+            trace.dispose();
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/location/AllTests.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/location/AllTests.java
new file mode 100644 (file)
index 0000000..3593f4c
--- /dev/null
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 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 - Adjusted for new Trace Model
+ *   Alexandre Montplaisir - Port to JUnit4
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.location;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for org.eclipse.linuxtools.tmf.core.trace.location
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TmfLocationTest.class,
+})
+public class AllTests {}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/location/TmfLocationTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/location/TmfLocationTest.java
new file mode 100644 (file)
index 0000000..a7c51d1
--- /dev/null
@@ -0,0 +1,248 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 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
+ *   Alexandre Montplaisir - Port to JUnit4
+ *   Patrick Tasse - Add tests for TmfExperimentLocation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.location;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentLocation;
+import org.eclipse.linuxtools.internal.tmf.core.trace.TmfLocationArray;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfTimestampLocation;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test suite for the TmfLocation class.
+ */
+@SuppressWarnings("javadoc")
+public class TmfLocationTest {
+
+    // ------------------------------------------------------------------------
+    // Variables
+    // ------------------------------------------------------------------------
+
+    private String aString = "some location";
+    private Long aLong = 12345L;
+    private TmfTimestamp aTimestamp = new TmfTimestamp();
+    private TmfLocationArray aLocationArray;
+
+    private TmfStringLocation fLocation1;
+    private TmfStringLocation fLocation2;
+    private TmfLongLocation fLocation3;
+    private TmfTimestampLocation fLocation4;
+    private TmfExperimentLocation fExpLocation;
+
+    // ------------------------------------------------------------------------
+    // Housekeeping
+    // ------------------------------------------------------------------------
+
+    @Before
+    public void setUp() {
+        fLocation1 = new TmfStringLocation((String) null);
+        fLocation2 = new TmfStringLocation(aString);
+        fLocation3 = new TmfLongLocation(aLong);
+        fLocation4 = new TmfTimestampLocation(aTimestamp);
+        aLocationArray = new TmfLocationArray(
+                new ITmfLocation[] { fLocation1, fLocation2, fLocation3, fLocation4 },
+                new long[] { 1, 2, 3, 4 }
+                );
+        fExpLocation = new TmfExperimentLocation(aLocationArray);
+    }
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testTmfLocation() {
+        assertNull("TmfLocation", fLocation1.getLocationInfo());
+        assertEquals("TmfLocation", aString, fLocation2.getLocationInfo());
+        assertEquals("TmfLocation", aLong, fLocation3.getLocationInfo());
+        assertEquals("TmfLocation", aTimestamp, fLocation4.getLocationInfo());
+        assertEquals("TmfLocation", aLocationArray, fExpLocation.getLocationInfo());
+    }
+
+    @Test
+    public void testTmfLocationCopy() {
+        TmfStringLocation location1 = new TmfStringLocation(fLocation1);
+        TmfStringLocation location2 = new TmfStringLocation(fLocation2);
+        TmfLongLocation location3 = new TmfLongLocation(fLocation3);
+        TmfTimestampLocation location4 = new TmfTimestampLocation(fLocation4);
+        TmfExperimentLocation expLocation = new TmfExperimentLocation(fExpLocation);
+
+        assertNull("TmfLocation", location1.getLocationInfo());
+        assertEquals("TmfLocation", aString, location2.getLocationInfo());
+        assertEquals("TmfLocation", aLong, location3.getLocationInfo());
+        assertEquals("TmfLocation", aTimestamp, location4.getLocationInfo());
+        assertEquals("TmfLocation", aLocationArray, expLocation.getLocationInfo());
+    }
+
+    // ------------------------------------------------------------------------
+    // hashCode
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testHashCode() {
+        TmfStringLocation location1 = new TmfStringLocation((String) null);
+        TmfStringLocation location2 = new TmfStringLocation(aString);
+        TmfLongLocation location3 = new TmfLongLocation(aLong);
+        TmfExperimentLocation expLocation = new TmfExperimentLocation(fExpLocation);
+        TmfLocationArray locationArray1 = new TmfLocationArray(aLocationArray, 3, fLocation4, 5);
+        TmfExperimentLocation expLocation1 = new TmfExperimentLocation(locationArray1);
+        TmfLocationArray locationArray2 = new TmfLocationArray(aLocationArray, 3, fLocation3, 4);
+        TmfExperimentLocation expLocation2 = new TmfExperimentLocation(locationArray2);
+        TmfLocationArray locationArray3 = new TmfLocationArray(
+                new ITmfLocation[] { fLocation1, fLocation2, fLocation3 },
+                new long[] { 1, 2, 3 }
+                );
+        TmfExperimentLocation expLocation3 = new TmfExperimentLocation(locationArray3);
+
+        assertTrue("hashCode", fLocation1.hashCode() == location1.hashCode());
+        assertTrue("hashCode", fLocation2.hashCode() == location2.hashCode());
+        assertTrue("hashCode", fLocation3.hashCode() == location3.hashCode());
+        assertTrue("hashCode", fExpLocation.hashCode() == expLocation.hashCode());
+
+        assertTrue("hashCode", fLocation2.hashCode() != location3.hashCode());
+        assertTrue("hashCode", fLocation3.hashCode() != location2.hashCode());
+        assertTrue("hashCode", fExpLocation.hashCode() != expLocation1.hashCode());
+        assertTrue("hashCode", fExpLocation.hashCode() != expLocation2.hashCode());
+        assertTrue("hashCode", fExpLocation.hashCode() != expLocation3.hashCode());
+    }
+
+    // ------------------------------------------------------------------------
+    // toEquals
+    // ------------------------------------------------------------------------
+
+    private static class TmfLocation2 extends TmfStringLocation {
+        public TmfLocation2(String location) {
+            super(location);
+        }
+    }
+
+    @Test
+    public void testEqualsWrongTypes() {
+        ITmfLocation location1 = new TmfStringLocation(aString);
+        TmfLocation2 location2 = new TmfLocation2(aString);
+
+        assertFalse("equals", location1.equals(location2));
+        assertFalse("equals", location2.equals(location1));
+    }
+
+    @Test
+    public void testEqualsWithNulls() {
+        TmfStringLocation location1 = new TmfStringLocation(aString);
+        TmfStringLocation location2 = new TmfStringLocation((String) null);
+
+        assertFalse("equals", location1.equals(location2));
+        assertFalse("equals", location2.equals(location1));
+    }
+
+    @Test
+    public void testEqualsReflexivity() {
+        assertTrue("equals", fLocation2.equals(fLocation2));
+        assertTrue("equals", fLocation3.equals(fLocation3));
+        assertTrue("equals", fExpLocation.equals(fExpLocation));
+
+        assertTrue("equals", !fLocation2.equals(fLocation3));
+        assertTrue("equals", !fLocation3.equals(fLocation2));
+        TmfLocationArray locationArray1 = new TmfLocationArray(aLocationArray, 3, fLocation4, 5);
+        TmfExperimentLocation expLocation1 = new TmfExperimentLocation(locationArray1);
+        TmfLocationArray locationArray2 = new TmfLocationArray(aLocationArray, 3, fLocation3, 4);
+        TmfExperimentLocation expLocation2 = new TmfExperimentLocation(locationArray2);
+        TmfLocationArray locationArray3 = new TmfLocationArray(
+                new ITmfLocation[] { fLocation1, fLocation2, fLocation3 },
+                new long[] { 1, 2, 3 }
+                );
+        TmfExperimentLocation expLocation3 = new TmfExperimentLocation(locationArray3);
+        assertTrue("equals", !fExpLocation.equals(expLocation1));
+        assertTrue("equals", !expLocation1.equals(fExpLocation));
+        assertTrue("equals", !fExpLocation.equals(expLocation2));
+        assertTrue("equals", !expLocation2.equals(fExpLocation));
+        assertTrue("equals", !fExpLocation.equals(expLocation3));
+        assertTrue("equals", !expLocation3.equals(fExpLocation));
+    }
+
+    @Test
+    public void testEqualsSymmetry() {
+        TmfStringLocation location2 = new TmfStringLocation(aString);
+        TmfLongLocation location3 = new TmfLongLocation(aLong);
+        TmfExperimentLocation expLocation = new TmfExperimentLocation(fExpLocation);
+
+        assertTrue("equals", location2.equals(fLocation2));
+        assertTrue("equals", fLocation2.equals(location2));
+
+        assertTrue("equals", location3.equals(fLocation3));
+        assertTrue("equals", fLocation3.equals(location3));
+
+        assertTrue("equals", expLocation.equals(fExpLocation));
+        assertTrue("equals", fExpLocation.equals(expLocation));
+    }
+
+    @Test
+    public void testEqualsTransivity() {
+        TmfStringLocation location1 = new TmfStringLocation(aString);
+        TmfStringLocation location2 = new TmfStringLocation(aString);
+        TmfStringLocation location3 = new TmfStringLocation(aString);
+        TmfExperimentLocation expLocation1 = new TmfExperimentLocation(aLocationArray);
+        TmfExperimentLocation expLocation2 = new TmfExperimentLocation(aLocationArray);
+        TmfExperimentLocation expLocation3 = new TmfExperimentLocation(aLocationArray);
+
+        assertTrue("equals", location1.equals(location2));
+        assertTrue("equals", location2.equals(location3));
+        assertTrue("equals", location3.equals(location1));
+        assertTrue("equals", expLocation1.equals(expLocation2));
+        assertTrue("equals", expLocation2.equals(expLocation3));
+        assertTrue("equals", expLocation3.equals(expLocation1));
+    }
+
+    @Test
+    public void testEqualsNull() {
+        assertTrue("equals", !fLocation2.equals(null));
+        assertTrue("equals", !fLocation2.equals(null));
+        assertTrue("equals", !fExpLocation.equals(null));
+    }
+
+    // ------------------------------------------------------------------------
+    // toString
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testToString() {
+        String str = "some location";
+        Long lng = 12345L;
+        TmfTimestamp ts = new TmfTimestamp();
+
+        TmfStringLocation location1 = new TmfStringLocation(str);
+        TmfLongLocation location2 = new TmfLongLocation(lng);
+        TmfTimestampLocation location3 = new TmfTimestampLocation(ts);
+        TmfExperimentLocation expLocation = new TmfExperimentLocation(aLocationArray);
+
+        String expected1 = "TmfStringLocation [fLocationInfo=" + str + "]";
+        String expected2 = "TmfLongLocation [fLocationInfo=" + lng + "]";
+        String expected3 = "TmfTimestampLocation [fLocationInfo=" + ts + "]";
+        String expected4 = "TmfExperimentLocation [" + aLocationArray + "]";
+
+        assertEquals("toString", expected1, location1.toString());
+        assertEquals("toString", expected2, location2.toString());
+        assertEquals("toString", expected3, location3.toString());
+        assertEquals("toString", expected4, expLocation.toString());
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/location/TmfStringLocation.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/location/TmfStringLocation.java
new file mode 100644 (file)
index 0000000..fad258f
--- /dev/null
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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.tests.trace.location;
+
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLocation;
+
+/**
+ * <b><u>TmfStringLocation</u></b>
+ * <p>
+ * Implement me. Please.
+ * <p>
+ */
+public class TmfStringLocation extends TmfLocation {
+
+    /**
+     * @param location the concrete trace location
+     */
+    public TmfStringLocation(String location) {
+        super(location);
+    }
+
+    /**
+     * @param other the other location
+     */
+    public TmfStringLocation(TmfStringLocation other) {
+        super(other.getLocationInfo());
+    }
+
+    @Override
+    public String getLocationInfo() {
+        return (String) super.getLocationInfo();
+    }
+
+}
index db9304c146f8a6f5d1140c87da148096be49d7b6..bb264f5e2e6244f36c2b3da4ec668d366e7b2ea0 100644 (file)
@@ -46,7 +46,7 @@ public class TmfDataProviderStub extends TmfDataProvider {
         final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
         try {
             final File test = new File(FileLocator.toFileURL(location).toURI());
-            fTrace = new TmfTraceStub(test.getPath(), 0, true);
+            fTrace = new TmfTraceStub(test.getPath(), 0, true, null, null);
         } catch (final TmfTraceException e) {
             e.printStackTrace();
         } catch (final URISyntaxException e) {
index bbcee8a8a94bdeb0a3d877ec07d02a9db893235b..2728caf1bb90e69b0c4d305218095afdf556c372 100644 (file)
@@ -46,7 +46,7 @@ public class TmfEventProviderStub extends TmfEventProvider {
         final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
         try {
             final File test = new File(FileLocator.toFileURL(location).toURI());
-            fTrace = new TmfTraceStub(test.getPath(), 0, true);
+            fTrace = new TmfTraceStub(test.getPath(), 0, true, null, null);
         } catch (final TmfTraceException e) {
             e.printStackTrace();
         } catch (final URISyntaxException e) {
index d6d6081b8afcfa96bed3f3763d4c212cbc7108aa..524d5127375111e812a903ba11769bbdac7bf181 100644 (file)
@@ -21,6 +21,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 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.request.ITmfDataRequest.ExecutionType;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
@@ -34,7 +35,6 @@ import org.eclipse.linuxtools.tmf.tests.stubs.event.TmfSyntheticEventStub;
 @SuppressWarnings("javadoc")
 public class TmfSyntheticEventProviderStub extends TmfEventProvider {
 
-    public static final int BLOCK_SIZE = 100;
     public static final int NB_EVENTS  = 1000;
 
     public TmfSyntheticEventProviderStub() {
@@ -57,7 +57,7 @@ public class TmfSyntheticEventProviderStub extends TmfEventProvider {
         final TmfEventRequest eventRequest = (TmfEventRequest) request;
         final TmfTimeRange range = eventRequest.getRange();
         final TmfEventRequest subRequest =
-                new TmfEventRequest(ITmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+                new TmfEventRequest(ITmfEvent.class, range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
             @Override
             public void handleData(final ITmfEvent event) {
                 super.handleData(event);
diff --git a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/event/TmfSyncEventStub.java b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/event/TmfSyncEventStub.java
new file mode 100644 (file)
index 0000000..b8a0166
--- /dev/null
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.tests.stubs.event;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * Event stub used by the synchronization tests
+ *
+ * @author Geneviève Bastien
+ */
+public class TmfSyncEventStub extends TmfEvent {
+
+    private static final String stub = "stub"; //$NON-NLS-1$
+
+    /**
+     * Constructor
+     *
+     * @param trace
+     *            The trace of this event
+     * @param timestamp
+     *            The timestamp
+     */
+    public TmfSyncEventStub(final ITmfTrace trace, final ITmfTimestamp timestamp) {
+        super(trace,
+                timestamp,
+                stub,
+                new TmfEventTypeStub(),
+                new TmfEventField(stub, stub, null),
+                stub);
+    }
+}
index c15798fbe41130884cfcc716954eeaebec529929..e36dd2c939b8b10b2218c0ee7cc4edaa7d98a7b0 100644 (file)
@@ -26,7 +26,7 @@ public class TmfDataRequestStub extends TmfDataRequest {
      * @param dataType the request data type
      */
     public TmfDataRequestStub(final Class<? extends ITmfEvent> dataType) {
-        super(dataType);
+        super(dataType, 0, ALL_DATA, ExecutionType.FOREGROUND);
     }
 
     /**
@@ -34,7 +34,7 @@ public class TmfDataRequestStub extends TmfDataRequest {
      * @param index the initial event index
      */
     public TmfDataRequestStub(final Class<? extends ITmfEvent> dataType, final int index) {
-        super(dataType, index);
+        super(dataType, index, ALL_DATA, ExecutionType.FOREGROUND);
     }
 
     /**
@@ -42,18 +42,9 @@ public class TmfDataRequestStub extends TmfDataRequest {
      * @param index the initial event index
      * @param nbRequested the number of events requested
      */
-    public TmfDataRequestStub(final Class<? extends ITmfEvent> dataType, final int index, final int nbRequested) {
-        super(dataType, index, nbRequested);
-    }
-
-    /**
-     * @param dataType the request data type
-     * @param index the initial event index
-     * @param nbRequested the number of events requested
-     * @param blockSize the event block size
-     */
-    public TmfDataRequestStub(final Class<? extends ITmfEvent> dataType, final int index, final int nbRequested, final int blockSize) {
-        super(dataType, index, nbRequested, blockSize);
+    public TmfDataRequestStub(final Class<? extends ITmfEvent> dataType,
+            final int index, final int nbRequested) {
+        super(dataType, index, nbRequested, ExecutionType.FOREGROUND);
     }
 
     @Override
index 25e94223eee3a6c47f3b5d59cf2256932097f70b..eb1d741f3e0a871c6c8f84a00d62384a49e21be6 100644 (file)
@@ -25,7 +25,7 @@ public class TmfEventRequestStub extends TmfEventRequest {
      * @param dataType the event type
      */
     public TmfEventRequestStub(final Class<? extends ITmfEvent> dataType) {
-        super(dataType);
+        super(dataType, TmfTimeRange.ETERNITY, 0, ALL_DATA, ExecutionType.FOREGROUND);
     }
 
     /**
@@ -33,7 +33,7 @@ public class TmfEventRequestStub extends TmfEventRequest {
      * @param range the requested time range
      */
     public TmfEventRequestStub(final Class<? extends ITmfEvent> dataType, final TmfTimeRange range) {
-        super(dataType, range);
+        super(dataType, range, 0, ALL_DATA, ExecutionType.FOREGROUND);
     }
 
     /**
@@ -42,7 +42,7 @@ public class TmfEventRequestStub extends TmfEventRequest {
      * @param nbRequested the number of events requested
      */
     public TmfEventRequestStub(final Class<? extends ITmfEvent> dataType, final TmfTimeRange range, final int nbRequested) {
-        super(dataType, range, nbRequested);
+        super(dataType, range, 0, nbRequested, ExecutionType.FOREGROUND);
     }
 
     /**
@@ -52,7 +52,7 @@ public class TmfEventRequestStub extends TmfEventRequest {
      * @param blockSize the event block size
      */
     public TmfEventRequestStub(final Class<? extends ITmfEvent> dataType, final TmfTimeRange range, final int nbRequested, final int blockSize) {
-        super(dataType, range, nbRequested, blockSize);
+        super(dataType, range, 0, nbRequested, ExecutionType.FOREGROUND);
     }
 
     /**
@@ -63,7 +63,7 @@ public class TmfEventRequestStub extends TmfEventRequest {
      * @param blockSize the event block size
      */
     public TmfEventRequestStub(final Class<? extends ITmfEvent> dataType, final TmfTimeRange range, final long index, final int nbRequested, final int blockSize) {
-        super(dataType, range, index, nbRequested, blockSize);
+        super(dataType, range, index, nbRequested, ExecutionType.FOREGROUND);
     }
 
     @Override
index 9c9e3210716a0134f2641e74ee68958cebda1671..3a5df51e0634ba7a58190b5c724417aa092cc4d5 100644 (file)
@@ -14,8 +14,8 @@ package org.eclipse.linuxtools.tmf.tests.stubs.trace;
 
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 
 /**
  * <b><u>TmfEmptyTraceStub</u></b>
index 1812d938f3f4efdc7613f2f883284ea89beed7da..a633f36b0a3c97544c485310d95af631164e2a82 100644 (file)
@@ -14,9 +14,9 @@ package org.eclipse.linuxtools.tmf.tests.stubs.trace;
 
 import java.util.List;
 
-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.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
 
 /**
  * <b><u>TmfIndexerStub</u></b>
index bac3cf0e5469a3a0d907beba24fa131bfbcf974b..8eadfd7266143002b390a6e1bbb575dac5bc9bdf 100644 (file)
@@ -29,19 +29,17 @@ 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;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceIndexer;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
 
 /**
  * <b><u>TmfTraceStub</u></b>
  * <p>
  * Dummy test trace. Use in conjunction with TmfEventParserStub.
  */
-@SuppressWarnings("javadoc")
 public class TmfTraceStub extends TmfTrace implements ITmfEventParser {
 
     // ------------------------------------------------------------------------
@@ -63,126 +61,92 @@ public class TmfTraceStub extends TmfTrace implements ITmfEventParser {
     // Constructors
     // ------------------------------------------------------------------------
 
+    /**
+     * Default constructor
+     */
     public TmfTraceStub() {
         super();
         setParser(new TmfEventParserStub(this));
     }
 
     /**
+     * Constructor with which you can specify a custom streaming interval. The
+     * parser and indexer won't be specified.
+     *
      * @param path
-     * @throws FileNotFoundException
-     */
-    public TmfTraceStub(final String path) throws TmfTraceException {
-        this(path, ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false);
-    }
-
-    /**
-     * @param path
+     *            The path to the trace file
      * @param cacheSize
-     * @throws FileNotFoundException
+     *            The cache size
+     * @param interval
+     *            The trace streaming interval
+     * @throws TmfTraceException
+     *             If an error occurred opening the trace
      */
-    public TmfTraceStub(final String path, final int cacheSize) throws TmfTraceException {
-        this(path, cacheSize, false);
-    }
-
-    /**
-     * @param path
-     * @param cacheSize
-     * @throws FileNotFoundException
-     */
-    public TmfTraceStub(final String path, final int cacheSize, final long interval) throws TmfTraceException {
+    public TmfTraceStub(final String path,
+            final int cacheSize,
+            final long interval) throws TmfTraceException {
         super(null, ITmfEvent.class, path, cacheSize, interval, null, null);
-        try {
-            fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
-        } catch (FileNotFoundException e) {
-            throw new TmfTraceException(e.getMessage());
-        }
+        setupTrace(path);
         setParser(new TmfEventParserStub(this));
     }
 
     /**
+     * Constructor to specify the parser and indexer. The streaming interval
+     * will be 0.
+     *
      * @param path
+     *            The path to the trace file
      * @param cacheSize
-     * @throws FileNotFoundException
-     */
-    public TmfTraceStub(final String path, final int cacheSize, final ITmfTraceIndexer indexer) throws TmfTraceException {
-        this(path, cacheSize, false, null, indexer);
-    }
-
-    /**
-     * @param path
-     * @param waitForCompletion
-     * @throws FileNotFoundException
-     */
-    public TmfTraceStub(final String path, final boolean waitForCompletion) throws TmfTraceException {
-        this(path, ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, waitForCompletion);
-    }
-
-    /**
-     * @param path
-     * @param cacheSize
+     *            The cache size
      * @param waitForCompletion
-     * @throws FileNotFoundException
+     *            Do we block the caller until the trace is indexed, or not.
+     * @param indexer
+     *            The trace indexer to use
+     * @param parser
+     *            The trace parser. If left 'null', it will use a
+     *            {@link TmfEventParserStub}.
+     * @throws TmfTraceException
+     *             If an error occurred opening the trace
      */
-    public TmfTraceStub(final String path, final int cacheSize, final boolean waitForCompletion) throws TmfTraceException {
-        super(null, ITmfEvent.class, path, cacheSize, 0, null, null);
-        try {
-            fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
-        } catch (FileNotFoundException e) {
-            throw new TmfTraceException(e.getMessage());
-        }
-        setParser(new TmfEventParserStub(this));
+    public TmfTraceStub(final String path,
+            final int cacheSize,
+            final boolean waitForCompletion,
+            final ITmfTraceIndexer indexer,
+            final ITmfEventParser parser) throws TmfTraceException {
+        super(null, ITmfEvent.class, path, cacheSize, 0, indexer, null);
+        setupTrace(path);
+        setParser((parser != null) ? parser : new TmfEventParserStub(this));
         if (waitForCompletion) {
             indexTrace(true);
         }
     }
 
     /**
-     * @param path
-     * @param cacheSize
-     * @param waitForCompletion
-     * @throws FileNotFoundException
+     * Copy constructor
+     *
+     * @param trace
+     *            The trace to copy
+     * @throws TmfTraceException
+     *             If an error occurred opening the trace
      */
-    public TmfTraceStub(final IResource resource,  final String path, final int cacheSize, final boolean waitForCompletion) throws TmfTraceException {
-        super(resource, ITmfEvent.class, path, cacheSize, 0, null, null);
-        try {
-            fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
-        } catch (FileNotFoundException e) {
-            throw new TmfTraceException(e.getMessage());
-        }
+    public TmfTraceStub(final TmfTraceStub trace) throws TmfTraceException {
+        super(trace);
+        setupTrace(getPath()); // fPath will be set by the super-constructor
         setParser(new TmfEventParserStub(this));
     }
 
-    /**
-     * @param path
-     * @param cacheSize
-     * @param waitForCompletion
-     * @param parser
-     * @throws FileNotFoundException
-     */
-    public TmfTraceStub(final String path, final int cacheSize, final boolean waitForCompletion,
-            final ITmfEventParser parser, final ITmfTraceIndexer indexer) throws TmfTraceException {
-        super(null, ITmfEvent.class, path, cacheSize, 0, indexer, null);
+
+    private void setupTrace(String path) throws TmfTraceException {
         try {
             fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
         } catch (FileNotFoundException e) {
             throw new TmfTraceException(e.getMessage());
         }
-        setParser((parser != null) ? parser : new TmfEventParserStub(this));
     }
 
-    /**
-     * Copy constructor
-     */
-    public TmfTraceStub(final TmfTraceStub trace) throws TmfTraceException {
-        super(trace);
-        try {
-            fTrace = new RandomAccessFile(getPath(), "r"); //$NON-NLS-1$
-        } catch (FileNotFoundException e) {
-            throw new TmfTraceException(e.getMessage());
-        }
-        setParser(new TmfEventParserStub(this));
-    }
+    // ------------------------------------------------------------------------
+    // Initializers
+    // ------------------------------------------------------------------------
 
     @Override
     public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> type) throws TmfTraceException {
@@ -204,10 +168,19 @@ public class TmfTraceStub extends TmfTrace implements ITmfEventParser {
     // Accessors
     // ------------------------------------------------------------------------
 
+    /**
+     * @return The file stream to the trace
+     */
     public RandomAccessFile getStream() {
         return fTrace;
     }
 
+    /**
+     * Set the initial range offset.
+     *
+     * @param initOffset
+     *            The new initial range offset
+     */
     public void setInitialRangeOffset(ITmfTimestamp initOffset) {
         fInitialRangeOffset = initOffset;
     }
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 417d6d4869bff08d9380d474e7a59cf53555d4c8..518e117d5adf3a94fe5848f42a998ce3ba395850 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.tmf.core;singleton:=true
 Bundle-Activator: org.eclipse.linuxtools.internal.tmf.core.Activator
@@ -10,7 +10,7 @@ Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.core.resources,
- org.eclipse.linuxtools.ctf.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.internal.tmf.core;x-friends:="org.eclipse.linuxtools.tmf.core.tests",
  org.eclipse.linuxtools.internal.tmf.core.component;x-friends:="org.eclipse.linuxtools.tmf.core.tests",
  org.eclipse.linuxtools.internal.tmf.core.request;x-friends:="org.eclipse.linuxtools.tmf.core.tests",
@@ -25,6 +25,7 @@ Export-Package: org.eclipse.linuxtools.internal.tmf.core;x-friends:="org.eclipse
  org.eclipse.linuxtools.tmf.core.ctfadaptor,
  org.eclipse.linuxtools.tmf.core.event,
  org.eclipse.linuxtools.tmf.core.event.lookup,
+ org.eclipse.linuxtools.tmf.core.event.matching,
  org.eclipse.linuxtools.tmf.core.exceptions,
  org.eclipse.linuxtools.tmf.core.filter,
  org.eclipse.linuxtools.tmf.core.filter.model,
@@ -36,7 +37,11 @@ Export-Package: org.eclipse.linuxtools.internal.tmf.core;x-friends:="org.eclipse
  org.eclipse.linuxtools.tmf.core.statesystem,
  org.eclipse.linuxtools.tmf.core.statevalue,
  org.eclipse.linuxtools.tmf.core.statistics,
+ org.eclipse.linuxtools.tmf.core.synchronization,
  org.eclipse.linuxtools.tmf.core.timestamp,
  org.eclipse.linuxtools.tmf.core.trace,
+ org.eclipse.linuxtools.tmf.core.trace.indexer,
+ org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint,
+ org.eclipse.linuxtools.tmf.core.trace.location,
  org.eclipse.linuxtools.tmf.core.uml2sd,
  org.eclipse.linuxtools.tmf.core.util
index 55aab210eaf2166cd7cb61f17efc4fa0228018b6..d6065d9590bb22e7ed99a9477173efb7d64b003d 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.tmf.core</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools TMF Core Plug-in</name>
index f2f2b95df31def04988b0dc6149aacd136834210..0fa9eaff54b8ee9e72fbb0ccfed27d7200cec943 100644 (file)
@@ -90,6 +90,21 @@ public class Activator extends Plugin {
         super.stop(context);
     }
 
+
+    // ------------------------------------------------------------------------
+    // Log an IStatus
+    // ------------------------------------------------------------------------
+
+    /**
+     * Log an IStatus object directly
+     *
+     * @param status
+     *            The status to log
+     */
+    public static void log(IStatus status) {
+        fPlugin.getLog().log(status);
+    }
+
     // ------------------------------------------------------------------------
     // Log INFO
     // ------------------------------------------------------------------------
@@ -172,5 +187,4 @@ public class Activator extends Plugin {
     public static void logError(String message, Throwable exception) {
         fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
     }
-
 }
index 7968a2a9107793c0d6210dccc85fc712aa7ab076..2b8d0b71ec4f3ca62b1cd512bf9552aeb7e2b28f 100644 (file)
@@ -12,7 +12,8 @@
 
 package org.eclipse.linuxtools.internal.tmf.core.request;
 
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
@@ -30,109 +31,35 @@ public class TmfCoalescedDataRequest extends TmfDataRequest {
     // Attributes
     // ------------------------------------------------------------------------
 
-       /**
-        * The list of coalesced requests
-        */
-       protected Vector<ITmfDataRequest> fRequests = new Vector<ITmfDataRequest>();
+    /**
+     * The list of coalesced requests
+     */
+    protected final List<ITmfDataRequest> fRequests = new ArrayList<ITmfDataRequest>();
 
     // ------------------------------------------------------------------------
     // Constructor
     // ------------------------------------------------------------------------
 
-    /**
-     * Request all the events of a given type (high priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     */
-    public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType) {
-        this(dataType, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request all the events of a given type (given priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param priority the requested execution priority
-     */
-    public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, ExecutionType priority) {
-        this(dataType, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
-    }
-
-    /**
-     * Request all the events of a given type from the given index (high priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param index the index of the first event to retrieve
-     */
-    public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, long index) {
-        this(dataType, index, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request all the events of a given type from the given index (given priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param index the index of the first event to retrieve
-     * @param priority the requested execution priority
-     */
-    public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, long index, ExecutionType priority) {
-        this(dataType, index, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
-    }
-
-    /**
-     * Request 'n' events of a given type from the given index (high priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param index the index of the first event to retrieve
-     * @param nbRequested the number of events requested
-     */
-    public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested) {
-        this(dataType, index, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request 'n' events of a given type from the given index (given priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param index the index of the first event to retrieve
-     * @param nbRequested the number of events requested
-     * @param priority the requested execution priority
-     */
-    public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, ExecutionType priority) {
-        this(dataType, index, nbRequested, DEFAULT_BLOCK_SIZE, priority);
-    }
-
-    /**
-     * Request 'n' events of a given type from the given index (high priority).
-     * Events are returned in blocks of the given size.
-     *
-     * @param dataType the requested data type
-     * @param index the index of the first event to retrieve
-     * @param nbRequested the number of events requested
-     * @param blockSize the number of events per block
-     */
-    public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, int blockSize) {
-        super(ITmfEvent.class, index, nbRequested, blockSize, ExecutionType.FOREGROUND);
-    }
-
     /**
      * Request 'n' events of a given type from the given index (given priority).
      * Events are returned in blocks of the given size.
      *
-     * @param dataType the requested data type
-     * @param index the index of the first event to retrieve
-     * @param nbRequested the number of events requested
-     * @param blockSize the number of events per block
-     * @param priority the requested execution priority
+     * @param dataType
+     *            The requested data type
+     * @param index
+     *            The index of the first event to retrieve. Use '0' to start at
+     *            the beginning.
+     * @param nbRequested
+     *            The number of events requested. You can use
+     *            {@link TmfDataRequest#ALL_DATA} to request all events.
+     * @param priority
+     *            The requested execution priority
      */
-    public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, int blockSize, ExecutionType priority) {
-        super(ITmfEvent.class, index, nbRequested, blockSize, priority);
+    public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType,
+            long index,
+            int nbRequested,
+            ExecutionType priority) {
+        super(ITmfEvent.class, index, nbRequested, priority);
     }
 
     // ------------------------------------------------------------------------
@@ -142,7 +69,8 @@ public class TmfCoalescedDataRequest extends TmfDataRequest {
     /**
      * Add a request to this one.
      *
-     * @param request The request to add
+     * @param request
+     *            The request to add
      */
     public void addRequest(ITmfDataRequest request) {
         fRequests.add(request);
@@ -183,7 +111,7 @@ public class TmfCoalescedDataRequest extends TmfDataRequest {
             fIndex = start;
         }
         if ((request.getNbRequested() == TmfDataRequest.ALL_DATA) ||
-             (fNbRequested == TmfDataRequest.ALL_DATA))
+                (fNbRequested == TmfDataRequest.ALL_DATA))
         {
             fNbRequested = TmfDataRequest.ALL_DATA;
         } else {
@@ -191,36 +119,36 @@ public class TmfCoalescedDataRequest extends TmfDataRequest {
         }
     }
 
-       /**
-        * @return The list of IDs of the sub-requests
-        */
-       @SuppressWarnings("nls")
+    /**
+     * @return The list of IDs of the sub-requests
+     */
+    @SuppressWarnings("nls")
     public String getSubRequestIds() {
-           StringBuffer result = new StringBuffer("[");
-           for (int i = 0; i < fRequests.size(); i++) {
-               if (i != 0) {
+        StringBuffer result = new StringBuffer("[");
+        for (int i = 0; i < fRequests.size(); i++) {
+            if (i != 0) {
                 result.append(", ");
             }
-               result.append(fRequests.get(i).getRequestId());
-           }
-           result.append("]");
-           return result.toString();
-       }
+            result.append(fRequests.get(i).getRequestId());
+        }
+        result.append("]");
+        return result.toString();
+    }
 
     // ------------------------------------------------------------------------
     // ITmfDataRequest
     // ------------------------------------------------------------------------
 
     @Override
-       public void handleData(ITmfEvent data) {
-               super.handleData(data);
-       // Don't call sub-requests handleData() unless this is a
-               // TmfCoalescedDataRequest; extended classes should call
-               // the sub-requests handleData().
-               if (getClass() == TmfCoalescedDataRequest.class) {
-                   long index = getIndex() + getNbRead() - 1;
-               for (ITmfDataRequest request : fRequests) {
-                   if (!request.isCompleted()) {
+    public void handleData(ITmfEvent data) {
+        super.handleData(data);
+        // Don't call sub-requests handleData() unless this is a
+        // TmfCoalescedDataRequest; extended classes should call
+        // the sub-requests handleData().
+        if (getClass() == TmfCoalescedDataRequest.class) {
+            long index = getIndex() + getNbRead() - 1;
+            for (ITmfDataRequest request : fRequests) {
+                if (!request.isCompleted()) {
                     if (request.getDataType().isInstance(data)) {
                         long start = request.getIndex();
                         long end = start + request.getNbRequested();
@@ -243,32 +171,32 @@ public class TmfCoalescedDataRequest extends TmfDataRequest {
         super.start();
     }
 
-       @Override
+    @Override
     public void done() {
-       for (ITmfDataRequest request : fRequests) {
-           if (!request.isCompleted()) {
-               request.done();
-           }
-       }
-       super.done();
+        for (ITmfDataRequest request : fRequests) {
+            if (!request.isCompleted()) {
+                request.done();
+            }
+        }
+        super.done();
     }
 
     @Override
     public void fail() {
-       for (ITmfDataRequest request : fRequests) {
-               request.fail();
-       }
-       super.fail();
+        for (ITmfDataRequest request : fRequests) {
+            request.fail();
+        }
+        super.fail();
     }
 
     @Override
     public void cancel() {
-       for (ITmfDataRequest request : fRequests) {
-           if (!request.isCompleted()) {
-               request.cancel();
-           }
-       }
-       super.cancel();
+        for (ITmfDataRequest request : fRequests) {
+            if (!request.isCompleted()) {
+                request.cancel();
+            }
+        }
+        super.cancel();
     }
 
     @Override
@@ -318,7 +246,6 @@ public class TmfCoalescedDataRequest extends TmfDataRequest {
 
     }
 
-
     // ------------------------------------------------------------------------
     // Object
     // ------------------------------------------------------------------------
@@ -326,26 +253,26 @@ public class TmfCoalescedDataRequest extends TmfDataRequest {
     @Override
     // All requests have a unique id
     public int hashCode() {
-       return super.hashCode();
+        return super.hashCode();
     }
 
     @Override
     public boolean equals(Object other) {
-       if (other instanceof TmfCoalescedDataRequest) {
-               TmfCoalescedDataRequest request = (TmfCoalescedDataRequest) other;
-                       return  (request.getDataType()    == getDataType())   &&
-                                       (request.getIndex()       == getIndex())      &&
-                                       (request.getNbRequested() == getNbRequested() &&
-                               (request.getExecType()    == getExecType()));
-               }
-               return false;
+        if (other instanceof TmfCoalescedDataRequest) {
+            TmfCoalescedDataRequest request = (TmfCoalescedDataRequest) other;
+            return (request.getDataType() == getDataType()) &&
+                    (request.getIndex() == getIndex()) &&
+                    (request.getNbRequested() == getNbRequested() &&
+                    (request.getExecType() == getExecType()));
+        }
+        return false;
     }
 
     @Override
     @SuppressWarnings("nls")
     public String toString() {
         return "[TmfCoalescedDataRequest(" + getRequestId() + "," + getDataType().getSimpleName()
-                + "," + getExecType() + "," + getIndex() + "," + getNbRequested() + ","
-                + getBlockSize() + ", " + fRequests.toString() + ")]";
+                + "," + getExecType() + "," + getIndex() + "," + getNbRequested() + ", "
+                + fRequests.toString() + ")]";
     }
 }
index d7eac1d019aea09000675606f8dff4dfd6c0f8c0..1cd07f01465dcaff768c635798da80ec2a7d57de 100644 (file)
@@ -32,121 +32,36 @@ public class TmfCoalescedEventRequest extends TmfCoalescedDataRequest implements
     // Attributes
     // ------------------------------------------------------------------------
 
-       private TmfTimeRange fRange;    // The requested events time range
+    private TmfTimeRange fRange; // The requested events time range
 
     // ------------------------------------------------------------------------
     // Constructor
     // ------------------------------------------------------------------------
 
     /**
-     * Request all the events of a given type (high priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
+     * Request 'n' events of a given type for the given time range (given
+     * priority). Events are returned in blocks of the given size.
      *
-     * @param dataType the requested data type
+     * @param dataType
+     *            The requested data type
+     * @param range
+     *            The range of the request. You can use
+     *            {@link TmfTimeRange#ETERNITY} to request all events.
+     * @param index
+     *            The index of the first event to retrieve. Use '0' to start at
+     *            the beginning.
+     * @param nbRequested
+     *            The number of events requested. You can use
+     *            {@link TmfDataRequest#ALL_DATA} to request all events.
+     * @param priority
+     *            The requested execution priority
      */
-    public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType) {
-        this(dataType, TmfTimeRange.ETERNITY, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request all the events of a given type (given priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param priority the requested execution priority
-     */
-    public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, ExecutionType priority) {
-        this(dataType, TmfTimeRange.ETERNITY, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
-    }
-
-    /**
-     * Request all the events of a given type for the given time range (high priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     */
-    public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range) {
-        this(dataType, range, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request all the events of a given type for the given time range (given priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param priority the requested execution priority
-     */
-    public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, ExecutionType priority) {
-        this(dataType, range, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
-    }
-
-    /**
-     * Request 'n' events of a given type from the given time range (high priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param nbRequested the number of events requested
-     */
-    public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested) {
-        this(dataType, range, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request 'n' events of a given type for the given time range (given priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param nbRequested the number of events requested
-     * @param priority the requested execution priority
-     */
-    public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested, ExecutionType priority) {
-        this(dataType, range, nbRequested, DEFAULT_BLOCK_SIZE, priority);
-    }
-
-    /**
-     * Request 'n' events of a given type for the given time range (high priority).
-     * Events are returned in blocks of the given size.
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param nbRequested the number of events requested
-     * @param blockSize the number of events per block
-     */
-    public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested, int blockSize) {
-        this(dataType, range, 0, nbRequested, blockSize, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request 'n' events of a given type for the given time range (given priority).
-     * Events are returned in blocks of the given size.
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param nbRequested the number of events requested
-     * @param blockSize the number of events per block
-     * @param priority the requested execution priority
-     */
-    public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested, int blockSize, ExecutionType priority) {
-        this(dataType, range, 0, nbRequested, blockSize, priority);
-    }
-
-    /**
-     * Request 'n' events of a given type for the given time range (given priority).
-     * Events are returned in blocks of the given size.
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param index the index of the first event to retrieve
-     * @param nbRequested the number of events requested
-     * @param blockSize the number of events per block
-     * @param priority the requested execution priority
-     */
-    public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, long index, int nbRequested, int blockSize, ExecutionType priority) {
-        super(ITmfEvent.class, index, nbRequested, blockSize, priority);
+    public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType,
+            TmfTimeRange range,
+            long index,
+            int nbRequested,
+            ExecutionType priority) {
+        super(ITmfEvent.class, index, nbRequested, priority);
         fRange = range;
 
         if (TmfCoreTracer.isRequestTraced()) {
@@ -174,25 +89,25 @@ public class TmfCoalescedEventRequest extends TmfCoalescedDataRequest implements
         }
     }
 
-       @Override
-       public boolean isCompatible(ITmfDataRequest request) {
-           if (request instanceof ITmfEventRequest) {
-               if (super.isCompatible(request)) {
-                   return overlaps((ITmfEventRequest) request);
-               }
-           }
-           return false;
-       }
+    @Override
+    public boolean isCompatible(ITmfDataRequest request) {
+        if (request instanceof ITmfEventRequest) {
+            if (super.isCompatible(request)) {
+                return overlaps((ITmfEventRequest) request);
+            }
+        }
+        return false;
+    }
 
     private boolean overlaps(ITmfEventRequest request) {
         ITmfTimestamp startTime = request.getRange().getStartTime();
-        ITmfTimestamp endTime   = request.getRange().getEndTime();
+        ITmfTimestamp endTime = request.getRange().getEndTime();
         return (startTime.compareTo(endTime) <= 0) && (fRange.getStartTime().compareTo(fRange.getEndTime()) <= 0);
     }
 
     private void merge(ITmfEventRequest request) {
         ITmfTimestamp startTime = request.getRange().getStartTime();
-        ITmfTimestamp endTime   = request.getRange().getEndTime();
+        ITmfTimestamp endTime = request.getRange().getEndTime();
         if (!fRange.contains(startTime) && fRange.getStartTime().compareTo(startTime) > 0) {
             fRange = new TmfTimeRange(startTime, fRange.getEndTime());
         }
@@ -242,15 +157,15 @@ public class TmfCoalescedEventRequest extends TmfCoalescedDataRequest implements
     // ITmfEventRequest
     // ------------------------------------------------------------------------
 
-       @Override
-       public TmfTimeRange getRange() {
-               return fRange;
-       }
+    @Override
+    public TmfTimeRange getRange() {
+        return fRange;
+    }
 
-       @Override
-       public void setStartIndex(int index) {
-               setIndex(index);
-       }
+    @Override
+    public void setStartIndex(int index) {
+        setIndex(index);
+    }
 
     // ------------------------------------------------------------------------
     // Object
@@ -259,22 +174,22 @@ public class TmfCoalescedEventRequest extends TmfCoalescedDataRequest implements
     @Override
     // All requests have a unique id
     public int hashCode() {
-       return super.hashCode();
+        return super.hashCode();
     }
 
     @Override
     public boolean equals(Object other) {
-       if (other instanceof TmfCoalescedEventRequest) {
-               TmfCoalescedEventRequest request = (TmfCoalescedEventRequest) other;
-                       return  (request.getDataType()    == getDataType()) &&
-                                       (request.getIndex()       == getIndex())    &&
-                                       (request.getNbRequested() == getNbRequested()) &&
-                               (request.getRange().equals(getRange()));
-               }
-       if (other instanceof TmfCoalescedDataRequest) {
-                       return super.equals(other);
-       }
-               return false;
+        if (other instanceof TmfCoalescedEventRequest) {
+            TmfCoalescedEventRequest request = (TmfCoalescedEventRequest) other;
+            return (request.getDataType() == getDataType()) &&
+                    (request.getIndex() == getIndex()) &&
+                    (request.getNbRequested() == getNbRequested()) &&
+                    (request.getRange().equals(getRange()));
+        }
+        if (other instanceof TmfCoalescedDataRequest) {
+            return super.equals(other);
+        }
+        return false;
     }
 
     @Override
@@ -282,7 +197,7 @@ public class TmfCoalescedEventRequest extends TmfCoalescedDataRequest implements
     public String toString() {
         return "[TmfCoalescedEventRequest(" + getRequestId() + "," + getDataType().getSimpleName()
                 + "," + getExecType() + "," + getRange() + "," + getIndex() + "," + getNbRequested()
-                + "," + getBlockSize() + ", " + fRequests.toString() + ")]";
+                + ", " + fRequests.toString() + ")]";
     }
 
 }
index e56f39a314df0f500dad2370577ca7552ab0c056..6abe91c55da31b3fc8fbafdcca943efd23e941b5 100644 (file)
@@ -225,10 +225,6 @@ public class HistoryBuilder extends TmfComponent {
 }
 
 class StateSystemBuildRequest extends TmfEventRequest {
-
-    /** The amount of events queried at a time through the requests */
-    private static final int CHUNK_SIZE = 50000;
-
     private final HistoryBuilder builder;
     private final ITmfStateProvider sci;
     private final ITmfTrace trace;
@@ -236,8 +232,8 @@ class StateSystemBuildRequest extends TmfEventRequest {
     StateSystemBuildRequest(HistoryBuilder builder) {
         super(builder.getStateProvider().getExpectedEventType(),
                 TmfTimeRange.ETERNITY,
+                0,
                 TmfDataRequest.ALL_DATA,
-                CHUNK_SIZE,
                 ITmfDataRequest.ExecutionType.BACKGROUND);
         this.builder = builder;
         this.sci = builder.getStateProvider();
index 5568d9f2a3f0400e9a17b41b8f4a64c62665a3c3..a73c5c0e8d223a9cf4bbcebc5ce509d47243979a 100644 (file)
@@ -283,10 +283,6 @@ public class PartialHistoryBackend implements IStateHistoryBackend {
     // ------------------------------------------------------------------------
 
     private class CheckpointsRequest extends TmfEventRequest {
-
-        /** The amount of events queried at a time through the requests */
-        private static final int CHUNK_SIZE = 50000;
-
         private final ITmfTrace trace;
         private final Map<Long, Long> checkpts;
         private long eventCount;
@@ -295,8 +291,8 @@ public class PartialHistoryBackend implements IStateHistoryBackend {
         public CheckpointsRequest(ITmfStateProvider input, Map<Long, Long> checkpoints) {
             super(input.getExpectedEventType(),
                     TmfTimeRange.ETERNITY,
+                    0,
                     TmfDataRequest.ALL_DATA,
-                    CHUNK_SIZE,
                     ITmfDataRequest.ExecutionType.BACKGROUND);
             checkpoints.clear();
             this.trace = input.getTrace();
@@ -330,16 +326,14 @@ public class PartialHistoryBackend implements IStateHistoryBackend {
     }
 
     private class PartialStateSystemRequest extends TmfEventRequest {
-
-        private static final int CHUNK_SIZE = 50000;
         private final ITmfStateProvider sci;
         private final ITmfTrace trace;
 
         PartialStateSystemRequest(ITmfStateProvider sci, TmfTimeRange range) {
             super(sci.getExpectedEventType(),
                     range,
+                    0,
                     TmfDataRequest.ALL_DATA,
-                    CHUNK_SIZE,
                     ITmfDataRequest.ExecutionType.BACKGROUND);
             this.sci = sci;
             this.trace = sci.getTrace();
index 459493b31584df2c48c1d7208ecccc5ca5401925..bbd7b650dfdcfbaf2624ac6461057f140538833f 100644 (file)
@@ -14,7 +14,7 @@
 
 package org.eclipse.linuxtools.internal.tmf.core.trace;
 
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 
 
 /**
index 13deef2d00934425e74d6aa844f357dd93f66bd6..d0f5c38b6e2bdcc5634b71c94e2444c648b9c55b 100644 (file)
@@ -16,7 +16,7 @@ package org.eclipse.linuxtools.internal.tmf.core.trace;
 
 import java.util.Arrays;
 
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 
 
 /**
index fda7d41ca8ec8673b1788e02d63a87c8faee21af..cb0e3484893a008d81379cccf08f1bafef57fa1e 100644 (file)
@@ -264,7 +264,7 @@ public abstract class TmfDataProvider extends TmfComponent implements ITmfDataPr
     protected void newCoalescedDataRequest(ITmfDataRequest request) {
         synchronized (fLock) {
             TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(request.getDataType(), request.getIndex(),
-                    request.getNbRequested(), request.getBlockSize(), request.getExecType());
+                    request.getNbRequested(), request.getExecType());
             coalescedRequest.addRequest(request);
             if (TmfCoreTracer.isRequestTraced()) {
                 TmfCoreTracer.traceRequest(request, "COALESCED with " + coalescedRequest.getRequestId()); //$NON-NLS-1$
@@ -304,7 +304,7 @@ public abstract class TmfDataProvider extends TmfComponent implements ITmfDataPr
         if (request.getExecType() == ExecutionType.FOREGROUND) {
             queueRequest(request);
         } else {
-            queueBackgroundRequest(request, request.getBlockSize(), true);
+            queueBackgroundRequest(request, true);
         }
     }
 
@@ -335,12 +335,11 @@ public abstract class TmfDataProvider extends TmfComponent implements ITmfDataPr
      *
      * @param request
      *            The request
-     * @param blockSize
-     *            The request should be split in chunks of this size
      * @param indexing
      *            Should we index the chunks
+     * @since 3.0
      */
-    protected void queueBackgroundRequest(final ITmfDataRequest request, final int blockSize, final boolean indexing) {
+    protected void queueBackgroundRequest(final ITmfDataRequest request, final boolean indexing) {
         queueRequest(request);
     }
 
index 9a84d00b317cd09198123141819ca001da342691..7f661679f4d009c3f8145b21721057102a0e2a01 100644 (file)
@@ -98,8 +98,12 @@ public abstract class TmfEventProvider extends TmfDataProvider {
     protected synchronized void newCoalescedDataRequest(ITmfDataRequest request) {
         if (request instanceof ITmfEventRequest) {
             ITmfEventRequest eventRequest = (ITmfEventRequest) request;
-            TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(eventRequest.getDataType(), eventRequest.getRange(),
-                    eventRequest.getIndex(), eventRequest.getNbRequested(), eventRequest.getBlockSize(), eventRequest.getExecType());
+            TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(
+                            eventRequest.getDataType(),
+                            eventRequest.getRange(),
+                            eventRequest.getIndex(),
+                            eventRequest.getNbRequested(),
+                            eventRequest.getExecType());
             coalescedRequest.addRequest(eventRequest);
             if (TmfCoreTracer.isRequestTraced()) {
                 TmfCoreTracer.traceRequest(request, "COALESCED with " + coalescedRequest.getRequestId()); //$NON-NLS-1$
index 8311e7acb8fc351abd3183feab786cb491110e6f..9635d55a68481cdcd96f205b892e58bc95b7b23d 100644 (file)
@@ -13,7 +13,7 @@ package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
 import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 
 /**
  * The CTF trace reader iterator.
@@ -202,6 +202,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
     /**
      * Method setLocation.
      * @param location ITmfLocation<?>
+     * @since 3.0
      */
     @Override
     public void setLocation(final ITmfLocation location) {
index 6cb87d918ffe02be71e1c26a2aa76ed345305794..b310f822c81eb433697b861498e3a631c88f7817 100644 (file)
@@ -13,7 +13,7 @@
 package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 
 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLocation;
 
 /**
  * The nugget of information that is unique to a location in a CTF trace.
index df2076b5e196114e36543581d30aec10ba1a84ca..ad383a59e1dad9c2dce521fe25b496fe3a24c201 100644 (file)
@@ -14,7 +14,7 @@
 package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 
 /**
  * Lightweight Context for CtfTmf traces. Should only use 3 references, 1 ref to
@@ -60,6 +60,9 @@ public class CtfTmfContext implements ITmfContext {
         return curRank;
     }
 
+    /**
+     * @since 3.0
+     */
     @Override
     public ITmfLocation getLocation() {
         return curLocation;
@@ -70,6 +73,9 @@ public class CtfTmfContext implements ITmfContext {
         return curRank != CtfLocation.INVALID_LOCATION.getTimestamp();
     }
 
+    /**
+     * @since 3.0
+     */
     @Override
     public void setLocation(ITmfLocation location) {
         curLocation = (CtfLocation) location;
index bc28e4ad916c232e36b459bf58af12fdd512642a..2265ce91e7f341e5db2d372e0145483a0a9362d0 100644 (file)
@@ -77,6 +77,7 @@ public class CtfTmfEvent extends TmfEvent
         sourceCPU = cpu;
         typeId = declaration.getId();
         eventName = declaration.getName();
+
     }
 
     /**
index 9178188050b8597adb5f20959ac34cc133b74cde..fc8b905f31b55bc6358d11a747023c833c26e7ab 100644 (file)
@@ -60,7 +60,7 @@ public final class CtfTmfEventFactory {
         /* Prepare what to pass to CtfTmfEvent's constructor */
         final IEventDeclaration eventDecl = eventDef.getDeclaration();
         final long ts = eventDef.getTimestamp();
-        final CtfTmfTimestamp timestamp = new CtfTmfTimestamp(
+        final CtfTmfTimestamp timestamp = originTrace.createTimestamp(
                 originTrace.getCTFTrace().timestampCyclesToNanos(ts));
 
         int sourceCPU = eventDef.getCPU();
index 3c4de5ddc53e5234499d29ac65ef9b68685c8b0b..4b82324fd3fa0168c6e5b0ab57103df029810a23 100644 (file)
@@ -16,7 +16,6 @@
 
 package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -187,57 +186,6 @@ public abstract class CtfTmfEventField extends TmfEventField {
     public String toString() {
         return getName() + '=' + getFormattedValue();
     }
-
-    /**
-     * Print a numeric value as a string in a given base
-     *
-     * @param value
-     *            The value to print as string
-     * @param base
-     *            The base for this value
-     * @param signed
-     *            Is the value signed or not
-     * @return formatted number string
-     * @since 2.0
-     */
-    public final static String formatNumber(long value, int base, boolean signed) {
-        String s;
-
-        /* Format the number correctly according to the integer's base */
-        switch (base) {
-        case 2:
-            s = "0b" + Long.toBinaryString(value); //$NON-NLS-1$
-            break;
-        case 8:
-            s = "0" + Long.toOctalString(value); //$NON-NLS-1$
-
-            break;
-        case 16:
-            s = "0x" + Long.toHexString(value); //$NON-NLS-1$
-            break;
-        case 10:
-        default:
-            /* For non-standard base, we'll just print it as a decimal number */
-            if (!signed && value < 0) {
-                /* Since there are no 'unsigned long', handle this case with BigInteger */
-                BigInteger bigInteger = BigInteger.valueOf(value);
-                /*
-                 * powerOfTwo = 2^64 we add 2^64 to the negative number to get
-                 * the real unsigned value
-                 */
-                BigInteger powerOfTwo = (BigInteger.valueOf(Long.MAX_VALUE)).add(BigInteger.valueOf(1));
-                powerOfTwo = powerOfTwo.multiply(BigInteger.valueOf(2));
-                bigInteger = bigInteger.add(powerOfTwo);
-
-                s = bigInteger.toString();
-            } else {
-                s = Long.toString(value);
-            }
-            break;
-        }
-        return s;
-    }
-
 }
 
 /**
@@ -274,7 +222,7 @@ final class CTFIntegerField extends CtfTmfEventField {
 
     @Override
     public String getFormattedValue() {
-        return formatNumber(getValue(), base, signed);
+        return IntegerDefinition.formatNumber(getValue(), base, signed);
     }
 
 }
@@ -342,7 +290,7 @@ final class CTFIntegerArrayField extends CtfTmfEventField {
         if (formattedValue == null) {
             List<String> strings = new ArrayList<String>();
             for (Long value : getValue()) {
-                strings.add(formatNumber(value, base, signed));
+                strings.add(IntegerDefinition.formatNumber(value, base, signed));
             }
             formattedValue = strings.toString();
         }
index e26d535c509d0c68291e0a4881eed766401cba54..5edb8cda8f8ea3f3cc713fa6541945d4cf06b346 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson, École Polytechnique de Montréal
  *
  * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which
@@ -9,6 +9,7 @@
  * Contributors:
  *   Matthew Khouzam - Initial API and implementation
  *   Patrick Tasse - Updated for removal of context clone
+ *   Geneviève Bastien - Added the createTimestamp function
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.core.ctfadaptor;
@@ -22,6 +23,7 @@ import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.CTFClock;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
@@ -32,9 +34,9 @@ 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;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceProperties;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 
 /**
  * The CTf trace handler
@@ -53,6 +55,11 @@ public class CtfTmfTrace extends TmfTrace
      */
     protected static final int DEFAULT_CACHE_SIZE = 50000;
 
+    /*
+     * The Ctf clock unique identifier field
+     */
+    private static final String CLOCK_HOST_PROPERTY = "uuid"; //$NON-NLS-1$
+
     // -------------------------------------------
     // Fields
     // -------------------------------------------
@@ -164,12 +171,16 @@ public class CtfTmfTrace extends TmfTrace
      *
      * @return null, since the trace has no knowledge of the current location
      * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentLocation()
+     * @since 3.0
      */
     @Override
     public ITmfLocation getCurrentLocation() {
         return null;
     }
 
+    /**
+     * @since 3.0
+     */
     @Override
     public double getLocationRatio(ITmfLocation location) {
         final CtfLocation curLocation = (CtfLocation) location;
@@ -189,6 +200,7 @@ public class CtfTmfTrace extends TmfTrace
      * @param location
      *            ITmfLocation<?>
      * @return ITmfContext
+     * @since 3.0
      */
     @Override
     public synchronized ITmfContext seekEvent(final ITmfLocation location) {
@@ -281,6 +293,25 @@ public class CtfTmfTrace extends TmfTrace
         return fTrace;
     }
 
+    /**
+     * Ctf traces have a clock with a unique uuid that will be used to identify
+     * the host. Traces with the same clock uuid will be known to have been made
+     * on the same machine.
+     *
+     * Note: uuid is an optional field, it may not be there for a clock.
+     */
+    @Override
+    public String getHostId() {
+        CTFClock clock = getCTFTrace().getClock();
+        if (clock != null) {
+            String clockHost = (String) clock.getProperty(CLOCK_HOST_PROPERTY);
+            if (clockHost != null) {
+                return clockHost;
+            }
+        }
+        return super.getHostId();
+    }
+
     // -------------------------------------------
     // ITmfTraceProperties
     // -------------------------------------------
@@ -404,4 +435,16 @@ public class CtfTmfTrace extends TmfTrace
     public CtfIterator createIterator() {
         return new CtfIterator(this);
     }
+
+    // ------------------------------------------------------------------------
+    // Timestamp transformation functions
+    // ------------------------------------------------------------------------
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public CtfTmfTimestamp createTimestamp(long ts) {
+        return new CtfTmfTimestamp(getTimestampTransform().transform(ts));
+    }
 }
index ae2176e77d6d2d806252cfb5985495d18487daeb..f8fcb6a65f9d35deff7fcc08ce10abf6bb513677 100644 (file)
@@ -81,4 +81,15 @@ public interface ITmfEventField {
      */
     ITmfEventField getField(int index);
 
+    /**
+     * Gets the a sub-field of this field, which may be multiple levels down.
+     *
+     * @param path
+     *            Array of field names to recursively go through
+     * @return The field at the end, or null if a field in the path cannot be
+     *         found
+     * @since 3.0
+     */
+    ITmfEventField getSubField(String[] path);
+
 }
index 14f13e8b9211e1f1b31e40e9456d4ce66aa4f3f6..4123369cc07c41ea19918d7766ee43cde178db78 100644 (file)
@@ -135,6 +135,21 @@ public class TmfEventField implements ITmfEventField {
         return null;
     }
 
+    /**
+     * @since 3.0
+     */
+    @Override
+    public ITmfEventField getSubField(final String[] names) {
+        ITmfEventField field = this;
+        for (String name : names) {
+            field = field.getField(name);
+            if (field == null) {
+                return null;
+            }
+        }
+        return field;
+    }
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/IMatchProcessingUnit.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/IMatchProcessingUnit.java
new file mode 100644 (file)
index 0000000..063f15c
--- /dev/null
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.event.matching;
+
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * This class represent an action to be done when event matches are found. This
+ * interface needs to be implemented by all classes that want to be warned when
+ * new event matches are found. They need to register to an instance of
+ * TmfEventMatches class in order to be informed of matches.
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public interface IMatchProcessingUnit {
+
+    /**
+     * Once the traces are known, hook function to initialize some things
+     *
+     * @param fTraces the set of traces that will be synchronized
+     */
+    void init(ITmfTrace[] fTraces);
+
+    /**
+     * Function called when a match is found
+     *
+     * @param match
+     *            The event match
+     */
+    void addMatch(TmfEventDependency match);
+
+    /**
+     * Function called after all matching has been done, to do any post-match
+     * treatment
+     */
+    void matchingEnded();
+
+    /**
+     * Counts the matches
+     *
+     * @return the number of matches
+     */
+    int countMatches();
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/ITmfEventMatching.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/ITmfEventMatching.java
new file mode 100644 (file)
index 0000000..1714ca8
--- /dev/null
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.event.matching;
+
+
+/**
+ * Interface for matching trace events
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public interface ITmfEventMatching {
+
+    /**
+     * Method that start the process of matching events
+     *
+     * @return Whether the match was completed correctly or not
+     */
+    boolean matchEvents();
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/ITmfMatchEventDefinition.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/ITmfMatchEventDefinition.java
new file mode 100644 (file)
index 0000000..caba635
--- /dev/null
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.event.matching;
+
+import java.util.List;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching.MatchingType;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * This interface describe a concrete method to match events. Typically it
+ * manages for a given matching type what events/fields are used to match events
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public interface ITmfMatchEventDefinition {
+
+    /**
+     * Returns a list of values for an event that uniquely identifies this event
+     *
+     * @param event
+     *            The event for which to compute the key
+     * @return the unique key for this event
+     */
+    List<Object> getUniqueField(ITmfEvent event);
+
+    /**
+     * Verifies whether a trace has all required events to match using this
+     * class
+     *
+     * @param trace
+     *            The trace
+     * @return Whether the trace has all required information
+     */
+    boolean canMatchTrace(ITmfTrace trace);
+
+    /**
+     * Return all matching types this definition covers
+     *
+     * @return an array of matching types
+     */
+    MatchingType[] getApplicableMatchingTypes();
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventDependency.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventDependency.java
new file mode 100644 (file)
index 0000000..1350250
--- /dev/null
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.event.matching;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+
+/**
+ * Represents a dependency (match) between two events, where source event leads
+ * to destination event
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public class TmfEventDependency {
+
+    private final ITmfEvent fSourceEvent;
+    private final ITmfEvent fDestEvent;
+
+    /**
+     * Constructor
+     *
+     * @param source
+     *            The source event of this dependency
+     * @param destination
+     *            The destination event of this dependency
+     */
+    public TmfEventDependency(final ITmfEvent source, final ITmfEvent destination) {
+        fSourceEvent = source;
+        fDestEvent = destination;
+    }
+
+    /**
+     * Getter for fSourceEvent
+     *
+     * @return The source event
+     */
+    public ITmfEvent getSourceEvent() {
+        return fSourceEvent;
+    }
+
+    /**
+     * Getter for fDestEvent
+     *
+     * @return the Destination event
+     */
+    public ITmfEvent getDestinationEvent() {
+        return fDestEvent;
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventMatches.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventMatches.java
new file mode 100644 (file)
index 0000000..8cf3e5e
--- /dev/null
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.event.matching;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * Class that does something with a match.
+ *
+ * This default implementation of the class just adds it to a list of matches
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public class TmfEventMatches implements IMatchProcessingUnit {
+
+    /**
+     * The list of matches found
+     */
+    private final List<TmfEventDependency> fMatches;
+
+    /**
+     * Constructor
+     */
+    public TmfEventMatches() {
+        fMatches = new ArrayList<TmfEventDependency>();
+    }
+
+    /**
+     * IMatchProcessingUnit overrides
+     */
+
+    @Override
+    public void init(ITmfTrace[] fTraces) {
+
+    }
+
+    @Override
+    public void addMatch(TmfEventDependency match) {
+        fMatches.add(match);
+    }
+
+    @Override
+    public void matchingEnded() {
+
+    }
+
+    @Override
+    public int countMatches() {
+        return fMatches.size();
+    }
+
+    /**
+     * Returns the match at the specified index
+     *
+     * @param index
+     *            The index of the match to get
+     * @return The match at index or null or not present
+     */
+    public TmfEventDependency getMatch(int index) {
+        return fMatches.get(index);
+    }
+
+    @Override
+    public String toString() {
+        return getClass().getSimpleName() + " [ Number of matches found: " + fMatches.size() + " ]"; //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventMatching.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventMatching.java
new file mode 100644 (file)
index 0000000..fe694f6
--- /dev/null
@@ -0,0 +1,275 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.event.matching;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.linuxtools.internal.tmf.core.Activator;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+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.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * Abstract class to extend to match certain type of events in a trace
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public abstract class TmfEventMatching implements ITmfEventMatching {
+
+    /**
+     * The matching type
+     *
+     * FIXME Not the best place to put this. Have an array of match types as a
+     * parameter of each trace?
+     */
+    public enum MatchingType {
+        /**
+         * NETWORK, match network events
+         */
+        NETWORK
+    }
+
+    /**
+     * The array of traces to match
+     */
+    private final ITmfTrace[] fTraces;
+
+    /**
+     * The class to call once a match is found
+     */
+    private final IMatchProcessingUnit fMatches;
+
+    private static final Map<MatchingType, List<ITmfMatchEventDefinition>> fMatchDefinitions = new HashMap<MatchingType, List<ITmfMatchEventDefinition>>();
+
+    private final Map<ITmfTrace, ITmfMatchEventDefinition> fMatchMap = new HashMap<ITmfTrace, ITmfMatchEventDefinition>();
+
+    /**
+     * Constructor with multiple traces and a match processing object
+     *
+     * @param traces
+     *            The set of traces for which to match events
+     * @param tmfEventMatches
+     *            The match processing class
+     */
+    public TmfEventMatching(ITmfTrace[] traces, IMatchProcessingUnit tmfEventMatches) {
+        if (tmfEventMatches == null) {
+            throw new IllegalArgumentException();
+        }
+        fTraces = traces;
+        fMatches = tmfEventMatches;
+    }
+
+    /**
+     * Returns the traces to process
+     *
+     * @return The traces
+     */
+    protected ITmfTrace[] getTraces() {
+        return fTraces;
+    }
+
+    /**
+     * Returns the match processing unit
+     *
+     * @return The match processing unit
+     */
+    protected IMatchProcessingUnit getProcessingUnit() {
+        return fMatches;
+    }
+
+    /**
+     * Returns the match event definition corresponding to the trace
+     *
+     * @param trace
+     *            The trace
+     * @return The match event definition object
+     */
+    protected ITmfMatchEventDefinition getEventDefinition(ITmfTrace trace) {
+        return fMatchMap.get(trace);
+    }
+
+    /**
+     * Method that initializes any data structure for the event matching. It
+     * also assigns to each trace an event matching definition instance that
+     * applies to the trace
+     */
+    protected void initMatching() {
+        fMatches.init(fTraces);
+        List<ITmfMatchEventDefinition> deflist = fMatchDefinitions.get(getMatchingType());
+        if (deflist == null) {
+            return;
+        }
+        for (ITmfTrace trace : fTraces) {
+            for (ITmfMatchEventDefinition def : deflist) {
+                if (def.canMatchTrace(trace)) {
+                    fMatchMap.put(trace, def);
+                    break;
+                }
+            }
+        }
+    }
+
+    /**
+     * Calls any post matching methods of the processing class
+     */
+    protected void finalizeMatching() {
+        fMatches.matchingEnded();
+    }
+
+    /**
+     * Prints stats from the matching
+     *
+     * @return string of statistics
+     */
+    @SuppressWarnings("nls")
+    @Override
+    public String toString() {
+        return getClass().getSimpleName() + " [ " + fMatches + " ]";
+    }
+
+    /**
+     * Matches one event
+     *
+     * @param event
+     *            The event to match
+     * @param traceno
+     *            The number of the trace this event belongs to
+     */
+    protected abstract void matchEvent(ITmfEvent event, int traceno);
+
+    /**
+     * Returns the matching type this class implements
+     *
+     * @return A matching type
+     */
+    protected abstract MatchingType getMatchingType();
+
+    /**
+     * Method that start the process of matching events
+     *
+     * @return Whether the match was completed correctly or not
+     */
+    @Override
+    public boolean matchEvents() {
+
+        /* Are there traces to match? If no, return false */
+        if (!(fTraces.length > 0)) {
+            return false;
+        }
+
+        // TODO Start a new thread here?
+        initMatching();
+
+        /**
+         * For each trace, get the events and for each event, call the
+         * MatchEvent method
+         *
+         * FIXME This would use a lot of memory if the traces are big, because
+         * all involved events from first trace will have to be kept before a
+         * first match is possible with second trace.
+         *
+         * <pre>
+         * Other possible matching strategy:
+         * Incremental:
+         * Sliding window:
+         * Other strategy: start with the shortest trace, take a few events
+         * at the beginning and at the end
+         * Experiment strategy: have the experiment do the request, then events will
+         * come from both traces chronologically, but then instead of ITmfTrace[], it
+         * would be preferable to have experiment
+         * </pre>
+         */
+        for (int i = 0; i < fTraces.length; i++) {
+
+            EventMatchingBuildRequest request = new EventMatchingBuildRequest(this, i);
+
+            /*
+             * Send the request to the trace here, since there is probably no
+             * experiment.
+             */
+            fTraces[i].sendRequest(request);
+            try {
+                request.waitForCompletion();
+            } catch (InterruptedException e) {
+                Activator.logInfo(e.getMessage());
+            }
+        }
+
+        finalizeMatching();
+
+        return true;
+    }
+
+    /**
+     * Registers an event match definition to be used for a certain match type
+     *
+     * @param match
+     *            The event matching definition
+     */
+    public static void registerMatchObject(ITmfMatchEventDefinition match) {
+        for (MatchingType type : match.getApplicableMatchingTypes()) {
+            if (!fMatchDefinitions.containsKey(type)) {
+                fMatchDefinitions.put(type, new ArrayList<ITmfMatchEventDefinition>());
+            }
+            fMatchDefinitions.get(type).add(match);
+        }
+    }
+
+}
+
+class EventMatchingBuildRequest extends TmfEventRequest {
+
+    private final TmfEventMatching matching;
+    private final int traceno;
+
+    EventMatchingBuildRequest(TmfEventMatching matching, int traceno) {
+        super(CtfTmfEvent.class,
+                TmfTimeRange.ETERNITY,
+                0,
+                TmfDataRequest.ALL_DATA,
+                ITmfDataRequest.ExecutionType.FOREGROUND);
+        this.matching = matching;
+        this.traceno = traceno;
+    }
+
+    @Override
+    public void handleData(final ITmfEvent event) {
+        super.handleData(event);
+        if (event != null) {
+            matching.matchEvent(event, traceno);
+        }
+    }
+
+    @Override
+    public void handleSuccess() {
+        super.handleSuccess();
+    }
+
+    @Override
+    public void handleCancel() {
+        super.handleCancel();
+    }
+
+    @Override
+    public void handleFailure() {
+        super.handleFailure();
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfNetworkEventMatching.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfNetworkEventMatching.java
new file mode 100644 (file)
index 0000000..06536f4
--- /dev/null
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.event.matching;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.matching.IMatchProcessingUnit;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventDependency;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * This class matches events typically network-style, ie. where some events are
+ * 'send' events and the other 'receive' events or out/in events
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public class TmfNetworkEventMatching extends TmfEventMatching {
+
+    /**
+     * Hashtables for unmatches incoming events
+     */
+    private final List<Map<List<Object>, ITmfEvent>> fUnmatchedIn = new ArrayList<Map<List<Object>, ITmfEvent>>();
+
+    /**
+     * Hashtables for unmatches outgoing events
+     */
+    private final List<Map<List<Object>, ITmfEvent>> fUnmatchedOut = new ArrayList<Map<List<Object>, ITmfEvent>>();
+
+    /**
+     * Enum for in and out types
+     */
+    public enum Direction {
+        /**
+         * The event is a 'receive' type of event
+         */
+        IN,
+        /**
+         * The event is a 'send' type of event
+         */
+        OUT,
+    }
+
+    /**
+     * Constructor with multiple traces and match processing object
+     *
+     * @param traces
+     *            The set of traces for which to match events
+     */
+    public TmfNetworkEventMatching(ITmfTrace[] traces) {
+        this(traces, new TmfEventMatches());
+    }
+
+    /**
+     * Constructor with multiple traces and match processing object
+     *
+     * @param traces
+     *            The set of traces for which to match events
+     * @param tmfEventMatches
+     *            The match processing class
+     */
+    public TmfNetworkEventMatching(ITmfTrace[] traces, IMatchProcessingUnit tmfEventMatches) {
+        super(traces, tmfEventMatches);
+    }
+
+    /**
+     * Method that initializes any data structure for the event matching
+     */
+    @Override
+    public void initMatching() {
+        // Initialize the matching infrastructure (unmatched event lists)
+        fUnmatchedIn.clear();
+        fUnmatchedOut.clear();
+        for (int i = 0; i < getTraces().length; i++) {
+            fUnmatchedIn.add(new HashMap<List<Object>, ITmfEvent>());
+            fUnmatchedOut.add(new HashMap<List<Object>, ITmfEvent>());
+        }
+        super.initMatching();
+    }
+
+    /**
+     * Function that counts the events in a hashtable.
+     *
+     * @param tbl
+     *            The table to count events for
+     * @return The number of events
+     */
+    protected int countEvents(Map<List<Object>, ITmfEvent> tbl) {
+        return tbl.size();
+    }
+
+    @Override
+    protected MatchingType getMatchingType() {
+        return MatchingType.NETWORK;
+    }
+
+    /**
+     * Matches one event
+     *
+     * @param event
+     *            The event to match
+     * @param traceno
+     *            The number of the trace this event belongs to
+     */
+    @Override
+    public void matchEvent(ITmfEvent event, int traceno) {
+        /*
+         * TODO: Should find a way to assert the type is right here. For now we
+         * just hope developers register NetworkMatchDefinition for Network
+         * match types...
+         */
+        TmfNetworkMatchDefinition def = (TmfNetworkMatchDefinition) getEventDefinition(event.getTrace());
+        if (def == null) {
+            return;
+        }
+
+        Direction evType = def.getDirection(event);
+        if (evType == null) {
+            return;
+        }
+
+        /* Get the event's unique fields */
+        List<Object> eventKey = def.getUniqueField(event);
+        List<Map<List<Object>, ITmfEvent>> unmatchedTbl, companionTbl;
+
+        /* Point to the appropriate table */
+        switch (evType) {
+        case IN:
+            unmatchedTbl = fUnmatchedIn;
+            companionTbl = fUnmatchedOut;
+            break;
+        case OUT:
+            unmatchedTbl = fUnmatchedOut;
+            companionTbl = fUnmatchedIn;
+            break;
+        default:
+            return;
+        }
+
+        boolean found = false;
+        TmfEventDependency dep = null;
+        /* Search for the event in the companion table */
+        for (Map<List<Object>, ITmfEvent> map : companionTbl) {
+            if (map.containsKey(eventKey)) {
+                found = true;
+                ITmfEvent companionEvent = map.get(eventKey);
+
+                /* Remove the element from the companion table */
+                map.remove(eventKey);
+
+                /* Create the dependency object */
+                switch (evType) {
+                case IN:
+                    dep = new TmfEventDependency(companionEvent, event);
+                    break;
+                case OUT:
+                    dep = new TmfEventDependency(event, companionEvent);
+                    break;
+                default:
+                    break;
+
+                }
+            }
+        }
+
+        /*
+         * If no companion was found, add the event to the appropriate unMatched
+         * lists
+         */
+        if (found) {
+            getProcessingUnit().addMatch(dep);
+        } else {
+            /*
+             * If an event is already associated with this key, do not add it
+             * again, we keep the first event chronologically, so if its match
+             * is eventually found, it is associated with the first send or
+             * receive event. At best, it is a good guess, at worst, the match
+             * will be too far off to be accurate. Too bad!
+             *
+             * TODO: maybe instead of just one event, we could have a list of
+             * events as value for the unmatched table. Not necessary right now
+             * though
+             */
+            if (!unmatchedTbl.get(traceno).containsKey(eventKey)) {
+                unmatchedTbl.get(traceno).put(eventKey, event);
+            }
+        }
+
+    }
+
+    /**
+     * Prints stats from the matching
+     *
+     * @return string of statistics
+     */
+    @SuppressWarnings("nls")
+    @Override
+    public String toString() {
+        final String cr = System.getProperty("line.separator");
+        StringBuilder b = new StringBuilder();
+        b.append(getProcessingUnit());
+        for (int i = 0; i < getTraces().length; i++) {
+            b.append("Trace " + i + ":" + cr +
+                    "  " + countEvents(fUnmatchedIn.get(i)) + " unmatched incoming events" + cr +
+                    "  " + countEvents(fUnmatchedOut.get(i)) + " unmatched outgoing events" + cr);
+        }
+
+        return b.toString();
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfNetworkMatchDefinition.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfNetworkMatchDefinition.java
new file mode 100644 (file)
index 0000000..1a0d2e1
--- /dev/null
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.event.matching;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfNetworkEventMatching.Direction;
+
+/**
+ * Base class for all network match definitions, ie traces with send and receive
+ * events
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public abstract class TmfNetworkMatchDefinition implements ITmfMatchEventDefinition {
+
+    /**
+     * Returns the direction of this event, whether 'send', 'receive' or null if
+     * event is neither
+     *
+     * @param event
+     *            The event to check
+     * @return The direction of this event, null if uninteresting event
+     */
+    public abstract Direction getDirection(ITmfEvent event);
+
+}
index f41bf094ba9ffabacbb40c115bfd9197facea686..36dbdbf5f2bc2ca70e0c648185532e8ac626abeb 100644 (file)
@@ -69,11 +69,6 @@ public interface ITmfDataRequest {
      */
     int getNbRequested();
 
-    /**
-     * @return the block size (for BG requests)
-     */
-    int getBlockSize();
-
     /**
      * @return the number of events read so far
      */
index 650b4e7c057582d6a799ea8dc93e27cfd905d8ae..2076525d845992f8268045a299821205652dac5a 100644 (file)
@@ -8,6 +8,7 @@
  *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
+ *   Alexandre Montplaisir - Consolidated constructors
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.core.request;
@@ -18,19 +19,20 @@ import org.eclipse.linuxtools.internal.tmf.core.TmfCoreTracer;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 
 /**
- * TmfDataRequests are used to obtain blocks of contiguous data from a data provider. Open ranges can be used,
- * especially for continuous streaming.
+ * TmfDataRequests are used to obtain blocks of contiguous data from a data
+ * provider. Open ranges can be used, especially for continuous streaming.
  * <p>
- * The request is processed asynchronously by a TmfProvider and, as blocks of data become available, handleData() is
- * invoked synchronously for each block. Upon return, the data instances go out of scope and become eligible for gc. It
- * is is thus the responsibility of the requester to either clone or keep a reference to the data it wishes to track
- * specifically.
+ * The request is processed asynchronously by a TmfProvider and, as blocks of
+ * data become available, handleData() is invoked synchronously for each block.
+ * Upon return, the data instances go out of scope and become eligible for gc.
+ * It is is thus the responsibility of the requester to either clone or keep a
+ * reference to the data it wishes to track specifically.
  * <p>
- * This data block approach is used to avoid busting the heap for very large trace files. The block size is
- * configurable.
+ * This data block approach is used to avoid busting the heap for very large
+ * trace files. The block size is configurable.
  * <p>
- * The TmfProvider indicates that the request is completed by calling done(). The request can be canceled at any time
- * with cancel().
+ * The TmfProvider indicates that the request is completed by calling done().
+ * The request can be canceled at any time with cancel().
  * <p>
  * Typical usage:
  *
@@ -60,10 +62,12 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
  * </i></code>
  * </pre>
  *
- * TODO: Consider decoupling from "time range", "rank", etc and for the more generic notion of "criteria". This would
- * allow to extend for "time range", etc instead of providing specialized constructors. This also means removing the
- * criteria info from the data structure (with the possible exception of fNbRequested). The nice thing about it is that
- * it would prepare us well for the coming generation of analysis tools.
+ * TODO: Consider decoupling from "time range", "rank", etc and for the more
+ * generic notion of "criteria". This would allow to extend for "time range",
+ * etc instead of providing specialized constructors. This also means removing
+ * the criteria info from the data structure (with the possible exception of
+ * fNbRequested). The nice thing about it is that it would prepare us well for
+ * the coming generation of analysis tools.
  *
  * TODO: Implement request failures (codes, etc...)
  *
@@ -76,9 +80,6 @@ public abstract class TmfDataRequest implements ITmfDataRequest {
     // Constants
     // ------------------------------------------------------------------------
 
-    /** The default maximum number of events per chunk */
-    public static final int DEFAULT_BLOCK_SIZE = 1000;
-
     /** The request count for all the events */
     public static final int ALL_DATA = Integer.MAX_VALUE;
 
@@ -100,9 +101,6 @@ public abstract class TmfDataRequest implements ITmfDataRequest {
     /** The number of requested events (ALL_DATA for all) */
     protected int fNbRequested;
 
-    /** The block size (for BG requests) */
-    private final int fBlockSize;
-
     /** The number of reads so far */
     private int fNbRead;
 
@@ -124,104 +122,30 @@ public abstract class TmfDataRequest implements ITmfDataRequest {
         fRequestNumber = 0;
     }
 
-    /**
-     * Request all the events of a given type (high priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     */
-    public TmfDataRequest(Class<? extends ITmfEvent> dataType) {
-        this(dataType, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request all the events of a given type (given priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param priority the requested execution priority
-     */
-    public TmfDataRequest(Class<? extends ITmfEvent> dataType, ExecutionType priority) {
-        this(dataType, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
-    }
-
-    /**
-     * Request all the events of a given type from the given index (high priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param index the index of the first event to retrieve
-     */
-    public TmfDataRequest(Class<? extends ITmfEvent> dataType, long index) {
-        this(dataType, index, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request all the events of a given type from the given index (given priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param index the index of the first event to retrieve
-     * @param priority the requested execution priority
-     */
-    public TmfDataRequest(Class<? extends ITmfEvent> dataType, long index, ExecutionType priority) {
-        this(dataType, index, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
-    }
-
-    /**
-     * Request 'n' events of a given type from the given index (high priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param index the index of the first event to retrieve
-     * @param nbRequested the number of events requested
-     */
-    public TmfDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested) {
-        this(dataType, index, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request 'n' events of a given type from the given index (given priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param index the index of the first event to retrieve
-     * @param nbRequested the number of events requested
-     * @param priority the requested execution priority
-     */
-    public TmfDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, ExecutionType priority) {
-        this(dataType, index, nbRequested, DEFAULT_BLOCK_SIZE, priority);
-    }
-
-    /**
-     * Request 'n' events of a given type from the given index (high priority).
-     * Events are returned in blocks of the given size.
-     *
-     * @param dataType the requested data type
-     * @param index the index of the first event to retrieve
-     * @param nbRequested the number of events requested
-     * @param blockSize the number of events per block
-     */
-    public TmfDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, int blockSize) {
-        this(dataType, index, nbRequested, blockSize, ExecutionType.FOREGROUND);
-    }
-
     /**
      * Request 'n' events of a given type from the given index (given priority).
      * Events are returned in blocks of the given size.
      *
-     * @param dataType the requested data type
-     * @param index the index of the first event to retrieve
-     * @param nbRequested the number of events requested
-     * @param blockSize the number of events per block
-     * @param priority the requested execution priority
+     * @param dataType
+     *            The requested data type.
+     * @param index
+     *            The index of the first event to retrieve. Use '0' to start at
+     *            the beginning of the trace.
+     * @param nbRequested
+     *            The number of events requested. You can use
+     *            {@link TmfDataRequest#ALL_DATA} to specify you want all events
+     *            in the trace.
+     * @param priority
+     *            The requested execution priority.
      */
-    public TmfDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, int blockSize, ExecutionType priority) {
+    public TmfDataRequest(Class<? extends ITmfEvent> dataType,
+            long index,
+            int nbRequested,
+            ExecutionType priority) {
         fRequestId = fRequestNumber++;
         fDataType = dataType;
         fIndex = index;
         fNbRequested = nbRequested;
-        fBlockSize = blockSize;
         fExecType = priority;
         fNbRead = 0;
 
@@ -278,14 +202,6 @@ public abstract class TmfDataRequest implements ITmfDataRequest {
         return fNbRequested;
     }
 
-    /**
-     * @return the block size (for BG requests)
-     */
-    @Override
-    public int getBlockSize() {
-        return fBlockSize;
-    }
-
     /**
      * @return the number of events read so far
      */
@@ -542,6 +458,6 @@ public abstract class TmfDataRequest implements ITmfDataRequest {
             name = name.substring(dot + 1);
         }
         return "[" + name + "(" + fRequestId + "," + fDataType.getSimpleName()+ "," + getExecType()
-                + "," + fIndex + "," + fNbRequested + "," + getBlockSize() + ")]";
+                + "," + fIndex + "," + fNbRequested + ")]";
     }
 }
index 11f966f3593c64a72a1e2ce44f7908be7fd8bce1..32dd8fb211545f591615e6bfaade76d168fe6dc9 100644 (file)
@@ -8,6 +8,7 @@
  *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
+ *   Alexandre Montplaisir - Consolidated constructors
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.core.request;
@@ -28,136 +29,40 @@ public abstract class TmfEventRequest extends TmfDataRequest implements ITmfEven
     // Attributes
     // ------------------------------------------------------------------------
 
-    private final TmfTimeRange fRange; // The requested events time range
+    private final TmfTimeRange fRange; // The requested events time range
 
     // ------------------------------------------------------------------------
-    // Constructors
+    // Constructor
     // ------------------------------------------------------------------------
 
     /**
-     * Request all the events of a given type (high priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
+     * Request 'n' events of a given type for the given time range (given
+     * priority). Events are returned in blocks of the given size.
      *
-     * @param dataType the requested data type
+     * @param dataType
+     *            The requested data type.
+     * @param range
+     *            The time range of the requested events. You can use
+     *            {@link TmfTimeRange#ETERNITY} to indicate you want to cover
+     *            the whole trace.
+     * @param index
+     *            The index of the first event to retrieve. You can use '0' to
+     *            start at the beginning of the trace.
+     * @param nbRequested
+     *            The number of events requested. You can use
+     *            {@link TmfEventRequest#ALL_DATA} to indicate you want all
+     *            events in the time range.
+     * @param priority
+     *            The requested execution priority.
+     * @since 3.0
      */
-    public TmfEventRequest(Class<? extends ITmfEvent> dataType) {
-        this(dataType, TmfTimeRange.ETERNITY, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request all the events of a given type (given priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param priority the requested execution priority
-     */
-    public TmfEventRequest(Class<? extends ITmfEvent> dataType, ExecutionType priority) {
-        this(dataType, TmfTimeRange.ETERNITY, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
-    }
-
-    /**
-     * Request all the events of a given type for the given time range (high priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     */
-    public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range) {
-        this(dataType, range, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request all the events of a given type for the given time range (given priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param priority the requested execution priority
-     */
-    public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, ExecutionType priority) {
-        this(dataType, range, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
-    }
-
-    /**
-     * Request 'n' events of a given type from the given time range (high priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param nbRequested the number of events requested
-     */
-    public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested) {
-        this(dataType, range, 0, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request 'n' events of a given type for the given time range (given priority)
-     * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param nbRequested the number of events requested
-     * @param priority the requested execution priority
-     */
-    public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested, ExecutionType priority) {
-        this(dataType, range, 0, nbRequested, DEFAULT_BLOCK_SIZE, priority);
-    }
-
-    /**
-     * Request 'n' events of a given type for the given time range (high priority).
-     * Events are returned in blocks of the given size.
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param nbRequested the number of events requested
-     * @param blockSize the number of events per block
-     */
-    public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested, int blockSize) {
-       this(dataType, range, 0, nbRequested, blockSize, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request 'n' events of a given type for the given time range (high priority).
-     * Events are returned in blocks of the given size.
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param index the index of the first event to retrieve
-     * @param nbRequested the number of events requested
-     * @param blockSize the number of events per block
-     */
-    public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, long index, int nbRequested, int blockSize) {
-        this(dataType, range, index, nbRequested, blockSize, ExecutionType.FOREGROUND);
-    }
-
-    /**
-     * Request 'n' events of a given type for the given time range (given priority).
-     * Events are returned in blocks of the given size.
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param nbRequested the number of events requested
-     * @param blockSize the number of events per block
-     * @param priority the requested execution priority
-     */
-    public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested, int blockSize, ExecutionType priority) {
-       this(dataType, range, 0, nbRequested, blockSize, priority);
-    }
-
-    /**
-     * Request 'n' events of a given type for the given time range (given priority).
-     * Events are returned in blocks of the given size.
-     *
-     * @param dataType the requested data type
-     * @param range the time range of the requested events
-     * @param index the index of the first event to retrieve
-     * @param nbRequested the number of events requested
-     * @param blockSize the number of events per block
-     * @param priority the requested execution priority
-     */
-    public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, long index, int nbRequested, int blockSize, ExecutionType priority) {
-       super(dataType, index, nbRequested, blockSize, priority);
-       fRange = range;
+    public TmfEventRequest(Class<? extends ITmfEvent> dataType,
+            TmfTimeRange range,
+            long index,
+            int nbRequested,
+            ExecutionType priority) {
+        super(dataType, index, nbRequested, priority);
+        fRange = range;
 
         if (TmfCoreTracer.isRequestTraced()) {
             String type = getClass().getName();
@@ -181,7 +86,7 @@ public abstract class TmfEventRequest extends TmfDataRequest implements ITmfEven
      * @since 2.0
      */
     @Override
-       public TmfTimeRange getRange() {
+    public TmfTimeRange getRange() {
         return fRange;
     }
 
@@ -190,14 +95,15 @@ public abstract class TmfEventRequest extends TmfDataRequest implements ITmfEven
     // ------------------------------------------------------------------------
 
     /**
-     * this method is called by the event provider to set the index corresponding
-     * to the time range start time once it is known
+     * this method is called by the event provider to set the index
+     * corresponding to the time range start time once it is known
      *
-     * @param index the start index
+     * @param index
+     *            the start index
      */
     @Override
-       public void setStartIndex(int index) {
-       setIndex(index);
+    public void setStartIndex(int index) {
+        setIndex(index);
     }
 
     // ------------------------------------------------------------------------
@@ -207,16 +113,16 @@ public abstract class TmfEventRequest extends TmfDataRequest implements ITmfEven
     @Override
     // All requests have a unique id
     public int hashCode() {
-       return getRequestId();
+        return getRequestId();
     }
 
     @Override
     public boolean equals(Object other) {
-       if (other instanceof TmfEventRequest) {
-               TmfEventRequest request = (TmfEventRequest) other;
-               return super.equals(other) && request.fRange.equals(fRange);
-       }
-       return false;
+        if (other instanceof TmfEventRequest) {
+            TmfEventRequest request = (TmfEventRequest) other;
+            return super.equals(other) && request.fRange.equals(fRange);
+        }
+        return false;
     }
 
     @Override
@@ -228,7 +134,7 @@ public abstract class TmfEventRequest extends TmfDataRequest implements ITmfEven
             name = name.substring(dot + 1);
         }
         return "[" + name + "(" + getRequestId() + "," + getDataType().getSimpleName() + "," + getExecType()
-                + "," + getRange() + "," + getIndex() + "," + getNbRequested() + "," + getBlockSize() + ")]";
+                + "," + getRange() + "," + getIndex() + "," + getNbRequested() + ")]";
     }
 
 }
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/signal/TmfTraceSynchronizedSignal.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/signal/TmfTraceSynchronizedSignal.java
new file mode 100644 (file)
index 0000000..fa24bbf
--- /dev/null
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.signal;
+
+import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationAlgorithm;
+
+/**
+ * Signal indicating a trace synchronization has been done
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public class TmfTraceSynchronizedSignal extends TmfSignal {
+
+    private final SynchronizationAlgorithm fAlgoSync;
+
+    /**
+     * Constructor
+     *
+     * @param source
+     *            Object sending this signal
+     * @param algoSync
+     *            The synchronization algorithm used
+     */
+    public TmfTraceSynchronizedSignal(Object source, SynchronizationAlgorithm algoSync) {
+        super(source);
+        fAlgoSync = algoSync;
+    }
+
+    /**
+     * Synchronization algorithm getter
+     *
+     * @return The algorithm object
+     */
+    public SynchronizationAlgorithm getSyncAlgo() {
+        return fAlgoSync;
+    }
+
+    @Override
+    public String toString() {
+        return "[" + getClass().getSimpleName() + " (" + fAlgoSync.toString() + ")]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+}
index 87a817d273f7802286eb99f6332aafda96da15a3..debc40667ce69ae015ce6b626299eb3ca802311f 100644 (file)
@@ -224,8 +224,8 @@ public class TmfEventsStatistics implements ITmfStatistics {
         private long total;
 
         public StatsTotalRequest(ITmfTrace trace, TmfTimeRange range) {
-            super(trace.getEventType(), range, TmfDataRequest.ALL_DATA,
-                    trace.getCacheSize(), ITmfDataRequest.ExecutionType.BACKGROUND);
+            super(trace.getEventType(), range, 0, TmfDataRequest.ALL_DATA,
+                    ITmfDataRequest.ExecutionType.BACKGROUND);
             total = 0;
         }
 
@@ -252,8 +252,8 @@ public class TmfEventsStatistics implements ITmfStatistics {
         private final Map<String, Long> stats;
 
         public StatsPerTypeRequest(ITmfTrace trace, TmfTimeRange range) {
-            super(trace.getEventType(), range, TmfDataRequest.ALL_DATA,
-                    trace.getCacheSize(), ITmfDataRequest.ExecutionType.BACKGROUND);
+            super(trace.getEventType(), range, 0, TmfDataRequest.ALL_DATA,
+                    ITmfDataRequest.ExecutionType.BACKGROUND);
             this.stats = new HashMap<String, Long>();
         }
 
@@ -316,8 +316,8 @@ public class TmfEventsStatistics implements ITmfStatistics {
                     new TmfTimeRange(
                             new TmfTimestamp(borders[0], SCALE),
                             new TmfTimestamp(endTime, SCALE)),
+                    0,
                     TmfDataRequest.ALL_DATA,
-                    trace.getCacheSize(),
                     ITmfDataRequest.ExecutionType.BACKGROUND);
 
             /* Prepare the results map, with all counts at 0 */
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/ITmfTimestampTransform.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/ITmfTimestampTransform.java
new file mode 100644 (file)
index 0000000..55bc9e9
--- /dev/null
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.synchronization;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+
+/**
+ * This class contains a formula to transform the value of a timestamp, for
+ * example after trace synchronization
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public interface ITmfTimestampTransform {
+
+    /**
+     * Transforms a timestamp
+     *
+     * @param timestamp
+     *            The timestamp to transform
+     * @return the transformed timestamp
+     */
+    ITmfTimestamp transform(ITmfTimestamp timestamp);
+
+    /**
+     * Transforms a timestamp value
+     *
+     * @param timestamp
+     *            The timestamp to transform
+     * @return the transformed value
+     */
+    long transform(long timestamp);
+
+    /**
+     * Returns a timestamp transform that is the composition of two timestamp
+     * transforms.
+     *
+     * @param composeWith
+     *            The transform to first apply on the timestamp before applying
+     *            the current object
+     * @return A new timestamp transform object with the resulting composition.
+     */
+    ITmfTimestampTransform composeWith(ITmfTimestampTransform composeWith);
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/Messages.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/Messages.java
new file mode 100644 (file)
index 0000000..c520981
--- /dev/null
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.synchronization;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Messages class
+ *
+ * @since 3.0
+ */
+@SuppressWarnings("javadoc")
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.core.synchronization.messages"; //$NON-NLS-1$
+    public static String SyncAlgorithmFullyIncremental_absent;
+    public static String SyncAlgorithmFullyIncremental_alpha;
+    public static String SyncAlgorithmFullyIncremental_beta;
+    public static String SyncAlgorithmFullyIncremental_T_;
+    public static String SyncAlgorithmFullyIncremental_otherformula;
+    public static String SyncAlgorithmFullyIncremental_mult;
+    public static String SyncAlgorithmFullyIncremental_add;
+    public static String SyncAlgorithmFullyIncremental_ub;
+    public static String SyncAlgorithmFullyIncremental_lb;
+    public static String SyncAlgorithmFullyIncremental_accuracy;
+    public static String SyncAlgorithmFullyIncremental_accurate;
+    public static String SyncAlgorithmFullyIncremental_approx;
+    public static String SyncAlgorithmFullyIncremental_fail;
+    public static String SyncAlgorithmFullyIncremental_incomplete;
+    public static String SyncAlgorithmFullyIncremental_nbmatch;
+    public static String SyncAlgorithmFullyIncremental_nbacc;
+    public static String SyncAlgorithmFullyIncremental_reftrace;
+    public static String SyncAlgorithmFullyIncremental_othertrace;
+    public static String SyncAlgorithmFullyIncremental_refformula;
+    public static String SyncAlgorithmFullyIncremental_NA;
+    public static String SyncAlgorithmFullyIncremental_quality;
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SyncAlgorithmFullyIncremental.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SyncAlgorithmFullyIncremental.java
new file mode 100644 (file)
index 0000000..7360e7f
--- /dev/null
@@ -0,0 +1,572 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.synchronization;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventDependency;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * Class implementing fully incremental trace synchronization approach as
+ * described in
+ *
+ * Masoume Jabbarifar, Michel Dagenais and Alireza Shameli-Sendi,
+ * "Streaming Mode Incremental Clock Synchronization"
+ *
+ * Since the algorithm itself applies to two traces, it is implemented in a
+ * private class, while this public class manages the synchronization between
+ * all traces.
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public class SyncAlgorithmFullyIncremental extends SynchronizationAlgorithm {
+
+    /**
+     * Auto-generated serial UID
+     */
+    private static final long serialVersionUID = -1782788842774838830L;
+
+    private static final MathContext fMc = MathContext.DECIMAL128;
+
+    private final List<ConvexHull> fSyncs;
+
+    /**
+     * Initialization of the attributes
+     */
+    public SyncAlgorithmFullyIncremental() {
+        fSyncs = new LinkedList<ConvexHull>();
+    }
+
+    /**
+     * Function called after all matching has been done, to do any post-match
+     * treatment. For this class, it calculates stats, while the data is
+     * available
+     */
+    @Override
+    public void matchingEnded() {
+        getStats();
+    }
+
+    @Override
+    public void init(ITmfTrace[] fTraces) {
+        fSyncs.clear();
+        /* Create a convex hull for all trace pairs */
+        for (int i = 0; i < fTraces.length; i++) {
+            for (int j = i + 1; j < fTraces.length; j++) {
+                ConvexHull algo = new ConvexHull(fTraces[i].getName(), fTraces[j].getName());
+                fSyncs.add(algo);
+            }
+        }
+    }
+
+    @Override
+    protected void processMatch(TmfEventDependency match) {
+        String trace1 = match.getSourceEvent().getTrace().getName();
+        String trace2 = match.getDestinationEvent().getTrace().getName();
+
+        /* Process only if source and destination are different */
+        if (trace1.equals(trace2)) {
+            return;
+        }
+
+        /* Check if a convex hull algorithm already exists for these 2 traces */
+        ConvexHull algo = null;
+        for (ConvexHull traceSync : fSyncs) {
+            if (traceSync.isForTraces(trace1, trace2)) {
+                algo = traceSync;
+            }
+        }
+        if (algo == null) {
+            algo = new ConvexHull(trace1, trace2);
+            fSyncs.add(algo);
+        }
+        algo.processMatch(match);
+
+    }
+
+    @Override
+    public ITmfTimestampTransform getTimestampTransform(ITmfTrace trace) {
+        return getTimestampTransform(trace.getName());
+    }
+
+    @Override
+    public ITmfTimestampTransform getTimestampTransform(String name) {
+        for (ConvexHull traceSync : fSyncs) {
+            if (traceSync.isTraceSynced(name)) {
+                /*
+                 * Since there are many traces, maybe the reference trace is
+                 * also synchronized, so we need to chain sync formulas
+                 */
+                ITmfTimestampTransform refTt = getTimestampTransform(traceSync.getReferenceTrace());
+                return refTt.composeWith(traceSync.getTimestampTransform(name));
+            }
+        }
+        return TmfTimestampTransform.IDENTITY;
+    }
+
+    @Override
+    public SyncQuality getSynchronizationQuality(ITmfTrace trace1, ITmfTrace trace2) {
+        for (ConvexHull traceSync : fSyncs) {
+            if (traceSync.isForTraces(trace1.getName(), trace2.getName())) {
+                return traceSync.getQuality();
+            }
+        }
+        return SyncQuality.ABSENT;
+    }
+
+    @Override
+    public boolean isTraceSynced(String name) {
+        boolean traceSynced = false;
+        for (ConvexHull traceSync : fSyncs) {
+            traceSynced = traceSynced || traceSync.isTraceSynced(name);
+        }
+        return traceSynced;
+    }
+
+    /**
+     * Rename one of the traces in the synchronization
+     *
+     * @param oldname
+     *            The name of the original trace
+     * @param newname
+     *            The new name of the trace
+     */
+    @Override
+    public void renameTrace(String oldname, String newname) {
+        for (ConvexHull traceSync : fSyncs) {
+            traceSync.renameTrace(oldname, newname);
+        }
+    }
+
+    @Override
+    public Map<String, Map<String, Object>> getStats() {
+        Map<String, Map<String, Object>> statmap = new LinkedHashMap<String, Map<String, Object>>();
+        for (ConvexHull traceSync : fSyncs) {
+            statmap.put(traceSync.getReferenceTrace() + " <==> " + traceSync.getOtherTrace(), traceSync.getStats()); //$NON-NLS-1$
+        }
+        return statmap;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder b = new StringBuilder();
+        b.append(getClass().getSimpleName() + " "); //$NON-NLS-1$
+        b.append(fSyncs);
+        return b.toString();
+    }
+
+    /**
+     * This is the actual synchronization algorithm between two traces using
+     * convex hull
+     */
+    private class ConvexHull implements Serializable {
+
+        private static final long serialVersionUID = 8309351175030935291L;
+
+        /**
+         * The list of meaningful points on the upper hull (received by the
+         * reference trace, below in a graph)
+         */
+        private final LinkedList<SyncPoint> fUpperBoundList = new LinkedList<SyncPoint>();
+
+        /**
+         * The list of meaninful points on the lower hull (sent by the reference
+         * trace, above in a graph)
+         */
+        private final LinkedList<SyncPoint> fLowerBoundList = new LinkedList<SyncPoint>();
+
+        /** Points forming the line with maximum slope */
+        private final SyncPoint[] fLmax;
+
+        /** Points forming the line with minimum slope */
+        private final SyncPoint[] fLmin;
+
+        /**
+         * Slopes and ordinate at origin of respectively fLmin, fLmax and the
+         * bisector
+         */
+        private BigDecimal fAlphamin, fBetamax, fAlphamax, fBetamin, fAlpha, fBeta;
+
+        private int fNbMatches, fNbAccurateMatches;
+        private String fReferenceTrace = "", fOtherTrace = ""; //$NON-NLS-1$//$NON-NLS-2$
+        private SyncQuality fQuality;
+
+        private Map<String, Object> fStats = new LinkedHashMap<String, Object>();
+
+        /**
+         * Initialization of the attributes
+         *
+         * @param trace1
+         *            Name of the first trace
+         * @param trace2
+         *            Name of the second trace
+         */
+        public ConvexHull(String trace1, String trace2) {
+            if (trace1.compareTo(trace2) > 0) {
+                fReferenceTrace = trace2;
+                fOtherTrace = trace1;
+            } else {
+                fReferenceTrace = trace1;
+                fOtherTrace = trace2;
+            }
+            fLmax = new SyncPoint[2];
+            fLmin = new SyncPoint[2];
+            fAlpha = BigDecimal.ONE;
+            fAlphamax = BigDecimal.ONE;
+            fAlphamin = BigDecimal.ONE;
+            fBeta = BigDecimal.ZERO;
+            fBetamax = BigDecimal.ZERO;
+            fBetamin = BigDecimal.ZERO;
+            fNbMatches = 0;
+            fNbAccurateMatches = 0;
+            fQuality = SyncQuality.ABSENT;
+        }
+
+        protected void processMatch(TmfEventDependency match) {
+
+            LinkedList<SyncPoint> boundList, otherBoundList;
+
+            SyncPoint[] line, otherLine;
+            SyncPoint p;
+            int inversionFactor = 1;
+            boolean qualify = false;
+            fNbMatches++;
+
+            /* Initialize data depending on the which hull the match is part of */
+            if (match.getSourceEvent().getTrace().getName().compareTo(match.getDestinationEvent().getTrace().getName()) > 0) {
+                boundList = fUpperBoundList;
+                otherBoundList = fLowerBoundList;
+                line = fLmin;
+                otherLine = fLmax;
+                p = new SyncPoint(match.getDestinationEvent(), match.getSourceEvent());
+                inversionFactor = 1;
+            } else {
+                boundList = fLowerBoundList;
+                otherBoundList = fUpperBoundList;
+                line = fLmax;
+                otherLine = fLmin;
+                p = new SyncPoint(match.getSourceEvent(), match.getDestinationEvent());
+                inversionFactor = -1;
+            }
+
+            /*
+             * Does the message qualify for the hull, or is in on the wrong side
+             * of the reference line
+             */
+            if ((line[0] == null) || (line[1] == null) || (p.crossProduct(line[0], line[1]) * inversionFactor > 0)) {
+                /*
+                 * If message qualifies, verify if points need to be removed
+                 * from the hull and add the new point as the maximum reference
+                 * point for the line. Also clear the stats that are not good
+                 * anymore
+                 */
+                fNbAccurateMatches++;
+                qualify = true;
+                removeUselessPoints(p, boundList, inversionFactor);
+                line[1] = p;
+                fStats.clear();
+            }
+
+            /*
+             * Adjust the boundary of the reference line and if one of the
+             * reference point of the other line was removed from the hull, also
+             * adjust the other line
+             */
+            adjustBound(line, otherBoundList, inversionFactor);
+            if ((otherLine[1] != null) && !boundList.contains(otherLine[0])) {
+                adjustBound(otherLine, boundList, inversionFactor * -1);
+            }
+
+            if (qualify) {
+                approximateSync();
+            }
+
+        }
+
+        /**
+         * Calculates slopes and ordinate at origin of fLmax and fLmin to obtain
+         * and approximation of the synchronization at this time
+         */
+        private void approximateSync() {
+            /**
+             * Line slopes functions
+             *
+             * Lmax = alpha_max T + beta_min
+             *
+             * Lmin = alpha_min T + beta_max
+             */
+            if ((fLmax[0] != null) || (fLmin[0] != null)) {
+                fAlphamax = fLmax[1].getAlpha(fLmax[0]);
+                fBetamin = fLmax[1].getBeta(fAlphamax);
+                fAlphamin = fLmin[1].getAlpha(fLmin[0]);
+                fBetamax = fLmin[1].getBeta(fAlphamin);
+                fAlpha = fAlphamax.add(fAlphamin).divide(BigDecimal.valueOf(2), fMc);
+                fBeta = fBetamin.add(fBetamax).divide(BigDecimal.valueOf(2), fMc);
+                if ((fLmax[0] == null) || (fLmin[0] == null)) {
+                    fQuality = SyncQuality.APPROXIMATE;
+                }
+                else if (fAlphamax.compareTo(fAlphamin) > 0) {
+                    fQuality = SyncQuality.ACCURATE;
+                } else {
+                    /* Lines intersect, not good */
+                    fQuality = SyncQuality.FAIL;
+                }
+            } else if (((fLmax[0] == null) && (fLmin[1] == null))
+                    || ((fLmax[1] == null) && (fLmin[0] == null))) {
+                /* Either there is no upper hull point or no lower hull */
+                fQuality = SyncQuality.INCOMPLETE;
+            }
+        }
+
+        /*
+         * Verify if the line should be adjusted to be more accurate give the
+         * hull
+         */
+        private void adjustBound(SyncPoint[] line, LinkedList<SyncPoint> otherBoundList, int inversionFactor) {
+            SyncPoint minPoint = null, nextPoint;
+            boolean finishedSearch = false;
+
+            /*
+             * Find in the other bound, the origin point of the line, start from
+             * the beginning if the point was lost
+             */
+            int i = Math.max(0, otherBoundList.indexOf(line[0]));
+
+            while ((i < otherBoundList.size() - 1) && !finishedSearch) {
+                minPoint = otherBoundList.get(i);
+                nextPoint = otherBoundList.get(i + 1);
+
+                /*
+                 * If the rotation (cross-product) is not optimal, move to next
+                 * point as reference for the line (if available)
+                 *
+                 * Otherwise, the current minPoint is the minPoint of the line
+                 */
+                if (minPoint.crossProduct(nextPoint, line[1]) * inversionFactor > 0) {
+                    if (nextPoint.getTimeX() < line[1].getTimeX()) {
+                        i++;
+                    } else {
+                        line[0] = null;
+                        finishedSearch = true;
+                    }
+                } else {
+                    line[0] = minPoint;
+                    finishedSearch = true;
+                }
+            }
+
+            if (line[0] == null) {
+                line[0] = minPoint;
+            }
+
+            /* Make sure point 0 is before point 1 */
+            if ((line[0] != null) && (line[0].getTimeX() > line[1].getTimeX())) {
+                line[0] = null;
+            }
+        }
+
+        /*
+         * When a point qualifies to be in a hull, we verify if any of the
+         * existing points need to be removed from the hull
+         */
+        private void removeUselessPoints(final SyncPoint p, final LinkedList<SyncPoint> boundList, final int inversionFactor) {
+
+            boolean checkRemove = true;
+
+            while (checkRemove && boundList.size() >= 2) {
+                if (p.crossProduct(boundList.get(boundList.size() - 2), boundList.getLast()) * inversionFactor > 0) {
+                    boundList.removeLast();
+                } else {
+                    checkRemove = false;
+                }
+            }
+            boundList.addLast(p);
+        }
+
+        public ITmfTimestampTransform getTimestampTransform(String name) {
+            if (name.equals(fOtherTrace) && (fQuality == SyncQuality.ACCURATE || fQuality == SyncQuality.APPROXIMATE || fQuality == SyncQuality.FAIL)) {
+                /* alpha: beta => 1 / fAlpha, -1 * fBeta / fAlpha); */
+                return new TmfTimestampTransformLinear(BigDecimal.ONE.divide(fAlpha, fMc), BigDecimal.valueOf(-1).multiply(fBeta).divide(fAlpha, fMc));
+            }
+            return TmfTimestampTransform.IDENTITY;
+        }
+
+        public SyncQuality getQuality() {
+            return fQuality;
+        }
+
+        public Map<String, Object> getStats() {
+            if (fStats.size() == 0) {
+                String syncQuality;
+                switch (fQuality) {
+                case ABSENT:
+                    syncQuality = Messages.SyncAlgorithmFullyIncremental_absent;
+                    break;
+                case ACCURATE:
+                    syncQuality = Messages.SyncAlgorithmFullyIncremental_accurate;
+                    break;
+                case APPROXIMATE:
+                    syncQuality = Messages.SyncAlgorithmFullyIncremental_approx;
+                    break;
+                case INCOMPLETE:
+                    syncQuality = Messages.SyncAlgorithmFullyIncremental_incomplete;
+                    break;
+                case FAIL:
+                default:
+                    syncQuality = Messages.SyncAlgorithmFullyIncremental_fail;
+                    break;
+                }
+
+                fStats.put(Messages.SyncAlgorithmFullyIncremental_reftrace, fReferenceTrace);
+                fStats.put(Messages.SyncAlgorithmFullyIncremental_othertrace, fOtherTrace);
+                fStats.put(Messages.SyncAlgorithmFullyIncremental_quality, syncQuality);
+                fStats.put(Messages.SyncAlgorithmFullyIncremental_alpha, fAlpha);
+                fStats.put(Messages.SyncAlgorithmFullyIncremental_beta, fBeta);
+                fStats.put(Messages.SyncAlgorithmFullyIncremental_ub, (fUpperBoundList.size() == 0) ? Messages.SyncAlgorithmFullyIncremental_NA : fUpperBoundList.size());
+                fStats.put(Messages.SyncAlgorithmFullyIncremental_lb, (fLowerBoundList.size() == 0) ? Messages.SyncAlgorithmFullyIncremental_NA : fLowerBoundList.size());
+                fStats.put(Messages.SyncAlgorithmFullyIncremental_accuracy, fAlphamax.subtract(fAlphamin).doubleValue()); // -
+                                                                                                                          // fAlphamin);
+                fStats.put(Messages.SyncAlgorithmFullyIncremental_nbmatch, (fNbMatches == 0) ? Messages.SyncAlgorithmFullyIncremental_NA : fNbMatches);
+                fStats.put(Messages.SyncAlgorithmFullyIncremental_nbacc, (fNbAccurateMatches == 0) ? Messages.SyncAlgorithmFullyIncremental_NA : fNbAccurateMatches);
+                fStats.put(Messages.SyncAlgorithmFullyIncremental_refformula, Messages.SyncAlgorithmFullyIncremental_T_ + fReferenceTrace);
+                fStats.put(Messages.SyncAlgorithmFullyIncremental_otherformula, fAlpha + Messages.SyncAlgorithmFullyIncremental_mult + Messages.SyncAlgorithmFullyIncremental_T_ + fReferenceTrace + Messages.SyncAlgorithmFullyIncremental_add + fBeta);
+            }
+            return fStats;
+
+        }
+
+        public String getReferenceTrace() {
+            return fReferenceTrace;
+        }
+
+        public String getOtherTrace() {
+            return fOtherTrace;
+        }
+
+        public boolean isTraceSynced(String name) {
+            /* Returns true if the timestamp transform is not identity */
+            return (name.equals(fOtherTrace) && (fQuality == SyncQuality.ACCURATE || fQuality == SyncQuality.APPROXIMATE || fQuality == SyncQuality.FAIL));
+        }
+
+        public boolean isForTraces(String trace1, String trace2) {
+            return ((fReferenceTrace.equals(trace1) && fOtherTrace.equals(trace2)) || (fReferenceTrace.equals(trace2) && fOtherTrace.equals(trace1)));
+        }
+
+        public void renameTrace(String oldname, String newname) {
+            if (oldname.equals(fOtherTrace)) {
+                fOtherTrace = newname;
+            } else if (oldname.equals(fReferenceTrace)) {
+                fReferenceTrace = newname;
+            }
+        }
+
+        private void writeObject(ObjectOutputStream s)
+                throws IOException {
+            /*
+             * Remove calculation data because most of it is not serializable.
+             * We have the statistics anyway
+             */
+            fUpperBoundList.clear();
+            fLowerBoundList.clear();
+            fLmin[0] = null;
+            fLmin[1] = null;
+            fLmax[0] = null;
+            fLmax[1] = null;
+            s.defaultWriteObject();
+
+        }
+
+        @SuppressWarnings("nls")
+        @Override
+        public String toString() {
+            StringBuilder b = new StringBuilder();
+            b.append("Between " + fReferenceTrace + " and " + fOtherTrace + " [");
+            b.append(" alpha " + fAlpha + " beta " + fBeta + " ]");
+            return b.toString();
+        }
+    }
+
+    /**
+     * Private class representing a point to synchronize on a graph. The x axis
+     * is the timestamp of the event from the reference trace while the y axis
+     * is the timestamp of the event on the other trace
+     */
+    private class SyncPoint {
+        private final ITmfTimestamp x, y;
+
+        public SyncPoint(ITmfEvent ex, ITmfEvent ey) {
+            x = ex.getTimestamp();
+            y = ey.getTimestamp();
+        }
+
+        public long getTimeX() {
+            return x.getValue();
+        }
+
+        /**
+         * Calculate a cross product of 3 points:
+         *
+         * If the cross-product < 0, then p, pa, pb are clockwise
+         *
+         * If the cross-product > 0, then p, pa, pb are counter-clockwise
+         *
+         * If cross-product == 0, then they are in a line
+         *
+         * @param pa
+         *            First point
+         * @param pb
+         *            Second point
+         * @return The cross product
+         */
+        public long crossProduct(SyncPoint pa, SyncPoint pb) {
+            long cp = ((pa.x.getValue() - x.getValue()) * (pb.y.getValue() - y.getValue()) - (pa.y.getValue() - y.getValue()) * (pb.x.getValue() - x.getValue()));
+            return cp;
+        }
+
+        /*
+         * Gets the alpha (slope) between two points
+         */
+        public BigDecimal getAlpha(SyncPoint p1) {
+            if (p1 == null) {
+                return BigDecimal.ONE;
+            }
+            BigDecimal deltay = BigDecimal.valueOf(y.getValue() - p1.y.getValue());
+            BigDecimal deltax = BigDecimal.valueOf(x.getValue() - p1.x.getValue());
+            if (deltax.equals(BigDecimal.ZERO)) {
+                return BigDecimal.ONE;
+            }
+            return deltay.divide(deltax, fMc);
+        }
+
+        /*
+         * Get the beta value (when x = 0) of the line given alpha
+         */
+        public BigDecimal getBeta(BigDecimal alpha) {
+            return BigDecimal.valueOf(y.getValue()).subtract(alpha.multiply(BigDecimal.valueOf(x.getValue()), fMc));
+        }
+
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationAlgorithm.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationAlgorithm.java
new file mode 100644 (file)
index 0000000..d744bcf
--- /dev/null
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.synchronization;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventDependency;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatches;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * Abstract class for synchronization algorithm
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public abstract class SynchronizationAlgorithm extends TmfEventMatches implements Serializable {
+
+    private static final long serialVersionUID = -3083906749528872196L;
+
+    /**
+     * Quality of the result obtained by the synchronization algorithm
+     */
+    public enum SyncQuality {
+        /**
+         * Algorithm returned a result satisfying all hypothesis for the
+         * algorithm
+         */
+        ACCURATE,
+        /**
+         * Best effort of the algorithm
+         */
+        APPROXIMATE,
+        /**
+         * There is communication only in one direction
+         */
+        INCOMPLETE,
+        /**
+         * No communication between two traces
+         */
+        ABSENT,
+        /**
+         * Hypothesis of the algorithm are not satisfied for some reason
+         */
+        FAIL
+    }
+
+    @Override
+    public void addMatch(TmfEventDependency match) {
+        super.addMatch(match);
+        processMatch(match);
+    }
+
+    /**
+     * Function for synchronization algorithm to do something with the received
+     * match
+     *
+     * @param match
+     *            The match of events
+     */
+    protected abstract void processMatch(TmfEventDependency match);
+
+    /**
+     * Returns a map of staticstics relating to this algorithm. Those stats
+     * could be used to be displayed in a view for example.
+     *
+     * @return A map of statistics for this algorithm
+     */
+    public abstract Map<String, Map<String, Object>> getStats();
+
+    /**
+     * Returns a timestamp transformation algorithm
+     *
+     * @param trace
+     *            The trace to get the transform for
+     * @return The timestamp transformation formula
+     */
+    public abstract ITmfTimestampTransform getTimestampTransform(ITmfTrace trace);
+
+    /**
+     * Returns a timestamp transformation algorithm
+     *
+     * @param name
+     *            The name of the trace to get the transform for
+     * @return The timestamp transformation formula
+     */
+    public abstract ITmfTimestampTransform getTimestampTransform(String name);
+
+    /**
+     * Gets the quality of the synchronization between two given traces
+     *
+     * @param trace1
+     *            First trace
+     * @param trace2
+     *            Second trace
+     * @return The synchronization quality
+     */
+    public abstract SyncQuality getSynchronizationQuality(ITmfTrace trace1, ITmfTrace trace2);
+
+    /**
+     * Returns whether a given trace has a synchronization formula that is not
+     * identity. This function returns true if the synchronization algorithm has
+     * failed for some reason
+     *
+     * @param name
+     *            The name of the trace
+     * @return true if trace has formula
+     */
+    public abstract boolean isTraceSynced(String name);
+
+    /**
+     * Rename a trace involved in this algorithm. This function is necessary
+     * because after synchronization, the trace whose timestamp changes is
+     * copied with a new name and the synchronization needs to keep track of the
+     * new name.
+     *
+     * @param oldname
+     *            Original name of the trace
+     * @param newname
+     *            New name of the trace
+     */
+    public abstract void renameTrace(String oldname, String newname);
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java
new file mode 100644 (file)
index 0000000..1950b3a
--- /dev/null
@@ -0,0 +1,219 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.synchronization;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+
+import org.eclipse.linuxtools.internal.tmf.core.Activator;
+
+/**
+ * Class to fetch and save synchronization information between traces
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public class SynchronizationBackend {
+
+    private static final int SYNC_FILE_MAGIC_NUMBER = 0x0DECAF00;
+
+    private static final int FILE_VERSION = 1;
+
+    private static final int HEADER_SIZE = 20;
+
+    private final File fSyncFile;
+
+    /**
+     * Constructor
+     *
+     * @param syncFile
+     *            The file containing synchronization information
+     * @throws IOException
+     *             If the file couldn't be opened for some reason
+     */
+    public SynchronizationBackend(File syncFile) throws IOException {
+        this(syncFile, true);
+    }
+
+    /**
+     * Constructor with possibility to tell whether to throw errors on exception
+     * or not
+     *
+     * @param syncFile
+     *            The file containing synchronization information
+     * @param throwErrors
+     *            Whether to throw exceptions or not
+     * @throws IOException
+     *             If the file couldn't be opened for some reason
+     */
+    public SynchronizationBackend(File syncFile, boolean throwErrors) throws IOException {
+        /*
+         * Open the file ourselves, get the header information we need, then
+         * pass on the descriptor.
+         */
+        int res;
+
+        fSyncFile = syncFile;
+
+        if (syncFile == null) {
+            return;
+        }
+
+        if (!syncFile.exists()) {
+            if (throwErrors) {
+                throw new IOException("Selected synchronization file does not exist"); //$NON-NLS-1$
+            }
+            return;
+        }
+        if (syncFile.length() <= 0) {
+            if (throwErrors) {
+                throw new IOException("Invalid synchronization file selected, " + //$NON-NLS-1$
+                        "target file is empty"); //$NON-NLS-1$
+            }
+            return;
+        }
+
+        FileInputStream fis = new FileInputStream(syncFile);
+        ByteBuffer buffer = ByteBuffer.allocate(HEADER_SIZE);
+        FileChannel fc = fis.getChannel();
+        buffer.clear();
+        fc.read(buffer);
+        buffer.flip();
+
+        /*
+         * Check the magic number,to make sure we're opening the right type of
+         * file
+         */
+        res = buffer.getInt();
+        if (res != SYNC_FILE_MAGIC_NUMBER) {
+            fc.close();
+            fis.close();
+            throw new IOException("Selected file does not" + //$NON-NLS-1$
+                    "look like a synchronization file"); //$NON-NLS-1$
+        }
+
+        res = buffer.getInt(); /* Major version number */
+        if (res != FILE_VERSION) {
+            fc.close();
+            fis.close();
+            throw new IOException("Select synchronization file is of an older " //$NON-NLS-1$
+                    + "format. Synchronization will have to be computed again."); //$NON-NLS-1$
+        }
+
+        res = buffer.getInt(); /* Minor version number */
+
+        fc.close();
+        fis.close();
+    }
+
+    /**
+     * Opens an existing synchronization file
+     *
+     * @return The synchronization algorithm contained in the file
+     * @throws IOException
+     *             Exception returned file functions
+     */
+    public SynchronizationAlgorithm openExistingSync() throws IOException {
+
+        if (fSyncFile == null) {
+            return null;
+        }
+
+        /* Set the position after the header */
+        FileInputStream fis = new FileInputStream(fSyncFile);
+        FileChannel fc = fis.getChannel().position(HEADER_SIZE);
+
+        /* Read the input stream */
+        ObjectInputStream ois = new ObjectInputStream(fis);
+        SyncAlgorithmFullyIncremental syncAlgo = null;
+        try {
+            syncAlgo = (SyncAlgorithmFullyIncremental) ois.readObject();
+        } catch (ClassNotFoundException e) {
+
+        }
+        ois.close();
+        fc.close();
+
+        fis.close();
+
+        return syncAlgo;
+    }
+
+    /**
+     * Saves the synchronization algorithm object to file
+     *
+     * @param syncAlgo
+     *            The algorithm to save
+     * @throws FileNotFoundException
+     *             propagate callee's exceptions
+     */
+    public void saveSync(SynchronizationAlgorithm syncAlgo) throws FileNotFoundException {
+
+        if (fSyncFile == null) {
+            return;
+        }
+
+        FileChannel fc;
+        FileOutputStream fos;
+        ObjectOutputStream oos;
+        ByteBuffer buffer;
+        int res;
+
+        fos = new FileOutputStream(fSyncFile, false);
+        fc = fos.getChannel();
+
+        buffer = ByteBuffer.allocate(HEADER_SIZE);
+        buffer.clear();
+
+        /* Save the header of the file */
+        try {
+            fc.position(0);
+
+            buffer.putInt(SYNC_FILE_MAGIC_NUMBER);
+
+            buffer.putInt(FILE_VERSION);
+
+            buffer.flip();
+            res = fc.write(buffer);
+            assert (res <= HEADER_SIZE);
+            /* done writing the file header */
+
+            fc.position(HEADER_SIZE);
+
+            oos = new ObjectOutputStream(fos);
+            oos.writeObject(syncAlgo);
+            oos.close();
+
+        } catch (IOException e) {
+            /* We should not have any problems at this point... */
+            Activator.logError("Error saving trace synchronization data", e); //$NON-NLS-1$
+        } finally {
+            try {
+                fc.close();
+                fos.close();
+            } catch (IOException e) {
+                Activator.logError("Error closing synchronization file", e); //$NON-NLS-1$
+            }
+        }
+        return;
+
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationManager.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationManager.java
new file mode 100644 (file)
index 0000000..fac5133
--- /dev/null
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.synchronization;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.linuxtools.internal.tmf.core.Activator;
+import org.eclipse.linuxtools.tmf.core.component.TmfComponent;
+import org.eclipse.linuxtools.tmf.core.event.matching.ITmfEventMatching;
+import org.eclipse.linuxtools.tmf.core.event.matching.TmfNetworkEventMatching;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * This abstract manager class handles loading trace synchronization data or
+ * otherwise their calculation.
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public abstract class SynchronizationManager extends TmfComponent {
+
+    /**
+     * Function called to synchronize traces using the fully incremental
+     * synchronization algorithm
+     *
+     * @param syncFile
+     *            The target name of the synchronization file. If it exists, it
+     *            will be opened, otherwise it will be created and data from
+     *            this synchro run will be saved there
+     * @param traces
+     *            The list of traces to synchronize
+     * @param doSync
+     *            Whether to actually synchronize or just try opening a sync
+     *            file
+     * @return The synchronization object
+     */
+    public static SynchronizationAlgorithm synchronizeTraces(final File syncFile, final ITmfTrace[] traces, boolean doSync) {
+
+        SynchronizationAlgorithm syncAlgo;
+        if (doSync) {
+            syncAlgo = synchronize(syncFile, traces, new SyncAlgorithmFullyIncremental());
+        } else {
+            syncAlgo = openExisting(syncFile);
+            if (syncAlgo == null) {
+                syncAlgo = new SyncAlgorithmFullyIncremental();
+            }
+        }
+        return syncAlgo;
+    }
+
+    /**
+     * Function called to synchronize traces with a specific synchronization
+     * algorithm. If a synchronization already exists, but is not the requested
+     * algorithm, the synchronization is done again using the new algorithm
+     *
+     * @param syncFile
+     *            The target name of the synchronization file. If it exists, it
+     *            will be opened, otherwise it will be created and data from
+     *            this synchro run will be saved there
+     * @param traces
+     *            The list of traces to synchronize
+     * @param algo
+     *            A synchronization algorithm object to determine the algorithm
+     *            used to synchronization.
+     * @param doSync
+     *            Whether to actually synchronize or just try opening a sync
+     *            file
+     * @return The synchronization object
+     */
+    public static SynchronizationAlgorithm synchronizeTraces(final File syncFile, final ITmfTrace[] traces, SynchronizationAlgorithm algo, boolean doSync) {
+
+        SynchronizationAlgorithm syncAlgo;
+        if (doSync) {
+            syncAlgo = synchronize(syncFile, traces, algo);
+        } else {
+            syncAlgo = openExisting(syncFile);
+            if (syncAlgo == null || (syncAlgo.getClass() != algo.getClass())) {
+                if (algo != null) {
+                    syncAlgo = algo;
+                } else {
+                    syncAlgo = new SyncAlgorithmFullyIncremental();
+                }
+            }
+        }
+
+        return syncAlgo;
+    }
+
+    private static SynchronizationAlgorithm openExisting(final File syncFile) {
+        if ((syncFile != null) && syncFile.exists()) {
+            /* Load an existing history */
+            try {
+                SynchronizationBackend syncBackend = new SynchronizationBackend(syncFile);
+                SynchronizationAlgorithm algo = syncBackend.openExistingSync();
+                return algo;
+            } catch (IOException e) {
+                /*
+                 * There was an error opening the existing file. Perhaps it was
+                 * corrupted, perhaps it's an old version? We'll just
+                 * fall-through and try to build a new one from scratch instead.
+                 */
+                Activator.logInfo("Problem opening existing trace synchronization file", e); //$NON-NLS-1$
+            }
+        }
+        return null;
+    }
+
+    private static SynchronizationAlgorithm synchronize(final File syncFile, final ITmfTrace[] traces, SynchronizationAlgorithm syncAlgo) {
+        ITmfEventMatching matching = new TmfNetworkEventMatching(traces, syncAlgo);
+        matching.matchEvents();
+
+        SynchronizationBackend syncBackend;
+        try {
+            syncBackend = new SynchronizationBackend(syncFile, false);
+            syncBackend.saveSync(syncAlgo);
+        } catch (IOException e) {
+            Activator.logError("Error while saving trace synchronization file", e); //$NON-NLS-1$
+        }
+        return syncAlgo;
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/TmfTimestampTransform.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/TmfTimestampTransform.java
new file mode 100644 (file)
index 0000000..73ce661
--- /dev/null
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.synchronization;
+
+import java.io.Serializable;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+
+/**
+ * A default simple, identity timestamp transform. It is a singleton class and
+ * returns the timestamp itself
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public class TmfTimestampTransform implements ITmfTimestampTransform, Serializable {
+
+    /**
+     * Generated serial UID
+     */
+    private static final long serialVersionUID = -1480581417493073304L;
+
+    /**
+     * The unique instance of this transform, since it is always the same
+     */
+    public static final TmfTimestampTransform IDENTITY = new TmfTimestampTransform();
+
+    /**
+     * Default constructor
+     */
+    protected TmfTimestampTransform() {
+
+    }
+
+    @Override
+    public ITmfTimestamp transform(ITmfTimestamp timestamp) {
+        return timestamp;
+    }
+
+    @Override
+    public long transform(long timestamp) {
+        return timestamp;
+    }
+
+    @Override
+    public ITmfTimestampTransform composeWith(ITmfTimestampTransform composeWith) {
+        /* Since this transform will not modify anything, return the other */
+        return composeWith;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return other.getClass().equals(TmfTimestampTransform.class);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = (prime * result) + TmfTimestampTransform.class.hashCode();
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return "TmfTimestampTransform [ IDENTITY ]"; //$NON-NLS-1$
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/TmfTimestampTransformLinear.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/TmfTimestampTransformLinear.java
new file mode 100644 (file)
index 0000000..1a20ea2
--- /dev/null
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.synchronization;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.MathContext;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+
+/**
+ * Class implementing a linear timestamp transform, with a slope and/or offset
+ *
+ * f(t) = alpha*t + beta
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public class TmfTimestampTransformLinear implements ITmfTimestampTransform, Serializable {
+
+    /**
+     * Generated serial UID
+     */
+    private static final long serialVersionUID = -4756608071358979461L;
+
+    /**
+     * Respectively the slope and offset and this linear equation.
+     *
+     * FIXME: Maybe doubles will be enough, for the whole synchronization
+     * package as well, I think BigDecimal is a remnant of past trials and
+     * errors
+     */
+    private final BigDecimal fAlpha;
+    private final BigDecimal fBeta;
+
+    private static final MathContext fMc = MathContext.DECIMAL128;
+
+    /**
+     * Default constructor
+     */
+    public TmfTimestampTransformLinear() {
+        fAlpha = BigDecimal.ONE;
+        fBeta = BigDecimal.ZERO;
+    }
+
+    /**
+     * Constructor with alpha and beta
+     *
+     * @param alpha
+     *            The slope of the linear transform
+     * @param beta
+     *            The initial offset of the linear transform
+     */
+    public TmfTimestampTransformLinear(final double alpha, final double beta) {
+        fAlpha = BigDecimal.valueOf(alpha);
+        fBeta = BigDecimal.valueOf(beta);
+    }
+
+    /**
+     * Constructor with alpha and beta in big decimal
+     *
+     * @param fAlpha2
+     *            The slope of the linear transform
+     * @param fBeta2
+     *            The initial offset of the linear transform
+     */
+    public TmfTimestampTransformLinear(final BigDecimal fAlpha2, final BigDecimal fBeta2) {
+        if (fAlpha2 != null) {
+            fAlpha = fAlpha2;
+        } else {
+            fAlpha = BigDecimal.ONE;
+        }
+        if (fBeta2 != null) {
+            fBeta = fBeta2;
+        } else {
+            fBeta = BigDecimal.ZERO;
+        }
+    }
+
+    @Override
+    public ITmfTimestamp transform(ITmfTimestamp timestamp) {
+        BigDecimal newvalue = BigDecimal.valueOf(timestamp.getValue()).multiply(fAlpha, fMc).add(fBeta);
+        return new TmfTimestamp(timestamp, newvalue.longValue());
+    }
+
+    @Override
+    public long transform(long timestamp) {
+        BigDecimal t = BigDecimal.valueOf(timestamp).multiply(fAlpha, fMc).add(fBeta);
+        return t.longValue();
+    }
+
+    @Override
+    public ITmfTimestampTransform composeWith(ITmfTimestampTransform composeWith) {
+        if (composeWith.equals(TmfTimestampTransform.IDENTITY)) {
+            /* If composing with identity, just return this */
+            return this;
+        } else if (composeWith instanceof TmfTimestampTransformLinear) {
+            /* If composeWith is a linear transform, add the two together */
+            TmfTimestampTransformLinear ttl = (TmfTimestampTransformLinear) composeWith;
+            BigDecimal newAlpha = fAlpha.multiply(ttl.fAlpha, fMc);
+            BigDecimal newBeta = fAlpha.multiply(ttl.fBeta, fMc).add(fBeta);
+            return new TmfTimestampTransformLinear(newAlpha, newBeta);
+        } else {
+            /*
+             * We do not know what to do with this kind of transform, just
+             * return this
+             */
+            return this;
+        }
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        boolean result = false;
+        if (other instanceof TmfTimestampTransformLinear) {
+            TmfTimestampTransformLinear that = (TmfTimestampTransformLinear) other;
+            result = ((that.fAlpha.equals(fAlpha)) && (that.fBeta.equals(fBeta)));
+        }
+        return result;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = (prime * result) + (fBeta.multiply(fAlpha).intValue());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return "TmfTimestampLinear [ alpha = " + fAlpha.toString() + //$NON-NLS-1$
+                ", beta = " + fBeta.toString() + //$NON-NLS-1$
+                " ]"; //$NON-NLS-1$
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/messages.properties b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/messages.properties
new file mode 100644 (file)
index 0000000..fb5cd46
--- /dev/null
@@ -0,0 +1,21 @@
+SyncAlgorithmFullyIncremental_absent=Absent
+SyncAlgorithmFullyIncremental_alpha=Alpha
+SyncAlgorithmFullyIncremental_beta=Beta
+SyncAlgorithmFullyIncremental_T_=T_
+SyncAlgorithmFullyIncremental_otherformula=C_T1(t)
+SyncAlgorithmFullyIncremental_mult=*
+SyncAlgorithmFullyIncremental_add=\ +
+SyncAlgorithmFullyIncremental_ub=Number of points in upper hull
+SyncAlgorithmFullyIncremental_lb=Number of points in lower hull
+SyncAlgorithmFullyIncremental_accuracy=Accuracy
+SyncAlgorithmFullyIncremental_accurate=Accurate
+SyncAlgorithmFullyIncremental_approx=Approximate
+SyncAlgorithmFullyIncremental_fail=Fail
+SyncAlgorithmFullyIncremental_incomplete=Incomplete
+SyncAlgorithmFullyIncremental_nbmatch=Number of matching packets received
+SyncAlgorithmFullyIncremental_nbacc=Number of accurate packets
+SyncAlgorithmFullyIncremental_reftrace=T0
+SyncAlgorithmFullyIncremental_othertrace=T1
+SyncAlgorithmFullyIncremental_refformula=C_T0(t)
+SyncAlgorithmFullyIncremental_NA=N/A
+SyncAlgorithmFullyIncremental_quality=Quality
\ No newline at end of file
index 13ee08a6ea6ae1179a1da9e8969cbb70dc946460..7fbe99c6a9b1c5c5f9f3a5770ad90ae6ec7bb54f 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
+ * Copyright (c) 2009, 2013 Ericsson, École Polytechnique de Montréal
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -11,6 +11,7 @@
  *   Thomas Gatterweh  - Updated scaling / synchronization
  *   Francois Chouinard - Refactoring to align with TMF Event Model 1.0
  *   Francois Chouinard - Implement augmented interface
+ *   Geneviève Bastien  - Added copy constructor with new value
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.core.timestamp;
@@ -134,6 +135,24 @@ public class TmfTimestamp implements ITmfTimestamp {
         fPrecision = timestamp.getPrecision();
     }
 
+    /**
+     * Copies a timestamp but with a new time value
+     *
+     * @param timestamp
+     *            The timestamp to copy
+     * @param newvalue
+     *            The value the new timestamp will have
+     * @since 3.0
+     */
+    public TmfTimestamp(ITmfTimestamp timestamp, long newvalue) {
+        if (timestamp == null) {
+            throw new IllegalArgumentException();
+        }
+        fValue = newvalue;
+        fScale = timestamp.getScale();
+        fPrecision = timestamp.getPrecision();
+    }
+
     // ------------------------------------------------------------------------
     // ITmfTimestamp
     // ------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfCheckpoint.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfCheckpoint.java
deleted file mode 100644 (file)
index e2e4e1b..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 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
- *   Patrick Tasse - Updated for location in checkpoint
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.trace;
-
-import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-
-/**
- * The basic trace checkpoint structure in TMF. The purpose of the checkpoint is
- * to associate a trace location to an event timestamp.
- *
- * @version 1.0
- * @author Francois Chouinard
- *
- * @see ITmfTimestamp
- * @see ITmfLocation
- */
-public interface ITmfCheckpoint extends Comparable<ITmfCheckpoint> {
-
-    // ------------------------------------------------------------------------
-    // Getters
-    // ------------------------------------------------------------------------
-
-    /**
-     * @return the timestamp of the event referred to by the context
-     * @since 2.0
-     */
-    ITmfTimestamp getTimestamp();
-
-    /**
-     * @return the location of the event referred to by the checkpoint
-     */
-    ITmfLocation getLocation();
-
-    // ------------------------------------------------------------------------
-    // Comparable
-    // ------------------------------------------------------------------------
-
-    @Override
-    int compareTo(ITmfCheckpoint checkpoint);
-
-}
index 5413d9b8dac53ea811923c50d5afc00de9b2672d..f3b526e117e2771fcc5eaea1cadaaadf3ba175a4 100644 (file)
@@ -14,6 +14,8 @@
 
 package org.eclipse.linuxtools.tmf.core.trace;
 
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+
 /**
  * The basic trace context structure in TMF. The purpose of the context is to
  * associate a trace location to an event at a specific rank (order).
@@ -49,6 +51,7 @@ public interface ITmfContext {
 
     /**
      * @return the location of the event at the context rank
+     * @since 3.0
      */
     ITmfLocation getLocation();
 
@@ -63,6 +66,7 @@ public interface ITmfContext {
 
     /**
      * @param location the new location
+     * @since 3.0
      */
     void setLocation(ITmfLocation location);
 
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfLocation.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfLocation.java
deleted file mode 100644 (file)
index 3f7b527..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * 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 Trace Model 1.0
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.trace;
-
-/**
- * The generic trace location in TMF.
- * <p>
- * An ITmfLocation is the equivalent of a random-access file position, holding
- * enough information to allow the positioning of the trace 'pointer' to read an
- * arbitrary event.
- * <p>
- * This location is trace-specific, must be comparable and immutable.
- *
- * @version 2.0
- * @author Francois Chouinard
- */
-public interface ITmfLocation {
-
-    // ------------------------------------------------------------------------
-    // Getters
-    // ------------------------------------------------------------------------
-
-    /**
-     * Returns the concrete trace location information
-     *
-     * @return the location information
-     * @since 2.0
-     */
-    Comparable<?> getLocationInfo();
-
-}
index 24ccaa1a919e749d6487ec1a26c8de15a4ac57f7..b0f0a38caefc934d65466e4418d4c8ff4449ce09 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
+ * Copyright (c) 2009, 2013 Ericsson, École Polytechnique de Montréal
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -9,6 +9,8 @@
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
  *   Francois Chouinard - Updated as per TMF Trace Model 1.0
+ *   Geneviève Bastien  - Added timestamp transforms and timestamp
+ *                        creation functions
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.core.trace;
@@ -24,8 +26,11 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 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.synchronization.ITmfTimestampTransform;
 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 
 /**
  * The event stream structure in TMF. In its basic form, a trace has:
@@ -37,9 +42,9 @@ import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
  * <li> the time range (span) of the events it contains
  * </ul>
  * Concrete ITmfTrace classes have to provide a parameter-less constructor and
- * an initialization method (<i>initTrace</i>) if they are to be opened from
- * the Project View. Also, a validation method (<i>validate</i>) has to be
- * provided to ensure that the trace is of the correct type.
+ * an initialization method (<i>initTrace</i>) if they are to be opened from the
+ * Project View. Also, a validation method (<i>validate</i>) has to be provided
+ * to ensure that the trace is of the correct type.
  * <p>
  * A trace can be accessed simultaneously from multiple threads by various
  * application components. To avoid obvious multi-threading issues, the trace
@@ -80,19 +85,22 @@ import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
  *     event = trace.getNext(context);
  * }
  * </pre>
+ *
  * A trace is also an event provider so it can process event requests
  * asynchronously (and coalesce compatible, concurrent requests).
  * <p>
- * </pre>
- * <b>Example 4</b>: Process a whole trace (see ITmfEventRequest for variants)
+ *
+ * <b>Example 4</b>: Process a whole trace (see ITmfEventRequest for
+ * variants)
  * <pre>
  * ITmfRequest request = new TmfEventRequest&lt;MyEventType&gt;(MyEventType.class) {
- *     &#64;Override
+ *     &#064;Override
  *     public void handleData(MyEventType event) {
  *         super.handleData(event);
  *         processEvent(event);
  *     }
- *     &#64;Override
+ *
+ *     &#064;Override
  *     public void handleCompleted() {
  *         finish();
  *         super.handleCompleted();
@@ -133,23 +141,29 @@ public interface ITmfTrace extends ITmfDataProvider {
      * properly parameterize an ITmfTrace instantiated with its parameterless
      * constructor.
      * <p>
-     * Typically, the parameterless constructor will provide the block size
-     * and its associated parser and indexer.
+     * Typically, the parameterless constructor will provide the block size and
+     * its associated parser and indexer.
      *
-     * @param resource the trace resource
-     * @param path the trace path
-     * @param type the trace event type
-     * @throws TmfTraceException If we couldn't open the trace
+     * @param resource
+     *            the trace resource
+     * @param path
+     *            the trace path
+     * @param type
+     *            the trace event type
+     * @throws TmfTraceException
+     *             If we couldn't open the trace
      */
     void initTrace(IResource resource, String path, Class<? extends ITmfEvent> type) throws TmfTraceException;
 
     /**
      * Validate that the trace is of the correct type.
      *
-     * @param project the eclipse project
-     * @param path the trace path
-     *
-     * @return an IStatus object with validation result. Use severity OK to indicate success.
+     * @param project
+     *            the eclipse project
+     * @param path
+     *            the trace path
+     * @return an IStatus object with validation result. Use severity OK to
+     *         indicate success.
      * @since 2.0
      */
     IStatus validate(IProject project, String path);
@@ -259,14 +273,17 @@ public interface ITmfTrace extends ITmfDataProvider {
 
     /**
      * @return the current trace location
+     * @since 3.0
      */
     ITmfLocation getCurrentLocation();
 
     /**
      * Returns the ratio (proportion) corresponding to the specified location.
      *
-     * @param location a trace specific location
+     * @param location
+     *            a trace specific location
      * @return a floating-point number between 0.0 (beginning) and 1.0 (end)
+     * @since 3.0
      */
     double getLocationRatio(ITmfLocation location);
 
@@ -283,29 +300,32 @@ public interface ITmfTrace extends ITmfDataProvider {
      * If not null, the location requested must be valid otherwise the returned
      * context is undefined (up to the implementation to recover if possible).
      * <p>
-     * @param location the trace specific location
+     *
+     * @param location
+     *            the trace specific location
      * @return a context which can later be used to read the corresponding event
+     * @since 3.0
      */
     ITmfContext seekEvent(ITmfLocation location);
 
     /**
      * Position the trace at the 'rank'th event in the trace.
      * <p>
-     * A rank <= 0 is interpreted as seeking for the first event of the
-     * trace.
+     * A rank <= 0 is interpreted as seeking for the first event of the trace.
      * <p>
      * If the requested rank is beyond the last trace event, the context
      * returned will yield a null event if used in a subsequent read.
      *
-     * @param rank the event rank
+     * @param rank
+     *            the event rank
      * @return a context which can later be used to read the corresponding event
      */
     ITmfContext seekEvent(long rank);
 
     /**
      * Position the trace at the first event with the specified timestamp. If
-     * there is no event with the requested timestamp, a context pointing to
-     * the next chronological event is returned.
+     * there is no event with the requested timestamp, a context pointing to the
+     * next chronological event is returned.
      * <p>
      * A null timestamp is interpreted as seeking for the first event of the
      * trace.
@@ -313,7 +333,8 @@ public interface ITmfTrace extends ITmfDataProvider {
      * If the requested timestamp is beyond the last trace event, the context
      * returned will yield a null event if used in a subsequent read.
      *
-     * @param timestamp the timestamp of desired event
+     * @param timestamp
+     *            the timestamp of desired event
      * @return a context which can later be used to read the corresponding event
      * @since 2.0
      */
@@ -327,7 +348,8 @@ public interface ITmfTrace extends ITmfDataProvider {
      * voluntarily vague. Typically, it would refer to the event proportional
      * rank (arguably more intuitive) or timestamp in the trace file.
      *
-     * @param ratio the proportional 'rank' in the trace
+     * @param ratio
+     *            the proportional 'rank' in the trace
      * @return a context which can later be used to read the corresponding event
      */
     ITmfContext seekEvent(double ratio);
@@ -339,4 +361,49 @@ public interface ITmfTrace extends ITmfDataProvider {
      * @since 2.0
      */
     ITmfTimestamp getInitialRangeOffset();
+
+    /**
+     * Returns the ID of the host this trace is from. The host ID is not
+     * necessarily the hostname, but should be a unique identifier for the
+     * machine on which the trace was taken. It can be used to determine if two
+     * traces were taken on the exact same machine (timestamp are already
+     * synchronized, resources with same id are the same if taken at the same
+     * time, etc).
+     *
+     * @return The host id of this trace
+     * @since 3.0
+     */
+    String getHostId();
+
+    // ------------------------------------------------------------------------
+    // Timestamp transformation functions
+    // ------------------------------------------------------------------------
+
+    /**
+     * Returns the timestamp transformation for this trace
+     *
+     * @return the timestamp transform
+     * @since 3.0
+     */
+    ITmfTimestampTransform getTimestampTransform();
+
+    /**
+     * Sets the trace's timestamp transform
+     *
+     * @param tt
+     *            The timestamp transform for all timestamps of this trace
+     * @since 3.0
+     */
+    void setTimestampTransform(final ITmfTimestampTransform tt);
+
+    /**
+     * Creates a timestamp for this trace, using the transformation formula
+     *
+     * @param ts
+     *            The time in long with which to create the timestamp
+     * @return The new timestamp
+     * @since 3.0
+     */
+    ITmfTimestamp createTimestamp(long ts);
+
 }
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceIndexer.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceIndexer.java
deleted file mode 100644 (file)
index a36b3e0..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 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.trace;
-
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-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.
- *
- * @version 1.0
- * @author Francois Chouinard
- *
- * @see ITmfTrace
- * @see ITmfEvent
- */
-public interface ITmfTraceIndexer {
-
-    /**
-     * Start an asynchronous index building job and waits for the job completion
-     * if required. Typically, the indexing job sends notifications at regular
-     * intervals to indicate its progress.
-     * <p>
-     * <b>Example 1</b>: Index a whole trace asynchronously
-     *
-     * <pre>
-     * trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, false);
-     * </pre>
-     *
-     * <b>Example 2</b>: Index a whole trace synchronously
-     *
-     * <pre>
-     * trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, true);
-     * </pre>
-     *
-     * <b>Example 3</b>: Index a trace asynchronously, starting at rank 100
-     *
-     * <pre>
-     * trace.getIndexer().buildIndex(100, TmfTimeRange.ETERNITY, false);
-     * </pre>
-     *
-     * <b>Example 4</b>: Index a trace asynchronously, starting at rank 100 for
-     * events between T1 and T2 (inclusive). This is used for incremental
-     * indexing.
-     *
-     * <pre>
-     * TmfTimeRange range = new TmfTimeRange(T1, T2);
-     * trace.getIndexer().buildIndex(100, range, false);
-     * </pre>
-     *
-     * @param offset
-     *            The offset of the first event to consider
-     * @param range
-     *            The time range to consider
-     * @param waitForCompletion
-     *            Should we block the calling thread until the build is
-     *            complete?
-     * @since 2.0
-     */
-    void buildIndex(long offset, TmfTimeRange range, boolean waitForCompletion);
-
-    /**
-     * Indicates that the indexer is busy indexing the trace.
-     * Will always return false if the indexing is done synchronously.
-     *
-     * @return the state of the indexer (indexing or not)
-     */
-    boolean isIndexing();
-
-    /**
-     * Adds an entry to the trace index.
-     *
-     * @param context The trace context to save
-     * @param timestamp The timestamp matching this context
-     * @since 2.0
-     */
-    void updateIndex(ITmfContext context, ITmfTimestamp timestamp);
-
-    /**
-     * Returns the context of the checkpoint immediately preceding the requested
-     * timestamp (or at the timestamp if it coincides with a checkpoint).
-     *
-     * @param timestamp the requested timestamp
-     * @return the checkpoint context
-     * @since 2.0
-     */
-    ITmfContext seekIndex(ITmfTimestamp timestamp);
-
-    /**
-     * Returns the context of the checkpoint immediately preceding the requested
-     * rank (or at rank if it coincides with a checkpoint).
-     *
-     * @param rank the requested event rank
-     * @return the checkpoint context
-     */
-    ITmfContext seekIndex(long rank);
-
-    /**
-     * Perform cleanup when the indexer is no longer required.
-     */
-    void dispose();
-
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpoint.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpoint.java
deleted file mode 100644 (file)
index 9c93ddc..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2013 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 Trace Model 1.0
- *   Patrick Tasse - Updated for location in checkpoint
- ******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.trace;
-
-import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-
-/**
- * A basic implementation of ITmfCheckpoint. It simply maps an event timestamp
- * to a generic location.
- *
- * @version 1.0
- * @author Francois Chouinard
- *
- * @see ITmfLocation
- * @see ITmfTimestamp
- */
-public class TmfCheckpoint implements ITmfCheckpoint {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    // The checkpoint location
-    private final ITmfLocation fLocation;
-
-    // The checkpoint timestamp
-    private final ITmfTimestamp fTimestamp;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Full constructor
-     *
-     * @param timestamp the checkpoint timestamp
-     * @param location the corresponding trace location
-     * @since 2.0
-     */
-    public TmfCheckpoint(final ITmfTimestamp timestamp, final ITmfLocation location) {
-        fTimestamp = timestamp;
-        fLocation = location;
-    }
-
-    /**
-     * Copy constructor
-     *
-     * @param other the other checkpoint
-     */
-    public TmfCheckpoint(final TmfCheckpoint other) {
-        if (other == null) {
-            throw new IllegalArgumentException();
-        }
-        fTimestamp = other.fTimestamp;
-        fLocation = other.fLocation;
-    }
-
-    // ------------------------------------------------------------------------
-    // ITmfCheckpoint
-    // ------------------------------------------------------------------------
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public ITmfTimestamp getTimestamp() {
-        return fTimestamp;
-    }
-
-    @Override
-    public ITmfLocation getLocation() {
-        return fLocation;
-    }
-
-    // ------------------------------------------------------------------------
-    // Comparable
-    // ------------------------------------------------------------------------
-
-    @Override
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public int compareTo(final ITmfCheckpoint other) {
-        int comp = 0;
-        if ((fTimestamp != null) && (other.getTimestamp() != null)) {
-            comp = fTimestamp.compareTo(other.getTimestamp(), false);
-            if (comp != 0) {
-                return comp;
-            }
-            // compare locations if timestamps are the same
-        }
-
-        if ((fLocation == null) && (other.getLocation() == null)) {
-            return 0;
-        }
-
-        // treat location of other as null location which is before any location
-        if ((fLocation != null) && (other.getLocation() == null)) {
-            return 1;
-        }
-
-        // treat this as null location which is before any other locations
-        if ((fLocation == null) && (other.getLocation() != null)) {
-            return -1;
-        }
-
-        // compare location
-        final Comparable location1 = getLocation().getLocationInfo();
-        final Comparable location2 = other.getLocation().getLocationInfo();
-        return location1.compareTo(location2);
-    }
-
-    // ------------------------------------------------------------------------
-    // Object
-    // ------------------------------------------------------------------------
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((fLocation == null) ? 0 : fLocation.hashCode());
-        result = prime * result + ((fTimestamp == null) ? 0 : fTimestamp.hashCode());
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (!(obj instanceof TmfCheckpoint)) {
-            return false;
-        }
-        final TmfCheckpoint other = (TmfCheckpoint) obj;
-        if (fLocation == null) {
-            if (other.fLocation != null) {
-                return false;
-            }
-        } else if (!fLocation.equals(other.fLocation)) {
-            return false;
-        }
-        if (fTimestamp == null) {
-            if (other.fTimestamp != null) {
-                return false;
-            }
-        } else if (!fTimestamp.equals(other.fTimestamp)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    @SuppressWarnings("nls")
-    public String toString() {
-        return getClass().getSimpleName() + " [fLocation=" + fLocation + ", fTimestamp=" + fTimestamp + "]";
-    }
-
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpointIndexer.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpointIndexer.java
deleted file mode 100644 (file)
index f8964ea..0000000
+++ /dev/null
@@ -1,320 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 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.trace;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-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.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
- * checkpoints. Checkpoints are stored at fixed intervals (event rank) in
- * ascending timestamp order.
- * <p>
- * The goal being to access a random trace event reasonably fast from the user's
- * standpoint, picking the right interval value becomes a trade-off between speed
- * and memory usage (a shorter inter-event interval is faster but requires more
- * checkpoints).
- * <p>
- * Locating a specific checkpoint is trivial for both rank (rank % interval) and
- * timestamp (bsearch in the array).
- *
- * @version 1.0
- * @author Francois Chouinard
- *
- * @see ITmfTrace
- * @see ITmfEvent
- */
-public class TmfCheckpointIndexer implements ITmfTraceIndexer {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    /** The event trace to index */
-    protected final ITmfTrace fTrace;
-
-    /** The interval between checkpoints */
-    private final int fCheckpointInterval;
-
-    /** The event trace to index */
-    private boolean fIsIndexing;
-
-    /**
-     * The trace index. It is composed of checkpoints taken at intervals of
-     * fCheckpointInterval events.
-     */
-    protected final List<ITmfCheckpoint> fTraceIndex;
-
-    /**
-     * The indexing request
-     */
-    private ITmfEventRequest fIndexingRequest = null;
-
-    // ------------------------------------------------------------------------
-    // Construction
-    // ------------------------------------------------------------------------
-
-    /**
-     * Basic constructor that uses the default trace block size as checkpoints
-     * intervals
-     *
-     * @param trace the trace to index
-     */
-    public TmfCheckpointIndexer(final ITmfTrace trace) {
-        this(trace, TmfDataProvider.DEFAULT_BLOCK_SIZE);
-    }
-
-    /**
-     * Full trace indexer
-     *
-     * @param trace the trace to index
-     * @param interval the checkpoints interval
-     */
-    public TmfCheckpointIndexer(final ITmfTrace trace, final int interval) {
-        fTrace = trace;
-        fCheckpointInterval = interval;
-        fTraceIndex = new ArrayList<ITmfCheckpoint>();
-        fIsIndexing = false;
-    }
-
-    @Override
-    public void dispose() {
-        if ((fIndexingRequest != null) && !fIndexingRequest.isCompleted()) {
-            fIndexingRequest.cancel();
-            fTraceIndex.clear();
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // ITmfTraceIndexer - isIndexing
-    // ------------------------------------------------------------------------
-
-    @Override
-    public boolean isIndexing() {
-        return fIsIndexing;
-    }
-
-    // ------------------------------------------------------------------------
-    // ITmfTraceIndexer - buildIndex
-    // ------------------------------------------------------------------------
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public void buildIndex(final long offset, final TmfTimeRange range, final boolean waitForCompletion) {
-
-        // Don't do anything if we are already indexing
-        synchronized (fTraceIndex) {
-            if (fIsIndexing) {
-                return;
-            }
-            fIsIndexing = true;
-        }
-
-        // The monitoring job
-        final Job job = new Job("Indexing " + fTrace.getName() + "...") { //$NON-NLS-1$ //$NON-NLS-2$
-            @Override
-            protected IStatus run(final IProgressMonitor monitor) {
-                monitor.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
-                while (!monitor.isCanceled()) {
-                    try {
-                        long prevNbEvents = fTrace.getNbEvents();
-                        Thread.sleep(250);
-                        long nbEvents = fTrace.getNbEvents();
-                        setName(Messages.TmfCheckpointIndexer_Indexing + ' ' + fTrace.getName() + " (" + nbEvents + ")"); //$NON-NLS-1$ //$NON-NLS-2$
-                        // setName doesn't refresh the UI, setTaskName does
-                        long rate = (nbEvents - prevNbEvents) * 4;
-                        monitor.setTaskName(rate + " " + Messages.TmfCheckpointIndexer_EventsPerSecond); //$NON-NLS-1$
-                    } catch (final InterruptedException e) {
-                        return Status.OK_STATUS;
-                    }
-                }
-                monitor.done();
-                return Status.OK_STATUS;
-            }
-        };
-        job.schedule();
-
-        // Build a background request for all the trace data. The index is
-        // updated as we go by readNextEvent().
-        fIndexingRequest = new TmfEventRequest(ITmfEvent.class,
-                range, offset, TmfDataRequest.ALL_DATA, fCheckpointInterval, ITmfDataRequest.ExecutionType.BACKGROUND)
-        {
-            @Override
-            public void handleData(final ITmfEvent event) {
-                super.handleData(event);
-                if (event != null) {
-                    // Update the trace status at regular intervals
-                    if ((getNbRead() % fCheckpointInterval) == 0) {
-                        updateTraceStatus();
-                    }
-                }
-            }
-
-            @Override
-            public void handleSuccess() {
-                updateTraceStatus();
-            }
-
-            @Override
-            public void handleCompleted() {
-                job.cancel();
-                super.handleCompleted();
-                fIsIndexing = false;
-            }
-
-            private void updateTraceStatus() {
-                if (fTrace.getNbEvents() > 0) {
-                    signalNewTimeRange(fTrace.getStartTime(), fTrace.getEndTime());
-                }
-            }
-        };
-
-        // Submit the request and wait for completion if required
-        fTrace.sendRequest(fIndexingRequest);
-        if (waitForCompletion) {
-            try {
-                fIndexingRequest.waitForCompletion();
-            } catch (final InterruptedException e) {
-            }
-        }
-    }
-
-    /**
-     * Notify the interested parties that the trace time range has changed
-     *
-     * @param startTime the new start time
-     * @param endTime the new end time
-     */
-    private void signalNewTimeRange(final ITmfTimestamp startTime, final ITmfTimestamp endTime) {
-        fTrace.broadcast(new TmfTraceUpdatedSignal(fTrace, fTrace, new TmfTimeRange(startTime, endTime)));
-    }
-
-    // ------------------------------------------------------------------------
-    // ITmfTraceIndexer - updateIndex
-    // ------------------------------------------------------------------------
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public synchronized void updateIndex(final ITmfContext context, final ITmfTimestamp timestamp) {
-        if ((context.getRank() % fCheckpointInterval) == 0) {
-            // Determine the table position
-            final long position = context.getRank() / fCheckpointInterval;
-            // Add new entry at proper location (if empty)
-            if (fTraceIndex.size() == position) {
-                fTraceIndex.add(new TmfCheckpoint(timestamp, context.getLocation()));
-            }
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // ITmfTraceIndexer - seekIndex
-    // ------------------------------------------------------------------------
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public synchronized ITmfContext seekIndex(final ITmfTimestamp timestamp) {
-
-        // A null timestamp indicates to seek the first event
-        if (timestamp == null) {
-            return fTrace.seekEvent(0);
-        }
-
-        // Find the checkpoint at or before the requested timestamp.
-        // In the very likely event that the timestamp is not at a checkpoint
-        // boundary, bsearch will return index = (- (insertion point + 1)).
-        // It is then trivial to compute the index of the previous checkpoint.
-        int index = Collections.binarySearch(fTraceIndex, new TmfCheckpoint(timestamp, null));
-        if (index < 0) {
-            index = Math.max(0, -(index + 2));
-        } else {
-            // If timestamp was in the list, use previous index to be able to find the
-            // first event with the same timestamp before the checkpoint
-            index = Math.max(0, index - 1);
-        }
-
-        // Position the trace at the checkpoint
-        return restoreCheckpoint(index);
-    }
-
-    @Override
-    public ITmfContext seekIndex(final long rank) {
-
-        // A rank < 0 indicates to seek the first event
-        if (rank < 0) {
-            return fTrace.seekEvent(0);
-        }
-
-        // Find the checkpoint at or before the requested rank.
-        final int index = (int) rank / fCheckpointInterval;
-
-        // Position the trace at the checkpoint
-        return restoreCheckpoint(index);
-    }
-
-    /**
-     * Position the trace at the given checkpoint
-     *
-     * @param checkpoint the checkpoint index
-     * @return the corresponding context
-     */
-    private ITmfContext restoreCheckpoint(final int checkpoint) {
-        ITmfLocation location = null;
-        int index = 0;
-        synchronized (fTraceIndex) {
-            if (!fTraceIndex.isEmpty()) {
-                index = checkpoint;
-                if (index >= fTraceIndex.size()) {
-                    index = fTraceIndex.size() - 1;
-                }
-                location = fTraceIndex.get(index).getLocation();
-            }
-        }
-        final ITmfContext context = fTrace.seekEvent(location);
-        context.setRank((long) index * fCheckpointInterval);
-        return context;
-    }
-
-    // ------------------------------------------------------------------------
-    // Getters
-    // ------------------------------------------------------------------------
-
-    /**
-     * @return the trace index
-     */
-    protected List<ITmfCheckpoint> getTraceIndex() {
-        return fTraceIndex;
-    }
-
-}
index 96a5b93c15806fab831e79b51101c24ff6c443e4..3b55ebe1ecb4c2384ecd18d99543e62a3c4f20d2 100644 (file)
@@ -14,6 +14,8 @@
 
 package org.eclipse.linuxtools.tmf.core.trace;
 
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+
 /**
  * A basic implementation of ITmfContext.
  * <p>
@@ -52,6 +54,7 @@ public class TmfContext implements ITmfContext {
      * Simple constructor (unknown rank)
      *
      * @param location the event location
+     * @since 3.0
      */
     public TmfContext(final ITmfLocation location) {
         this(location, UNKNOWN_RANK);
@@ -62,6 +65,7 @@ public class TmfContext implements ITmfContext {
      *
      * @param location the event location
      * @param rank the event rank
+     * @since 3.0
      */
     public TmfContext(final ITmfLocation location, final long rank) {
         fLocation = location;
@@ -85,11 +89,17 @@ public class TmfContext implements ITmfContext {
     // ITmfContext
     // ------------------------------------------------------------------------
 
+    /**
+     * @since 3.0
+     */
     @Override
     public ITmfLocation getLocation() {
         return fLocation;
     }
 
+    /**
+     * @since 3.0
+     */
     @Override
     public void setLocation(final ITmfLocation location) {
         fLocation = location;
index fd36a951c8d13b38268eca6d1faea2ca486e7df7..8f5d2c6181951ba0cb410f92a3b65814f1f8e0d2 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
+ * Copyright (c) 2009, 2013 Ericsson, École Polytechnique de Montréal
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  *   Francois Chouinard - Updated as per TMF Trace Model 1.0
  *   Patrick Tasse - Updated for removal of context clone
  *   Patrick Tasse - Updated for ranks in experiment location
+ *   Geneviève Bastien - Added support of experiment synchronization
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.core.trace;
 
+import java.io.File;
+
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.linuxtools.internal.tmf.core.Activator;
 import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentContext;
 import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentLocation;
 import org.eclipse.linuxtools.internal.tmf.core.trace.TmfLocationArray;
+import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
@@ -30,9 +36,14 @@ 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.signal.TmfTraceSynchronizedSignal;
+import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationAlgorithm;
+import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationManager;
 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.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 
 /**
  * TmfExperiment presents a time-ordered, unified view of a set of ITmfTrace:s
@@ -47,6 +58,13 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
     // Constants
     // ------------------------------------------------------------------------
 
+    /**
+     * The file name of the Synchronization
+     *
+     * @since 3.0
+     */
+    public final static String SYNCHRONIZATION_FILE_NAME = "synchronization.bin"; //$NON-NLS-1$
+
     /**
      * The default index page size
      */
@@ -76,9 +94,12 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
     // ------------------------------------------------------------------------
 
     /**
-     * @param type the event type
-     * @param id the experiment id
-     * @param traces the experiment set of traces
+     * @param type
+     *            the event type
+     * @param id
+     *            the experiment id
+     * @param traces
+     *            the experiment set of traces
      */
     public TmfExperiment(final Class<? extends ITmfEvent> type, final String id, final ITmfTrace[] traces) {
         this(type, id, traces, DEFAULT_INDEX_PAGE_SIZE, null);
@@ -100,12 +121,15 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
         this(type, id, traces, DEFAULT_INDEX_PAGE_SIZE, resource);
     }
 
-
     /**
-     * @param type the event type
-     * @param path the experiment path
-     * @param traces the experiment set of traces
-     * @param indexPageSize the experiment index page size
+     * @param type
+     *            the event type
+     * @param path
+     *            the experiment path
+     * @param traces
+     *            the experiment set of traces
+     * @param indexPageSize
+     *            the experiment index page size
      */
     public TmfExperiment(final Class<? extends ITmfEvent> type, final String path, final ITmfTrace[] traces, final int indexPageSize) {
         this(type, path, traces, indexPageSize, null);
@@ -138,6 +162,14 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
         }
 
         fTraces = traces;
+
+        if (resource != null) {
+            try {
+                this.synchronizeTraces();
+            } catch (TmfTraceException e) {
+                Activator.logError("Error synchronizing experiment", e); //$NON-NLS-1$
+            }
+        }
     }
 
     /**
@@ -193,7 +225,8 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
      * Returns the timestamp of the event at the requested index. If none,
      * returns null.
      *
-     * @param index the event index (rank)
+     * @param index
+     *            the event index (rank)
      * @return the corresponding event timestamp
      * @since 2.0
      */
@@ -207,7 +240,8 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
     /**
      * Set the file to be used for bookmarks on this experiment
      *
-     * @param file the bookmarks file
+     * @param file
+     *            the bookmarks file
      */
     public void setBookmarksFile(final IFile file) {
         fBookmarksFile = file;
@@ -238,8 +272,8 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
         }
 
         if (request instanceof ITmfEventRequest
-            && !TmfTimestamp.BIG_BANG.equals(((ITmfEventRequest) request).getRange().getStartTime())
-            && request.getIndex() == 0)
+                && !TmfTimestamp.BIG_BANG.equals(((ITmfEventRequest) request).getRange().getStartTime())
+                && request.getIndex() == 0)
         {
             final ITmfContext context = seekEvent(((ITmfEventRequest) request).getRange().getStartTime());
             ((ITmfEventRequest) request).setStartIndex((int) context.getRank());
@@ -254,6 +288,9 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
     // ITmfTrace trace positioning
     // ------------------------------------------------------------------------
 
+    /**
+     * @since 3.0
+     */
     @Override
     public synchronized ITmfContext seekEvent(final ITmfLocation location) {
         // Validate the location
@@ -306,6 +343,9 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
         return context;
     }
 
+    /**
+     * @since 3.0
+     */
     @Override
     public double getLocationRatio(final ITmfLocation location) {
         if (location instanceof TmfExperimentLocation) {
@@ -319,6 +359,9 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
         return 0.0;
     }
 
+    /**
+     * @since 3.0
+     */
     @Override
     public ITmfLocation getCurrentLocation() {
         // never used
@@ -351,7 +394,8 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
 
         TmfExperimentContext expContext = (TmfExperimentContext) context;
 
-        // If an event was consumed previously, first get the next one from that trace
+        // If an event was consumed previously, first get the next one from that
+        // trace
         final int lastTrace = expContext.getLastTrace();
         if (lastTrace != TmfExperimentContext.NO_TRACE) {
             final ITmfContext traceContext = expContext.getContexts()[lastTrace];
@@ -414,6 +458,62 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
         return initTs;
     }
 
+    /**
+     * Synchronizes the traces of an experiment. By default it only tries to
+     * read a synchronization file if it exists
+     *
+     * @return The synchronization object
+     * @throws TmfTraceException
+     *             propagate TmfTraceExceptions
+     * @since 3.0
+     */
+    public synchronized SynchronizationAlgorithm synchronizeTraces() throws TmfTraceException {
+        return synchronizeTraces(false);
+    }
+
+    /**
+     * Synchronizes the traces of an experiment.
+     *
+     * @param doSync
+     *            Whether to actually synchronize or just try opening a sync
+     *            file
+     * @return The synchronization object
+     * @throws TmfTraceException
+     *             propagate TmfTraceExceptions
+     * @since 3.0
+     */
+    public synchronized SynchronizationAlgorithm synchronizeTraces(boolean doSync) throws TmfTraceException {
+
+        /* Set up the path to the synchronization file we'll use */
+        IResource resource = this.getResource();
+        String supplDirectory = null;
+
+        try {
+            /* get the directory where the file will be stored. */
+            if (resource != null) {
+                supplDirectory = resource.getPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER);
+            }
+        } catch (CoreException e) {
+            throw new TmfTraceException(e.toString(), e);
+        }
+
+        final File syncFile = (supplDirectory != null) ? new File(supplDirectory + File.separator + SYNCHRONIZATION_FILE_NAME) : null;
+
+        final SynchronizationAlgorithm syncAlgo = SynchronizationManager.synchronizeTraces(syncFile, fTraces, doSync);
+
+        final TmfTraceSynchronizedSignal signal = new TmfTraceSynchronizedSignal(this, syncAlgo);
+
+        /* Broadcast in separate thread to prevent deadlock */
+        new Thread() {
+            @Override
+            public void run() {
+                broadcast(signal);
+            }
+        }.start();
+
+        return syncAlgo;
+    }
+
     @Override
     @SuppressWarnings("nls")
     public synchronized String toString() {
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfLocation.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfLocation.java
deleted file mode 100644 (file)
index 5c9bdd1..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2013 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 Trace Model 1.0
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.trace;
-
-
-/**
- * A abstract implementation of ITmfLocation. The concrete classes must provide
- * comparable location information.
- *
- * @version 2.0
- * @author Francois Chouinard
- */
-public abstract class TmfLocation implements ITmfLocation {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private final Comparable<?> fLocationInfo;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Standard constructor.
-     *
-     * @param locationInfo
-     *            The concrete trace location
-     */
-    public TmfLocation(final Comparable<?> locationInfo) {
-        fLocationInfo = locationInfo;
-    }
-
-    /**
-     * Copy constructor
-     *
-     * @param location
-     *            The original trace location
-     */
-    public TmfLocation(final TmfLocation location) {
-        fLocationInfo = location.fLocationInfo;
-    }
-
-    // ------------------------------------------------------------------------
-    // Getters
-    // ------------------------------------------------------------------------
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public Comparable<?> getLocationInfo() {
-        return fLocationInfo;
-    }
-
-    // ------------------------------------------------------------------------
-    // Object
-    // ------------------------------------------------------------------------
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((fLocationInfo != null) ? fLocationInfo.hashCode() : 0);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final TmfLocation other = (TmfLocation) obj;
-        if (fLocationInfo == null) {
-            if (other.fLocationInfo != null) {
-                return false;
-            }
-        } else if (!fLocationInfo.equals(other.fLocationInfo)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    @SuppressWarnings("nls")
-    public String toString() {
-        return getClass().getSimpleName() + " [fLocationInfo=" + fLocationInfo + "]";
-    }
-
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfLongLocation.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfLongLocation.java
deleted file mode 100644 (file)
index 905e372..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 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.trace;
-
-/**
- * A concrete implementation of TmfLocation based on Long:s
- *
- * @author Francois Chouinard
- * @since 2.0
- */
-public final class TmfLongLocation extends TmfLocation {
-
-    /**
-     * The normal constructor
-     *
-     * @param locationInfo the concrete location
-     */
-    public TmfLongLocation(final Long locationInfo) {
-        super(locationInfo);
-    }
-
-    /**
-     * The copy constructor
-     *
-     * @param other the other location
-     */
-    public TmfLongLocation(final TmfLongLocation other) {
-        super(other.getLocationInfo());
-    }
-
-    @Override
-    public Long getLocationInfo() {
-        return (Long) super.getLocationInfo();
-    }
-
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTimestampLocation.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTimestampLocation.java
deleted file mode 100644 (file)
index 5136d6d..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 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.trace;
-
-import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-
-/**
- * A concrete implementation of TmfLocation based on ITmfTimestamp:s
- *
- * @author Francois Chouinard
- * @since 2.0
- */
-public final class TmfTimestampLocation extends TmfLocation {
-
-    /**
-     * The normal constructor
-     *
-     * @param locationInfo the concrete location
-     */
-    public TmfTimestampLocation(final ITmfTimestamp locationInfo) {
-        super(locationInfo);
-    }
-
-    /**
-     * The copy constructor
-     *
-     * @param other the other location
-     */
-    public TmfTimestampLocation(final TmfTimestampLocation other) {
-        super(other.getLocationInfo());
-    }
-
-    @Override
-    public ITmfTimestamp getLocationInfo() {
-        return (ITmfTimestamp) super.getLocationInfo();
-    }
-
-}
index 8543d66ff16a97e955db766321d18d1387d89eb9..ea3f7b59f41e1af5ede9060cf549613cc292426c 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
+ * Copyright (c) 2009, 2013 Ericsson, École Polytechnique de Montréal
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  *   Francois Chouinard - Initial API and implementation
  *   Francois Chouinard - Updated as per TMF Trace Model 1.0
  *   Patrick Tasse - Updated for removal of context clone
+ *   Geneviève Bastien  - Added timestamp transforms, its saving to file and
+ *                        timestamp creation functions
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.core.trace;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
+import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.linuxtools.internal.tmf.core.Activator;
+import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
 import org.eclipse.linuxtools.tmf.core.component.TmfEventProvider;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
@@ -34,9 +48,14 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfTraceRangeUpdatedSignal;
 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.synchronization.ITmfTimestampTransform;
+import org.eclipse.linuxtools.tmf.core.synchronization.TmfTimestampTransform;
 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.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 
 /**
  * Abstract implementation of ITmfTrace.
@@ -109,6 +128,10 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
     protected final Map<String, ITmfStateSystem> fStateSystems =
             new LinkedHashMap<String, ITmfStateSystem>();
 
+    private ITmfTimestampTransform fTsTransform;
+
+    private static final String SYNCHRONIZATION_FORMULA_FILE = "sync_formula"; //$NON-NLS-1$
+
     // ------------------------------------------------------------------------
     // Construction
     // ------------------------------------------------------------------------
@@ -247,16 +270,21 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
      * The default implementation of TmfTrace uses a TmfStatistics back-end.
      * Override this if you want to specify another type (or none at all).
      *
-     * @throws TmfTraceException
-     *             If there was a problem setting up the statistics
-     * @since 2.0
+     * @return An IStatus indicating if the statistics could be built
+     *         successfully or not.
+     * @since 3.0
      */
-    protected void buildStatistics() throws TmfTraceException {
+    protected IStatus buildStatistics() {
         /*
          * Initialize the statistics provider, but only if a Resource has been
          * set (so we don't build it for experiments, for unit tests, etc.)
          */
-        fStatistics = (fResource == null ? null : new TmfStateStatistics(this) );
+        try {
+            fStatistics = (fResource == null ? null : new TmfStateStatistics(this) );
+        } catch (TmfTraceException e) {
+            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
+        }
+        return Status.OK_STATUS;
     }
 
     /**
@@ -265,17 +293,16 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
      * Suppressing the warning, because the 'throws' will usually happen in
      * sub-classes.
      *
-     * @throws TmfTraceException
-     *             If there is a problem during the build
-     * @since 2.0
+     * @return An IStatus indicating if the state system could be build
+     *         successfully or not.
+     * @since 3.0
      */
-    @SuppressWarnings("unused")
-    protected void buildStateSystem() throws TmfTraceException {
+    protected IStatus buildStateSystem() {
         /*
          * Nothing is done in the base implementation, please specify
          * how/if to register a new state system in derived classes.
          */
-        return;
+        return Status.OK_STATUS;
     }
 
     /**
@@ -332,6 +359,7 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
 
     /**
      * @return the trace indexer
+     * @since 3.0
      */
     protected ITmfTraceIndexer getIndexer() {
         return fIndexer;
@@ -410,6 +438,14 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
         return new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE, ITmfTimestamp.NANOSECOND_SCALE);
     }
 
+    /**
+     * @since 3.0
+     */
+    @Override
+    public String getHostId() {
+        return this.getName();
+    }
+
     // ------------------------------------------------------------------------
     // Convenience setters
     // ------------------------------------------------------------------------
@@ -477,6 +513,7 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
      * Set the trace indexer. Must be done at initialization time.
      *
      * @param indexer the trace indexer
+     * @since 3.0
      */
     protected void setIndexer(final ITmfTraceIndexer indexer) {
         fIndexer = indexer;
@@ -660,11 +697,11 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
          * The signal is either for this trace, or for an experiment containing
          * this trace.
          */
-        try {
-            buildStatistics();
-            buildStateSystem();
-        } catch (TmfTraceException e) {
-            e.printStackTrace();
+        MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null);
+        status.add(buildStatistics());
+        status.add(buildStateSystem());
+        if (!status.isOK()) {
+            Activator.log(status);
         }
 
         /* Refresh the project, so it can pick up new files that got created. */
@@ -716,6 +753,102 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
         }
     }
 
+    /**
+     * Returns the file resource used to store synchronization formula. The file
+     * may not exist.
+     *
+     * @return the synchronization file
+     */
+    private File getSyncFormulaFile() {
+        File file = null;
+        if (fResource instanceof IFolder) {
+            try {
+                String supplDirectory;
+
+                supplDirectory = fResource.getPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER);
+
+                file = new File(supplDirectory + File.separator + SYNCHRONIZATION_FORMULA_FILE);
+
+            } catch (CoreException e) {
+
+            }
+        }
+        return file;
+    }
+
+    // ------------------------------------------------------------------------
+    // Timestamp transformation functions
+    // ------------------------------------------------------------------------
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public ITmfTimestampTransform getTimestampTransform() {
+        if (fTsTransform == null) {
+            /* Check if a formula is stored somewhere in the resources */
+            File sync_file = getSyncFormulaFile();
+            if (sync_file != null && sync_file.exists()) {
+
+                try {
+                    FileInputStream fis = new FileInputStream(sync_file);
+                    ObjectInputStream ois = new ObjectInputStream(fis);
+                    fTsTransform = (ITmfTimestampTransform) ois.readObject();
+
+                    ois.close();
+                    fis.close();
+                } catch (ClassNotFoundException e1) {
+                    fTsTransform = TmfTimestampTransform.IDENTITY;
+                } catch (FileNotFoundException e1) {
+                    fTsTransform = TmfTimestampTransform.IDENTITY;
+                } catch (IOException e1) {
+                    fTsTransform = TmfTimestampTransform.IDENTITY;
+                }
+            } else {
+                fTsTransform = TmfTimestampTransform.IDENTITY;
+            }
+        }
+        return fTsTransform;
+    }
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public void setTimestampTransform(final ITmfTimestampTransform tt) {
+        fTsTransform = tt;
+
+        /* Save the timestamp transform to a file */
+        File sync_file = getSyncFormulaFile();
+        if (sync_file != null) {
+            if (sync_file.exists()) {
+                sync_file.delete();
+            }
+            FileOutputStream fos;
+            ObjectOutputStream oos;
+
+            /* Save the header of the file */
+            try {
+                fos = new FileOutputStream(sync_file, false);
+                oos = new ObjectOutputStream(fos);
+
+                oos.writeObject(fTsTransform);
+                oos.close();
+                fos.close();
+            } catch (IOException e1) {
+                Activator.logError("Error writing timestamp transform for trace", e1); //$NON-NLS-1$
+            }
+        }
+    }
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public ITmfTimestamp createTimestamp(long ts) {
+        return new TmfTimestamp(getTimestampTransform().transform(ts));
+    }
+
     // ------------------------------------------------------------------------
     // toString
     // ------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/ITmfTraceIndexer.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/ITmfTraceIndexer.java
new file mode 100644 (file)
index 0000000..3f27948
--- /dev/null
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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.trace.indexer;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+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;
+
+/**
+ * The generic trace indexer in TMF with support for incremental indexing.
+ *
+ * @see ITmfTrace
+ * @see ITmfEvent
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public interface ITmfTraceIndexer {
+
+    /**
+     * Start an asynchronous index building job and waits for the job completion
+     * if required. Typically, the indexing job sends notifications at regular
+     * intervals to indicate its progress.
+     * <p>
+     * <b>Example 1</b>: Index a whole trace asynchronously
+     *
+     * <pre>
+     * trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, false);
+     * </pre>
+     *
+     * <b>Example 2</b>: Index a whole trace synchronously
+     *
+     * <pre>
+     * trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, true);
+     * </pre>
+     *
+     * <b>Example 3</b>: Index a trace asynchronously, starting at rank 100
+     *
+     * <pre>
+     * trace.getIndexer().buildIndex(100, TmfTimeRange.ETERNITY, false);
+     * </pre>
+     *
+     * <b>Example 4</b>: Index a trace asynchronously, starting at rank 100 for
+     * events between T1 and T2 (inclusive). This is used for incremental
+     * indexing.
+     *
+     * <pre>
+     * TmfTimeRange range = new TmfTimeRange(T1, T2);
+     * trace.getIndexer().buildIndex(100, range, false);
+     * </pre>
+     *
+     * @param offset
+     *            The offset of the first event to consider
+     * @param range
+     *            The time range to consider
+     * @param waitForCompletion
+     *            Should we block the calling thread until the build is
+     *            complete?
+     * @since 2.0
+     */
+    void buildIndex(long offset, TmfTimeRange range, boolean waitForCompletion);
+
+    /**
+     * Indicates that the indexer is busy indexing the trace.
+     * Will always return false if the indexing is done synchronously.
+     *
+     * @return the state of the indexer (indexing or not)
+     */
+    boolean isIndexing();
+
+    /**
+     * Adds an entry to the trace index.
+     *
+     * @param context The trace context to save
+     * @param timestamp The timestamp matching this context
+     * @since 2.0
+     */
+    void updateIndex(ITmfContext context, ITmfTimestamp timestamp);
+
+    /**
+     * Returns the context of the checkpoint immediately preceding the requested
+     * timestamp (or at the timestamp if it coincides with a checkpoint).
+     *
+     * @param timestamp the requested timestamp
+     * @return the checkpoint context
+     * @since 2.0
+     */
+    ITmfContext seekIndex(ITmfTimestamp timestamp);
+
+    /**
+     * Returns the context of the checkpoint immediately preceding the requested
+     * rank (or at rank if it coincides with a checkpoint).
+     *
+     * @param rank the requested event rank
+     * @return the checkpoint context
+     */
+    ITmfContext seekIndex(long rank);
+
+    /**
+     * Perform cleanup when the indexer is no longer required.
+     */
+    void dispose();
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/ITmfCheckpoint.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/ITmfCheckpoint.java
new file mode 100644 (file)
index 0000000..9dcb499
--- /dev/null
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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
+ *   Patrick Tasse - Updated for location in checkpoint
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+
+/**
+ * The basic trace checkpoint structure in TMF. The purpose of the checkpoint is
+ * to associate a trace location to an event timestamp.
+ * *
+ * @see ITmfTimestamp
+ * @see ITmfLocation
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public interface ITmfCheckpoint extends Comparable<ITmfCheckpoint> {
+
+    // ------------------------------------------------------------------------
+    // Getters
+    // ------------------------------------------------------------------------
+
+    /**
+     * @return the timestamp of the event referred to by the context
+     * @since 2.0
+     */
+    ITmfTimestamp getTimestamp();
+
+    /**
+     * @return the location of the event referred to by the checkpoint
+     */
+    ITmfLocation getLocation();
+
+    // ------------------------------------------------------------------------
+    // Comparable
+    // ------------------------------------------------------------------------
+
+    @Override
+    int compareTo(ITmfCheckpoint checkpoint);
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/TmfCheckpoint.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/TmfCheckpoint.java
new file mode 100644 (file)
index 0000000..e2d5624
--- /dev/null
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 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 Trace Model 1.0
+ *   Patrick Tasse - Updated for location in checkpoint
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+
+/**
+ * A basic implementation of ITmfCheckpoint. It simply maps an event timestamp
+ * to a generic location.
+ *
+ * @see ITmfLocation
+ * @see ITmfTimestamp
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public class TmfCheckpoint implements ITmfCheckpoint {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    // The checkpoint location
+    private final ITmfLocation fLocation;
+
+    // The checkpoint timestamp
+    private final ITmfTimestamp fTimestamp;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Full constructor
+     *
+     * @param timestamp the checkpoint timestamp
+     * @param location the corresponding trace location
+     * @since 3.0
+     */
+    public TmfCheckpoint(final ITmfTimestamp timestamp, final ITmfLocation location) {
+        fTimestamp = timestamp;
+        fLocation = location;
+    }
+
+    /**
+     * Copy constructor
+     *
+     * @param other the other checkpoint
+     */
+    public TmfCheckpoint(final TmfCheckpoint other) {
+        if (other == null) {
+            throw new IllegalArgumentException();
+        }
+        fTimestamp = other.fTimestamp;
+        fLocation = other.fLocation;
+    }
+
+    // ------------------------------------------------------------------------
+    // ITmfCheckpoint
+    // ------------------------------------------------------------------------
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public ITmfTimestamp getTimestamp() {
+        return fTimestamp;
+    }
+
+    @Override
+    public ITmfLocation getLocation() {
+        return fLocation;
+    }
+
+    // ------------------------------------------------------------------------
+    // Comparable
+    // ------------------------------------------------------------------------
+
+    @Override
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    public int compareTo(final ITmfCheckpoint other) {
+        int comp = 0;
+        if ((fTimestamp != null) && (other.getTimestamp() != null)) {
+            comp = fTimestamp.compareTo(other.getTimestamp(), false);
+            if (comp != 0) {
+                return comp;
+            }
+            // compare locations if timestamps are the same
+        }
+
+        if ((fLocation == null) && (other.getLocation() == null)) {
+            return 0;
+        }
+
+        // treat location of other as null location which is before any location
+        if ((fLocation != null) && (other.getLocation() == null)) {
+            return 1;
+        }
+
+        // treat this as null location which is before any other locations
+        if ((fLocation == null) && (other.getLocation() != null)) {
+            return -1;
+        }
+
+        // compare location
+        final Comparable location1 = getLocation().getLocationInfo();
+        final Comparable location2 = other.getLocation().getLocationInfo();
+        return location1.compareTo(location2);
+    }
+
+    // ------------------------------------------------------------------------
+    // Object
+    // ------------------------------------------------------------------------
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((fLocation == null) ? 0 : fLocation.hashCode());
+        result = prime * result + ((fTimestamp == null) ? 0 : fTimestamp.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof TmfCheckpoint)) {
+            return false;
+        }
+        final TmfCheckpoint other = (TmfCheckpoint) obj;
+        if (fLocation == null) {
+            if (other.fLocation != null) {
+                return false;
+            }
+        } else if (!fLocation.equals(other.fLocation)) {
+            return false;
+        }
+        if (fTimestamp == null) {
+            if (other.fTimestamp != null) {
+                return false;
+            }
+        } else if (!fTimestamp.equals(other.fTimestamp)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    @SuppressWarnings("nls")
+    public String toString() {
+        return getClass().getSimpleName() + " [fLocation=" + fLocation + ", fTimestamp=" + fTimestamp + "]";
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java
new file mode 100644 (file)
index 0000000..18ddef9
--- /dev/null
@@ -0,0 +1,324 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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.trace.indexer.checkpoint;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+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.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;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+
+/**
+ * A simple indexer that manages the trace index as an array of trace
+ * checkpoints. Checkpoints are stored at fixed intervals (event rank) in
+ * ascending timestamp order.
+ * <p>
+ * The goal being to access a random trace event reasonably fast from the user's
+ * standpoint, picking the right interval value becomes a trade-off between speed
+ * and memory usage (a shorter inter-event interval is faster but requires more
+ * checkpoints).
+ * <p>
+ * Locating a specific checkpoint is trivial for both rank (rank % interval) and
+ * timestamp (bsearch in the array).
+ * *
+ * @see ITmfTrace
+ * @see ITmfEvent
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public class TmfCheckpointIndexer implements ITmfTraceIndexer {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    /** The event trace to index */
+    protected final ITmfTrace fTrace;
+
+    /** The interval between checkpoints */
+    private final int fCheckpointInterval;
+
+    /** The event trace to index */
+    private boolean fIsIndexing;
+
+    /**
+     * The trace index. It is composed of checkpoints taken at intervals of
+     * fCheckpointInterval events.
+     */
+    protected final List<ITmfCheckpoint> fTraceIndex;
+
+    /**
+     * The indexing request
+     */
+    private ITmfEventRequest fIndexingRequest = null;
+
+    // ------------------------------------------------------------------------
+    // Construction
+    // ------------------------------------------------------------------------
+
+    /**
+     * Basic constructor that uses the default trace block size as checkpoints
+     * intervals
+     *
+     * @param trace the trace to index
+     */
+    public TmfCheckpointIndexer(final ITmfTrace trace) {
+        this(trace, TmfDataProvider.DEFAULT_BLOCK_SIZE);
+    }
+
+    /**
+     * Full trace indexer
+     *
+     * @param trace the trace to index
+     * @param interval the checkpoints interval
+     */
+    public TmfCheckpointIndexer(final ITmfTrace trace, final int interval) {
+        fTrace = trace;
+        fCheckpointInterval = interval;
+        fTraceIndex = new ArrayList<ITmfCheckpoint>();
+        fIsIndexing = false;
+    }
+
+    @Override
+    public void dispose() {
+        if ((fIndexingRequest != null) && !fIndexingRequest.isCompleted()) {
+            fIndexingRequest.cancel();
+            fTraceIndex.clear();
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // ITmfTraceIndexer - isIndexing
+    // ------------------------------------------------------------------------
+
+    @Override
+    public boolean isIndexing() {
+        return fIsIndexing;
+    }
+
+    // ------------------------------------------------------------------------
+    // ITmfTraceIndexer - buildIndex
+    // ------------------------------------------------------------------------
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public void buildIndex(final long offset, final TmfTimeRange range, final boolean waitForCompletion) {
+
+        // Don't do anything if we are already indexing
+        synchronized (fTraceIndex) {
+            if (fIsIndexing) {
+                return;
+            }
+            fIsIndexing = true;
+        }
+
+        // The monitoring job
+        final Job job = new Job("Indexing " + fTrace.getName() + "...") { //$NON-NLS-1$ //$NON-NLS-2$
+            @Override
+            protected IStatus run(final IProgressMonitor monitor) {
+                monitor.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
+                while (!monitor.isCanceled()) {
+                    try {
+                        long prevNbEvents = fTrace.getNbEvents();
+                        Thread.sleep(250);
+                        long nbEvents = fTrace.getNbEvents();
+                        setName(Messages.TmfCheckpointIndexer_Indexing + ' ' + fTrace.getName() + " (" + nbEvents + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+                        // setName doesn't refresh the UI, setTaskName does
+                        long rate = (nbEvents - prevNbEvents) * 4;
+                        monitor.setTaskName(rate + " " + Messages.TmfCheckpointIndexer_EventsPerSecond); //$NON-NLS-1$
+                    } catch (final InterruptedException e) {
+                        return Status.OK_STATUS;
+                    }
+                }
+                monitor.done();
+                return Status.OK_STATUS;
+            }
+        };
+        job.schedule();
+
+        // Build a background request for all the trace data. The index is
+        // updated as we go by readNextEvent().
+        fIndexingRequest = new TmfEventRequest(ITmfEvent.class,
+                range, offset, TmfDataRequest.ALL_DATA,
+                ITmfDataRequest.ExecutionType.BACKGROUND) {
+            @Override
+            public void handleData(final ITmfEvent event) {
+                super.handleData(event);
+                if (event != null) {
+                    // Update the trace status at regular intervals
+                    if ((getNbRead() % fCheckpointInterval) == 0) {
+                        updateTraceStatus();
+                    }
+                }
+            }
+
+            @Override
+            public void handleSuccess() {
+                updateTraceStatus();
+            }
+
+            @Override
+            public void handleCompleted() {
+                job.cancel();
+                super.handleCompleted();
+                fIsIndexing = false;
+            }
+
+            private void updateTraceStatus() {
+                if (fTrace.getNbEvents() > 0) {
+                    signalNewTimeRange(fTrace.getStartTime(), fTrace.getEndTime());
+                }
+            }
+        };
+
+        // Submit the request and wait for completion if required
+        fTrace.sendRequest(fIndexingRequest);
+        if (waitForCompletion) {
+            try {
+                fIndexingRequest.waitForCompletion();
+            } catch (final InterruptedException e) {
+            }
+        }
+    }
+
+    /**
+     * Notify the interested parties that the trace time range has changed
+     *
+     * @param startTime the new start time
+     * @param endTime the new end time
+     */
+    private void signalNewTimeRange(final ITmfTimestamp startTime, final ITmfTimestamp endTime) {
+        fTrace.broadcast(new TmfTraceUpdatedSignal(fTrace, fTrace, new TmfTimeRange(startTime, endTime)));
+    }
+
+    // ------------------------------------------------------------------------
+    // ITmfTraceIndexer - updateIndex
+    // ------------------------------------------------------------------------
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public synchronized void updateIndex(final ITmfContext context, final ITmfTimestamp timestamp) {
+        if ((context.getRank() % fCheckpointInterval) == 0) {
+            // Determine the table position
+            final long position = context.getRank() / fCheckpointInterval;
+            // Add new entry at proper location (if empty)
+            if (fTraceIndex.size() == position) {
+                fTraceIndex.add(new TmfCheckpoint(timestamp, context.getLocation()));
+            }
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // ITmfTraceIndexer - seekIndex
+    // ------------------------------------------------------------------------
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public synchronized ITmfContext seekIndex(final ITmfTimestamp timestamp) {
+
+        // A null timestamp indicates to seek the first event
+        if (timestamp == null) {
+            return fTrace.seekEvent(0);
+        }
+
+        // Find the checkpoint at or before the requested timestamp.
+        // In the very likely event that the timestamp is not at a checkpoint
+        // boundary, bsearch will return index = (- (insertion point + 1)).
+        // It is then trivial to compute the index of the previous checkpoint.
+        int index = Collections.binarySearch(fTraceIndex, new TmfCheckpoint(timestamp, null));
+        if (index < 0) {
+            index = Math.max(0, -(index + 2));
+        } else {
+            // If timestamp was in the list, use previous index to be able to find the
+            // first event with the same timestamp before the checkpoint
+            index = Math.max(0, index - 1);
+        }
+
+        // Position the trace at the checkpoint
+        return restoreCheckpoint(index);
+    }
+
+    @Override
+    public ITmfContext seekIndex(final long rank) {
+
+        // A rank < 0 indicates to seek the first event
+        if (rank < 0) {
+            return fTrace.seekEvent(0);
+        }
+
+        // Find the checkpoint at or before the requested rank.
+        final int index = (int) rank / fCheckpointInterval;
+
+        // Position the trace at the checkpoint
+        return restoreCheckpoint(index);
+    }
+
+    /**
+     * Position the trace at the given checkpoint
+     *
+     * @param checkpoint the checkpoint index
+     * @return the corresponding context
+     */
+    private ITmfContext restoreCheckpoint(final int checkpoint) {
+        ITmfLocation location = null;
+        int index = 0;
+        synchronized (fTraceIndex) {
+            if (!fTraceIndex.isEmpty()) {
+                index = checkpoint;
+                if (index >= fTraceIndex.size()) {
+                    index = fTraceIndex.size() - 1;
+                }
+                location = fTraceIndex.get(index).getLocation();
+            }
+        }
+        final ITmfContext context = fTrace.seekEvent(location);
+        context.setRank((long) index * fCheckpointInterval);
+        return context;
+    }
+
+    // ------------------------------------------------------------------------
+    // Getters
+    // ------------------------------------------------------------------------
+
+    /**
+     * @return the trace index
+     */
+    protected List<ITmfCheckpoint> getTraceIndex() {
+        return fTraceIndex;
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/ITmfLocation.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/ITmfLocation.java
new file mode 100644 (file)
index 0000000..1280723
--- /dev/null
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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 Trace Model 1.0
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace.location;
+
+/**
+ * The generic trace location in TMF.
+ * <p>
+ * An ITmfLocation is the equivalent of a random-access file position, holding
+ * enough information to allow the positioning of the trace 'pointer' to read an
+ * arbitrary event.
+ * <p>
+ * This location is trace-specific, must be comparable and immutable.
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public interface ITmfLocation {
+
+    // ------------------------------------------------------------------------
+    // Getters
+    // ------------------------------------------------------------------------
+
+    /**
+     * Returns the concrete trace location information
+     *
+     * @return the location information
+     * @since 2.0
+     */
+    Comparable<?> getLocationInfo();
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfLocation.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfLocation.java
new file mode 100644 (file)
index 0000000..133f002
--- /dev/null
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 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 Trace Model 1.0
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace.location;
+
+
+/**
+ * A abstract implementation of ITmfLocation. The concrete classes must provide
+ * comparable location information.
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public abstract class TmfLocation implements ITmfLocation {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private final Comparable<?> fLocationInfo;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Standard constructor.
+     *
+     * @param locationInfo
+     *            The concrete trace location
+     */
+    public TmfLocation(final Comparable<?> locationInfo) {
+        fLocationInfo = locationInfo;
+    }
+
+    /**
+     * Copy constructor
+     *
+     * @param location
+     *            The original trace location
+     */
+    public TmfLocation(final TmfLocation location) {
+        fLocationInfo = location.fLocationInfo;
+    }
+
+    // ------------------------------------------------------------------------
+    // Getters
+    // ------------------------------------------------------------------------
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public Comparable<?> getLocationInfo() {
+        return fLocationInfo;
+    }
+
+    // ------------------------------------------------------------------------
+    // Object
+    // ------------------------------------------------------------------------
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((fLocationInfo != null) ? fLocationInfo.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TmfLocation other = (TmfLocation) obj;
+        if (fLocationInfo == null) {
+            if (other.fLocationInfo != null) {
+                return false;
+            }
+        } else if (!fLocationInfo.equals(other.fLocationInfo)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    @SuppressWarnings("nls")
+    public String toString() {
+        return getClass().getSimpleName() + " [fLocationInfo=" + fLocationInfo + "]";
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfLongLocation.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfLongLocation.java
new file mode 100644 (file)
index 0000000..38877ca
--- /dev/null
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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.trace.location;
+
+
+/**
+ * A concrete implementation of TmfLocation based on Long:s
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public final class TmfLongLocation extends TmfLocation {
+
+    /**
+     * The normal constructor
+     *
+     * @param locationInfo the concrete location
+     */
+    public TmfLongLocation(final Long locationInfo) {
+        super(locationInfo);
+    }
+
+    /**
+     * The copy constructor
+     *
+     * @param other the other location
+     */
+    public TmfLongLocation(final TmfLongLocation other) {
+        super(other.getLocationInfo());
+    }
+
+    @Override
+    public Long getLocationInfo() {
+        return (Long) super.getLocationInfo();
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfTimestampLocation.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfTimestampLocation.java
new file mode 100644 (file)
index 0000000..22c48f4
--- /dev/null
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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.trace.location;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+
+/**
+ * A concrete implementation of TmfLocation based on ITmfTimestamp:s
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public final class TmfTimestampLocation extends TmfLocation {
+
+    /**
+     * The normal constructor
+     *
+     * @param locationInfo the concrete location
+     */
+    public TmfTimestampLocation(final ITmfTimestamp locationInfo) {
+        super(locationInfo);
+    }
+
+    /**
+     * The copy constructor
+     *
+     * @param other the other location
+     */
+    public TmfTimestampLocation(final TmfTimestampLocation other) {
+        super(other.getLocationInfo());
+    }
+
+    @Override
+    public ITmfTimestamp getLocationInfo() {
+        return (ITmfTimestamp) super.getLocationInfo();
+    }
+
+}
index 92bdbd792ed5b4cd592bd85acaab1c98ce6b6f5f..b678cf5e2bf09936593d45724e3bf637b89a9754 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.tmf.help; singleton:=true
 Require-Bundle: org.eclipse.help
index 852aeb334b0acad4f2bc59c45c29f9ab0aecc12b..7813c7c55a9a4e56fda65d9ece5d47e6fc39fcb3 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.tmf.help</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools TMF Help Plug-in</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 13ac74e379f8a15560895968abd66662303739c7..14860f03565a8ab41cbff9152bd678d77400198b 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.tmf.ui.tests;singleton:=true
 Bundle-ActivationPolicy: lazy
@@ -11,7 +11,7 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.ui,
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.ui;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.core.tests;bundle-version="2.1.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core.tests;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.tmf.ui.tests
index 48e0fd6b5680ba7b0eeb820fd42a49f7f6e0da4f..6289575a96aea2a6c7df6f94b7d77c3c2e108ca0 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.tmf.ui.tests</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
   <name>Linux Tools TMF UI Tests Plug-in</name>
index 5f460642d2a5ca1cd7575e0735d54569bb0b038d..c342ae95e69a7b82000f707be1aca6345a6b9f0e 100644 (file)
@@ -134,7 +134,7 @@ public class Uml2SDTestFacility {
             // Create test trace object
             final URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path("tracesets/sdEvents"), null);
             final File test = new File(FileLocator.toFileURL(location).toURI());
-            return new TmfTraceStub(test.getPath(), 500, true, parser, null);
+            return new TmfTraceStub(test.getPath(), 500, true, null, parser);
         } catch (final TmfTraceException e) {
             e.printStackTrace();
             throw new RuntimeException(e);
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
index 1c538bd832d8d7be65cc43ea1b54efa3773b3d9c..5c14b587518c823c25165ad474f0ffa5717806d6 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.linuxtools.tmf.ui;singleton:=true
 Bundle-Activator: org.eclipse.linuxtools.internal.tmf.ui.Activator
@@ -11,7 +11,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.eclipse.core.expressions,
  org.eclipse.core.resources,
  org.eclipse.core.runtime,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
  org.eclipse.ui,
  org.eclipse.ui.ide,
  org.eclipse.ui.navigator,
@@ -39,11 +39,11 @@ Export-Package: org.eclipse.linuxtools.internal.tmf.ui;x-friends:="org.eclipse.l
  org.eclipse.linuxtools.tmf.ui.views.callstack,
  org.eclipse.linuxtools.tmf.ui.views.colors,
  org.eclipse.linuxtools.tmf.ui.views.distribution.model,
- org.eclipse.linuxtools.tmf.ui.views.environment,
  org.eclipse.linuxtools.tmf.ui.views.filter,
  org.eclipse.linuxtools.tmf.ui.views.histogram,
  org.eclipse.linuxtools.tmf.ui.views.statesystem,
  org.eclipse.linuxtools.tmf.ui.views.statistics,
+ org.eclipse.linuxtools.tmf.ui.views.synchronization,
  org.eclipse.linuxtools.tmf.ui.views.timechart,
  org.eclipse.linuxtools.tmf.ui.views.timegraph,
  org.eclipse.linuxtools.tmf.ui.views.uml2sd,
diff --git a/org.eclipse.linuxtools.tmf.ui/icons/eview16/synced.gif b/org.eclipse.linuxtools.tmf.ui/icons/eview16/synced.gif
new file mode 100644 (file)
index 0000000..870934b
Binary files /dev/null and b/org.eclipse.linuxtools.tmf.ui/icons/eview16/synced.gif differ
index 9f43e208f754de6874fb39ea32ccc41c7b0aaf0d..363e56b37f415277e7636aef5b07d229fcbfafd6 100644 (file)
@@ -25,9 +25,10 @@ statistics.view.name = Statistics
 events.editor.name = Events Editor
 uml2sd.view.name = Sequence Diagram
 histogram.view.name = Histogram
-environment.view.name = Environment Variables
 ssvisualizer.view.name = State System Explorer
 callstack.view.name = Call Stack
+synchronization.view.name = Synchronization
+
 
 # Tracing wizards
 project.new.category.name = Tracing
@@ -91,6 +92,10 @@ command.batch_import = Batch Import...
 command.batch_import.mnemonic = B
 command.batch_import.descriptio = Batch Import
 
+command.synchronize_traces = Synchronize Traces
+command.synchronize_traces.mnemonic = y
+command.synchronize_traces.description = Synchronize 2 or more traces
+
 ## Trace menu
 #  Open, Copy, Rename, Delete, Delete Supplementary Files, Select Trace Type
 
index 9a7e5bc246f2da67410ad9874701e93707d1104a..93eaaaef58fd6cd2f9418f53ddbbc8a63466906a 100644 (file)
             id="org.eclipse.linuxtools.tmf.ui.views.timechart"
             name="%timechart.view.name"
             restorable="true">
-      </view> 
-      <view
-            allowMultiple="false"
-            category="org.eclipse.linuxtools.tmf.ui.views.category"
-            class="org.eclipse.linuxtools.tmf.ui.views.environment.TmfEnvironmentView"
-            icon="icons/eview16/events_view.gif"
-            id="org.eclipse.linuxtools.tmf.ui.views.environment"
-            name="%environment.view.name"
-            restorable="true">
       </view>
       <view
             allowMultiple="false"
             name="%callstack.view.name"
             restorable="true">
       </view>
+      <view
+            allowMultiple="false"
+            category="org.eclipse.linuxtools.tmf.ui.views.category"
+            class="org.eclipse.linuxtools.tmf.ui.views.synchronization.TmfSynchronizationView"
+            icon="icons/eview16/synced.gif"
+            id="org.eclipse.linuxtools.tmf.ui.views.synchronization"
+            name="%synchronization.view.name"
+            restorable="true">
+      </view>
    </extension>
    <extension
          point="org.eclipse.ui.editors">
                </with>
             </visibleWhen>
          </command>
+         <command
+               commandId="org.eclipse.linuxtools.tmf.ui.command.synchronize_traces"
+               icon="icons/obj16/add_obj.gif"
+               label="%command.synchronize_traces"
+               mnemonic="%command.synchronize_traces.mnemonic"
+               style="push"
+               tooltip="%commands.synchronize_traces.description">
+            <visibleWhen
+                  checkEnabled="false">
+               <with
+                     variable="selection">
+                  <count
+                        value="1">
+                  </count>
+                  <iterate
+                        ifEmpty="false"
+                        operator="and">
+                     <instanceof
+                           value="org.eclipse.linuxtools.tmf.ui.project.model.TmfExperimentElement">
+                     </instanceof>
+                  </iterate>
+               </with>
+            </visibleWhen>
+         </command>
          <separator
                name="org.eclipse.linuxtools.tmf.ui.separator5"
                visible="true">
             id="org.eclipse.linuxtools.tmf.ui.command.select_traces"
             name="%command.select_traces">
       </command>
+      <command
+            categoryId="org.eclipse.linuxtools.tmf.ui.commands.category"
+            description="%command.synchronize_traces.description"
+            id="org.eclipse.linuxtools.tmf.ui.command.synchronize_traces"
+            name="%command.synchronize_traces">
+      </command>
       <category
             description="%commands.parser.category.description"
             id="org.eclipse.linuxtools.tmf.ui.commands.parser.category"
             </and>
          </activeWhen>
       </handler>
+      <handler
+            class="org.eclipse.linuxtools.internal.tmf.ui.project.handlers.SynchronizeTracesHandler"
+            commandId="org.eclipse.linuxtools.tmf.ui.command.synchronize_traces">
+         <activeWhen>
+            <and>
+               <count
+                     value="1">
+               </count>
+               <iterate
+                     operator="and">
+                  <instanceof
+                        value="org.eclipse.linuxtools.tmf.ui.project.model.TmfExperimentElement">
+                  </instanceof>
+               </iterate>
+            </and>
+         </activeWhen>
+      </handler>
       <handler
             class="org.eclipse.linuxtools.internal.tmf.ui.commands.ManageCustomParsersCommandHandler"
             commandId="org.eclipse.linuxtools.tmf.ui.command.managecustomparsers">
index c94fb5fb6e220ac17b2bfc2583b8ceb04cf15d26..f281f6a106a207c3a6367470aeb0d8975d7162bd 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.tmf.ui</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <name>Linux Tools TMF UI Plug-in</name>
index 931656c9339a55ccfebe6170a19fc5cd9330f96f..cfce95de468b223d94390b14b82891ebbd0bd1a2 100644 (file)
@@ -33,11 +33,11 @@ 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.tmf.core.trace.ITmfTraceIndexer;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
 
 /**
  * Base class for custom plain text traces.
index ab528a37818588da208156b3c344f4741d66b29e..3b593f8603bd0a6a71a7811e35b309f3b145054b 100644 (file)
@@ -15,8 +15,8 @@ package org.eclipse.linuxtools.internal.tmf.ui.parsers.custom;
 import java.util.regex.Matcher;
 
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 
 /**
  * Trace context for custom text traces.
index 4b44255adbe500ccc0ac7b11f6b1f3d76e479da3..4642df05f648bb907eb8b4bd10c53bc816f7770a 100644 (file)
@@ -36,11 +36,11 @@ 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.tmf.core.trace.ITmfTraceIndexer;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
index 310e35503040272bacd1c2cd581d7e780aee4974..55a92f11e9b034b33f74da690be02cba68a6d7af 100644 (file)
@@ -12,8 +12,8 @@
 
 package org.eclipse.linuxtools.internal.tmf.ui.parsers.custom;
 
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 
 /**
  * Trace context for custom XML traces.
index c2b956e0d9a1ee9e23fb60529b386ee362ee69ad..e4294017718f43b74254a183660b86006f7b6cf2 100644 (file)
@@ -33,17 +33,23 @@ public class Messages extends NLS {
     public static String DeleteExperimentHandler_Error;
 
     public static String SelectTraceTypeHandler_ErrorSelectingTrace;
-
     public static String SelectTraceTypeHandler_Title;
-
     public static String SelectTraceTypeHandler_TraceFailedValidation;
-
     public static String SelectTraceTypeHandler_TracesFailedValidation;
     public static String SelectTraceTypeHandler_InvalidTraceType;
 
     public static String DropAdapterAssistant_RenameTraceTitle;
     public static String DropAdapterAssistant_RenameTraceMessage;
 
+    public static String SynchronizeTracesHandler_InitError;
+    public static String SynchronizeTracesHandler_CopyProblem;
+    public static String SynchronizeTracesHandler_WrongType;
+    public static String SynchronizeTracesHandler_WrongTraceNumber;
+    public static String SynchronizeTracesHandler_Title;
+    public static String SynchronizeTracesHandler_Error;
+    public static String SynchronizeTracesHandler_ErrorSynchingExperiment;
+    public static String SynchronizeTracesHandler_ErrorSynchingForTrace;
+
     static {
         // initialize resource bundle
         NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java
new file mode 100644 (file)
index 0000000..ea98f53
--- /dev/null
@@ -0,0 +1,250 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.tmf.ui.project.handlers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationAlgorithm;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
+import org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement;
+import org.eclipse.linuxtools.tmf.ui.project.model.TmfExperimentElement;
+import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
+import org.eclipse.linuxtools.tmf.ui.project.model.TraceUtils;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Handles the synchronization of an experiment, when the user selects this
+ * option in the menu
+ */
+public class SynchronizeTracesHandler extends AbstractHandler {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private TreeSelection fSelection = null;
+    private static final String CR = System.getProperty("line.separator"); //$NON-NLS-1$
+
+    // ------------------------------------------------------------------------
+    // Validation
+    // ------------------------------------------------------------------------
+
+    @Override
+    public boolean isEnabled() {
+        return true;
+    }
+
+    // ------------------------------------------------------------------------
+    // Execution
+    // ------------------------------------------------------------------------
+
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+
+        // Check if we are closing down
+        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+        if (window == null) {
+            return null;
+        }
+
+        // Get the selection
+        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+        IWorkbenchPart part = page.getActivePart();
+        if (part == null) {
+            return false;
+        }
+        ISelectionProvider selectionProvider = part.getSite().getSelectionProvider();
+        if (selectionProvider == null) {
+            return false;
+        }
+        ISelection selection = selectionProvider.getSelection();
+
+        // Make sure selection contains only traces
+        fSelection = null;
+        final ArrayList<TmfTraceElement> tl = new ArrayList<TmfTraceElement>();
+        final ArrayList<TmfExperimentElement> uiexperiment = new ArrayList<TmfExperimentElement>();
+        if (selection instanceof TreeSelection) {
+            fSelection = (TreeSelection) selection;
+            Iterator<Object> iterator = fSelection.iterator();
+            while (iterator.hasNext()) {
+                Object element = iterator.next();
+                if (element instanceof TmfTraceElement) {
+                    tl.add((TmfTraceElement) element);
+                } else if (element instanceof TmfExperimentElement) {
+                    TmfExperimentElement exp = (TmfExperimentElement) element;
+                    uiexperiment.add(exp);
+                    for (TmfTraceElement trace : exp.getTraces()) {
+                        tl.add(trace);
+                    }
+                }
+            }
+        }
+
+        if ((uiexperiment.size() == 1) && (tl.size() > 1)) {
+
+            Thread thread = new Thread() {
+                @Override
+                public void run() {
+
+                    final ITmfTrace[] traces = new ITmfTrace[tl.size()];
+                    final TmfExperimentElement exp = uiexperiment.get(0);
+
+                    for (int i = 0; i < tl.size(); i++) {
+                        ITmfTrace trace = tl.get(i).instantiateTrace();
+                        ITmfEvent traceEvent = tl.get(i).instantiateEvent();
+                        if (trace == null) {
+                            TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title, Messages.SynchronizeTracesHandler_WrongType + tl.get(i).getName());
+                            for (int j = 0; j < i; j++) {
+                                traces[j].dispose();
+                            }
+                            return;
+                        }
+                        try {
+                            trace.initTrace(tl.get(i).getResource(), tl.get(i).getLocation().getPath(), traceEvent.getClass());
+                        } catch (TmfTraceException e) {
+                            TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title, Messages.SynchronizeTracesHandler_InitError + CR + CR + e);
+                            trace.dispose();
+                            for (int j = 0; j < i; j++) {
+                                traces[j].dispose();
+                            }
+                            return;
+                        }
+                        traces[i] = trace;
+                    }
+
+                    /*
+                     * FIXME Unlike traces, there is no instanceExperiment, so
+                     * we call this function here alone. Maybe it would be
+                     * better to do this on experiment's element constructor?
+                     */
+                    exp.refreshSupplementaryFolder();
+                    final TmfExperiment experiment = new TmfExperiment(ITmfEvent.class, exp.getName(), traces, exp.getResource());
+
+                    try {
+                        final SynchronizationAlgorithm syncAlgo = experiment.synchronizeTraces(true);
+
+                        Display.getDefault().asyncExec(new Runnable() {
+                            @Override
+                            public void run() {
+                                /*
+                                 * For each trace in the experiment, if there is
+                                 * a transform equation, copy the original
+                                 * trace, so that a new state system will be
+                                 * generated with sync time.
+                                 */
+                                for (int i = 0; i < tl.size(); i++) {
+                                    TmfTraceElement traceel = tl.get(i);
+                                    try {
+                                        if (syncAlgo.isTraceSynced(traceel.getName())) {
+
+                                            /* Find the original trace */
+                                            TmfTraceElement origtrace = null;
+                                            for (ITmfProjectModelElement el : traceel.getProject().getTracesFolder().getTraces()) {
+                                                if (el.getName().equals(traceel.getName())) {
+                                                    origtrace = (TmfTraceElement) el;
+                                                }
+                                            }
+
+                                            if (origtrace != null) {
+                                                /*
+                                                 * Make sure a trace with the
+                                                 * new name does not exist
+                                                 */
+                                                String newname = traceel.getName();
+                                                boolean traceexists;
+                                                do {
+                                                    traceexists = false;
+                                                    newname += "_"; //$NON-NLS-1$
+                                                    for (ITmfProjectModelElement el : traceel.getProject().getTracesFolder().getTraces()) {
+                                                        if (el.getName().equals(newname)) {
+                                                            traceexists = true;
+                                                        }
+                                                    }
+                                                } while (traceexists);
+
+                                                /* Copy the original trace */
+                                                TmfTraceElement newtrace = origtrace.copy(newname);
+
+                                                if (newtrace != null) {
+
+                                                    syncAlgo.renameTrace(origtrace.getName(), newtrace.getName());
+
+                                                    /*
+                                                     * Instantiate the new trace
+                                                     * and set its sync formula
+                                                     */
+                                                    ITmfTrace trace = newtrace.instantiateTrace();
+                                                    ITmfEvent traceEvent = newtrace.instantiateEvent();
+
+                                                    trace.initTrace(newtrace.getResource(), newtrace.getLocation().getPath(), traceEvent.getClass());
+                                                    trace.setTimestampTransform(syncAlgo.getTimestampTransform(trace));
+
+                                                    /*
+                                                     * Add the new trace to the
+                                                     * experiment
+                                                     */
+                                                    exp.addTrace(newtrace);
+
+                                                    /*
+                                                     * Delete the original trace
+                                                     * element
+                                                     */
+                                                    exp.removeTrace(traceel);
+                                                } else {
+                                                    TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title, Messages.SynchronizeTracesHandler_Error + CR + CR + String.format(Messages.SynchronizeTracesHandler_CopyProblem, origtrace.getName()));
+                                                }
+                                            }
+                                        }
+                                    } catch (CoreException e) {
+                                        Activator.getDefault().logError(String.format(Messages.SynchronizeTracesHandler_ErrorSynchingForTrace, exp.getName(), traceel.getName()), e);
+                                        TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title, Messages.SynchronizeTracesHandler_Error + CR + CR + e.getMessage());
+                                    } catch (TmfTraceException e) {
+                                        Activator.getDefault().logError(String.format(Messages.SynchronizeTracesHandler_ErrorSynchingForTrace, exp.getName(), traceel.getName()), e);
+                                        TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title, Messages.SynchronizeTracesHandler_Error + CR + CR + e.getMessage());
+                                    }
+                                }
+                            }
+                        });
+
+                    } catch (TmfTraceException e) {
+                        Activator.getDefault().logError(String.format(Messages.SynchronizeTracesHandler_ErrorSynchingExperiment, exp.getName()), e);
+                        TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title, Messages.SynchronizeTracesHandler_Error + CR + CR + e.getMessage());
+                    }
+                }
+            };
+            thread.start();
+
+        } else {
+            TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title, Messages.SynchronizeTracesHandler_WrongTraceNumber);
+        }
+
+        return null;
+    }
+
+}
index 4d321ac25bb4514d5fc6fb5efccc40c44108723f..ba2d8e31cef6cf657dc143efffe506affb39ecc7 100644 (file)
@@ -27,3 +27,14 @@ SelectTraceTypeHandler_InvalidTraceType =  Type could not be set for one or more
 # Drag and drop
 DropAdapterAssistant_RenameTraceTitle=Confirm rename trace
 DropAdapterAssistant_RenameTraceMessage=A trace with the name ''{0}'' already exists in the target project.\nRename the dropped trace?
+
+# Trace synchronization
+SynchronizeTracesHandler_InitError=Error initializing trace
+SynchronizeTracesHandler_CopyProblem=Couldn't copy the original trace %s
+SynchronizeTracesHandler_WrongTraceNumber=Experiment must have more than one trace
+SynchronizeTracesHandler_Title=Synchronize traces
+SynchronizeTracesHandler_WrongType=Trace is not a kernel trace:\n
+SynchronizeTracesHandler_Error=Error synchronizing experiment
+
+SynchronizeTracesHandler_ErrorSynchingExperiment=Error synchronizing experiment %s
+SynchronizeTracesHandler_ErrorSynchingForTrace=Error synchronizing experiment %s for trace %s
index a2ca20ee55fed39bc05cc788506c30bf73d4146a..8fdf44538af8a0c6a9550b2b1eeb68f73f9bc635 100644 (file)
@@ -29,7 +29,7 @@ import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
  * Base class for project elements who will have folder elements
  * under them to store supplementary files.
  *
- * @author gbastien
+ * @author Geneviève Bastien
  * @since 2.0
  */
 public abstract class TmfWithFolderElement extends TmfProjectModelElement {
@@ -239,7 +239,7 @@ public abstract class TmfWithFolderElement extends TmfProjectModelElement {
                     if (TmfTrace.class.getCanonicalName().equals(member.getPersistentProperty(TmfCommonConstants.TRACETYPE))) {
                         member.delete(true, null);
                     }
-                    if (TmfExperiment.class.getCanonicalName().equals(member.getPersistentProperty(TmfCommonConstants.TRACETYPE))) {
+                    else if (TmfExperiment.class.getCanonicalName().equals(member.getPersistentProperty(TmfCommonConstants.TRACETYPE))) {
                         member.delete(true, null);
                     }
                 }
index 7bf16889b984122a699fef12646acc892c07f952..9135b4669fd7ce94ba8fe9a27395d633fda635a2 100644 (file)
@@ -241,7 +241,8 @@ public class TmfEventsCache {
             int requestIndex;
 
             DataRequest(Class<? extends ITmfEvent> dataType, ITmfFilter reqFilter, int start, int nbRequested) {
-                super(dataType, start, nbRequested);
+                super(dataType, start, nbRequested,
+                        TmfDataRequest.ExecutionType.FOREGROUND);
                 requestFilter = reqFilter;
                 requestRank = start;
                 requestIndex = index;
@@ -331,7 +332,10 @@ public class TmfEventsCache {
                     }
                 }
 
-                TmfDataRequest request = new TmfDataRequest(ITmfEvent.class, startIndex, nbRequested) {
+                TmfDataRequest request = new TmfDataRequest(ITmfEvent.class,
+                        startIndex,
+                        nbRequested,
+                        TmfDataRequest.ExecutionType.FOREGROUND) {
                     private int count = 0;
                     private long rank = startIndex;
                     @Override
index 93f59158dc33b72e6be0216850df8e4a3a4f9807..357b9c166198d4da582138c368c05decb6ea0c5a 100644 (file)
@@ -90,8 +90,8 @@ 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.linuxtools.tmf.core.trace.location.ITmfLocation;
 import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsCache.CachedEvent;
 import org.eclipse.linuxtools.tmf.ui.views.colors.ColorSetting;
 import org.eclipse.linuxtools.tmf.ui.views.colors.ColorSettingsManager;
@@ -1423,7 +1423,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
                 return;
             }
             request = new TmfDataRequest(ITmfEvent.class, (int) fFilterCheckCount,
-                    nbRequested, fTrace.getCacheSize(), ExecutionType.BACKGROUND) {
+                    nbRequested, ExecutionType.BACKGROUND) {
                 @Override
                 public void handleData(final ITmfEvent event) {
                     super.handleData(event);
@@ -1661,7 +1661,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
                 if (direction == Direction.BACKWARD) {
                     rank = Math.max(0, rank - fTrace.getCacheSize() + 1);
                 }
-                request = new TmfDataRequest(ITmfEvent.class, (int) rank, nbRequested, fTrace.getCacheSize(), ExecutionType.BACKGROUND) {
+                request = new TmfDataRequest(ITmfEvent.class, (int) rank, nbRequested, ExecutionType.BACKGROUND) {
                     long currentRank = rank;
 
                     @Override
@@ -2203,7 +2203,8 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
             // Create a request for one event that will be queued after other ongoing requests. When this request is completed
             // do the work to select the actual event with the timestamp specified in the signal. This procedure prevents
             // the method fTrace.getRank() from interfering and delaying ongoing requests.
-            final TmfDataRequest subRequest = new TmfDataRequest(ITmfEvent.class, 0, 1, ExecutionType.FOREGROUND) {
+            final TmfDataRequest subRequest = new TmfDataRequest(ITmfEvent.class,
+                    0, 1, ExecutionType.FOREGROUND) {
 
                 TmfTimestamp ts = new TmfTimestamp(signal.getBeginTime());
 
diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/environment/TmfEnvironmentView.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/environment/TmfEnvironmentView.java
deleted file mode 100644 (file)
index 0a190bc..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 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:
- *   Matthew Khouzam - Initial API and implementation
- *   Bernd Hufmann - Updated to use Tree with columns to be able to group traces
- *   Alexandre Montplaisir - Display info for any ITmfTraceProperties trace
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.ui.views.environment;
-
-import java.util.Map;
-
-import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceProperties;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
-import org.eclipse.linuxtools.tmf.ui.views.TmfView;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * Displays the trace's properties.
- *
- * @version 1.1
- * @author Matthew Khouzam
- */
-public class TmfEnvironmentView extends TmfView {
-
-    /** The Environment View's ID */
-    public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.environment"; //$NON-NLS-1$
-
-    private ITmfTrace fTrace;
-    private Tree fTree;
-
-    /**
-     * Default constructor
-     */
-    public TmfEnvironmentView() {
-        super("EnvironmentVariables"); //$NON-NLS-1$
-//        fTitlePrefix = getTitle();
-    }
-
-    // ------------------------------------------------------------------------
-    // ViewPart
-    // ------------------------------------------------------------------------
-
-    @Override
-    public void createPartControl(Composite parent) {
-        fTree = new Tree(parent, SWT.NONE);
-        TreeColumn nameCol = new TreeColumn(fTree, SWT.NONE, 0);
-        TreeColumn valueCol = new TreeColumn(fTree, SWT.NONE, 1);
-        nameCol.setText("Environment Variable"); //$NON-NLS-1$
-        valueCol.setText("Value"); //$NON-NLS-1$
-
-        fTree.setItemCount(0);
-
-        fTree.setHeaderVisible(true);
-        nameCol.pack();
-        valueCol.pack();
-
-        ITmfTrace trace = getActiveTrace();
-        if (trace != null) {
-            traceSelected(new TmfTraceSelectedSignal(this, trace));
-        }
-    }
-
-    private void updateTable() {
-        fTree.setItemCount(0);
-        if (fTrace == null) {
-            return;
-        }
-
-        for (ITmfTrace trace : TmfTraceManager.getTraceSet(fTrace)) {
-            if (trace instanceof ITmfTraceProperties) {
-                TreeItem item = new TreeItem(fTree, SWT.NONE);
-                item.setText(0, trace.getName());
-
-                ITmfTraceProperties propTrace = (ITmfTraceProperties) trace;
-                Map <String, String> properties = propTrace.getTraceProperties();
-                for (Map.Entry<String, String> entry : properties.entrySet()) {
-                    TreeItem subItem = new TreeItem(item, SWT.NONE);
-                    subItem.setText(0, entry.getKey()); // Variable name
-                    subItem.setText(1, entry.getValue()); // Variable value
-                }
-            }
-        }
-
-        // Expand the tree items
-        for (int i = 0; i < fTree.getItemCount(); i++) {
-            fTree.getItem(i).setExpanded(true);
-        }
-
-        for (TreeColumn column : fTree.getColumns()) {
-            column.pack();
-        }
-    }
-
-    @Override
-    public void setFocus() {
-        fTree.setFocus();
-    }
-
-    /**
-     * Handler for the trace opened signal.
-     * @param signal
-     *            The incoming signal
-     * @since 2.0
-     */
-    @TmfSignalHandler
-    public void traceOpened(TmfTraceOpenedSignal signal) {
-        fTrace = signal.getTrace();
-        updateTable();
-    }
-
-
-    /**
-     * Handler for the trace selected signal.
-     *
-     * @param signal
-     *            The incoming signal
-     * @since 2.0
-     */
-    @TmfSignalHandler
-    public void traceSelected(TmfTraceSelectedSignal signal) {
-        // Update the trace reference
-        ITmfTrace trace = signal.getTrace();
-        if (!trace.equals(fTrace)) {
-            fTrace = trace;
-            updateTable();
-        }
-    }
-
-    /**
-     * Handler for the trace closed signal.
-     *
-     * @param signal the incoming signal
-     * @since 2.0
-     */
-    @TmfSignalHandler
-    public void traceClosed(TmfTraceClosedSignal signal) {
-        if (signal.getTrace() == fTrace) {
-            fTrace = null;
-            fTree.setItemCount(0);
-        }
-    }
-
-}
-
index 7df67cb160b1b9c5e77a758b00e67392e65f03aa..f9af599affea34dc9c1d3119f0b48735dac9d29a 100644 (file)
@@ -20,7 +20,6 @@ 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;
 
 /**
  * Class to request events for given time range from a trace to fill a HistogramDataModel and HistogramView.
@@ -65,9 +64,7 @@ public class HistogramRequest extends TmfEventRequest {
     public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range,
             int rank, int nbEvents, int blockSize,
             ITmfDataRequest.ExecutionType execType) {
-        super(ITmfEvent.class, range, rank, nbEvents,
-                (blockSize > 0) ? blockSize : ITmfTrace.DEFAULT_TRACE_CACHE_SIZE,
-                execType);
+        super(ITmfEvent.class, range, rank, nbEvents, execType);
         fHistogram = histogram;
     }
 
diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/Messages.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/Messages.java
new file mode 100644 (file)
index 0000000..41351a0
--- /dev/null
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ui.views.synchronization;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Message file for the synchronization view
+ * @since 3.0
+ */
+@SuppressWarnings("javadoc")
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.views.synchronization.messages"; //$NON-NLS-1$
+    public static String TmfSynchronizationView_NameColumn;
+    public static String TmfSynchronizationView_ValueColumn;
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/TmfSynchronizationView.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/TmfSynchronizationView.java
new file mode 100644 (file)
index 0000000..ce06df9
--- /dev/null
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ui.views.synchronization;
+
+import java.util.Map;
+
+import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSynchronizedSignal;
+import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationAlgorithm;
+import org.eclipse.linuxtools.tmf.ui.views.TmfView;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * Small view to display statistics about a synchronization
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public class TmfSynchronizationView extends TmfView {
+
+    /**
+     * The ID corresponds to the package in which this class is embedded.
+     */
+    public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.synchronization"; //$NON-NLS-1$
+
+    /**
+     * The view name.
+     */
+    public static final String TMF_SYNCHRONIZATION_VIEW = "SynchronizationView"; //$NON-NLS-1$
+
+    /**
+     * The synchronization algorithm to display stats for
+     */
+    private SynchronizationAlgorithm fAlgoSync;
+
+    private Tree fTree;
+
+    /**
+     * Default constructor
+     */
+    public TmfSynchronizationView() {
+        super(TMF_SYNCHRONIZATION_VIEW);
+    }
+
+    @Override
+    public void createPartControl(Composite parent) {
+        fTree = new Tree(parent, SWT.NONE);
+        TreeColumn nameCol = new TreeColumn(fTree, SWT.NONE, 0);
+        TreeColumn valueCol = new TreeColumn(fTree, SWT.NONE, 1);
+        nameCol.setText(Messages.TmfSynchronizationView_NameColumn);
+        valueCol.setText(Messages.TmfSynchronizationView_ValueColumn);
+
+        fTree.setItemCount(0);
+
+        fTree.setHeaderVisible(true);
+        nameCol.pack();
+        valueCol.pack();
+
+    }
+
+    private void updateTable() {
+        fTree.setItemCount(0);
+        if (fAlgoSync == null) {
+            return;
+        }
+
+        for (Map.Entry<String, Map<String, Object>> entry : fAlgoSync.getStats().entrySet()) {
+            TreeItem item = new TreeItem(fTree, SWT.NONE);
+            item.setText(0, entry.getKey().toString());
+            item.setText(1, entry.getValue().toString());
+
+            for (Map.Entry<String, Object> subentry : entry.getValue().entrySet()) {
+                TreeItem subitem = new TreeItem(item, SWT.NONE);
+                subitem.setText(0, subentry.getKey().toString());
+                subitem.setText(1, subentry.getValue().toString());
+            }
+        }
+
+        /* Expand the tree items */
+        for (int i = 0; i < fTree.getItemCount(); i++) {
+            fTree.getItem(i).setExpanded(true);
+        }
+
+        for (TreeColumn column : fTree.getColumns()) {
+            column.pack();
+        }
+    }
+
+    @Override
+    public void setFocus() {
+        fTree.setFocus();
+    }
+
+    /**
+     * Handler called when traces are synchronized
+     *
+     * @param signal
+     *            Contains the information about the selection.
+     */
+    @TmfSignalHandler
+    public void traceSynchronized(TmfTraceSynchronizedSignal signal) {
+        if (signal.getSyncAlgo() != fAlgoSync) {
+            fAlgoSync = signal.getSyncAlgo();
+            Display.getDefault().asyncExec(new Runnable() {
+                @Override
+                public void run() {
+                    updateTable();
+                }
+            });
+        }
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/messages.properties b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/messages.properties
new file mode 100644 (file)
index 0000000..9f44658
--- /dev/null
@@ -0,0 +1,2 @@
+TmfSynchronizationView_NameColumn=Synchronization Information
+TmfSynchronizationView_ValueColumn=Value
index 4b3c4872540902a74de88c808d5c8a107ca146ba..633287c32c18b69590f0aa28914e1a9a430dcfa3 100644 (file)
@@ -106,14 +106,12 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
     // ------------------------------------------------------------------------
     // Constants
     // ------------------------------------------------------------------------
+
     /**
      * Default title name.
      */
     protected static final String TITLE = Messages.TmfUml2SDSyncLoader_ViewName;
-    /**
-     * Default block size for background request.
-     */
-    protected static final int DEFAULT_BLOCK_SIZE = 50000;
+
     /**
      * Maximum number of messages per page.
      */
@@ -314,7 +312,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
 
             TmfTimeRange window = TmfTimeRange.ETERNITY;
 
-            fIndexRequest = new TmfEventRequest(ITmfEvent.class, window, TmfDataRequest.ALL_DATA, DEFAULT_BLOCK_SIZE, ITmfDataRequest.ExecutionType.BACKGROUND) {
+            fIndexRequest = new TmfEventRequest(ITmfEvent.class, window, 0, TmfDataRequest.ALL_DATA, ITmfDataRequest.ExecutionType.BACKGROUND) {
 
                 private ITmfTimestamp fFirstTime = null;
                 private ITmfTimestamp fLastTime = null;
@@ -1077,7 +1075,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
             window = TmfTimeRange.ETERNITY;
         }
 
-        fPageRequest = new TmfEventRequest(ITmfEvent.class, window, TmfDataRequest.ALL_DATA, 1, ITmfDataRequest.ExecutionType.FOREGROUND) {
+        fPageRequest = new TmfEventRequest(ITmfEvent.class, window, 0, TmfDataRequest.ALL_DATA, ITmfDataRequest.ExecutionType.FOREGROUND) {
             private final List<ITmfSyncSequenceDiagramEvent> fSdEvent = new ArrayList<ITmfSyncSequenceDiagramEvent>();
 
             @Override
@@ -1248,7 +1246,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
          */
         public SearchJob(Criteria findCriteria, TmfTimeRange window) {
             super(Messages.TmfUml2SDSyncLoader_SearchJobDescrition);
-            fSearchRequest = new SearchEventRequest(window, TmfDataRequest.ALL_DATA, 1, ITmfDataRequest.ExecutionType.FOREGROUND, findCriteria);
+            fSearchRequest = new SearchEventRequest(window, TmfDataRequest.ALL_DATA, ITmfDataRequest.ExecutionType.FOREGROUND, findCriteria);
         }
 
         @Override
@@ -1341,25 +1339,23 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
          * Constructor
          * @param range @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#TmfEventRequest(...)
          * @param nbRequested @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#handleData(...)
-         * @param blockSize @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#handleData(...)
          * @param execType @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#handleData(...)
          * @param criteria The search criteria
          */
-        public SearchEventRequest(TmfTimeRange range, int nbRequested, int blockSize, ExecutionType execType, Criteria criteria) {
-            this(range, nbRequested, blockSize, execType, criteria, null);
+        public SearchEventRequest(TmfTimeRange range, int nbRequested, ExecutionType execType, Criteria criteria) {
+            this(range, nbRequested, execType, criteria, null);
         }
 
         /**
          * Constructor
          * @param range @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#TmfEventRequest(...)
          * @param nbRequested @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#TmfEventRequest(...)
-         * @param blockSize @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#TmfEventRequest(...)
          * @param execType @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#TmfEventRequest(...)
          * @param criteria The search criteria
          * @param monitor progress monitor
          */
-        public SearchEventRequest(TmfTimeRange range, int nbRequested, int blockSize, ExecutionType execType, Criteria criteria, IProgressMonitor monitor) {
-            super(ITmfEvent.class, range, nbRequested, blockSize, execType);
+        public SearchEventRequest(TmfTimeRange range, int nbRequested, ExecutionType execType, Criteria criteria, IProgressMonitor monitor) {
+            super(ITmfEvent.class, range, 0, nbRequested, execType);
             fCriteria = new Criteria(criteria);
             fMonitor = monitor;
         }
index 2570033c2ae9da660971044a97448d8a54ccff0c..84960c55c5d5dc469f1e7a7f63dbf6b595f134f6 100644 (file)
@@ -17,8 +17,8 @@ import java.util.List;
 
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 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.trace.location.ITmfLocation;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CaretEvent;
 import org.eclipse.swt.custom.CaretListener;
index a2a1906c927521e59be038e837c6c579ca693878..65558d484de32021dc10ecf308dd7f27d46333ef 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="org.eclipse.linuxtools.tmf"
       label="%featureName"
-      version="2.1.0.qualifier"
+      version="3.0.0.qualifier"
       provider-name="%featureProvider"
       license-feature="org.eclipse.linuxtools.license.feature"
       license-feature-version="1.0.0.qualifier">
          name="Common Trace Format (CTF)"/>
 
    <requires>
-      <import plugin="org.eclipse.linuxtools.ctf.core" version="2.1.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.ctf.core" version="3.0.0" match="greaterOrEqual"/>
       <import plugin="org.eclipse.core.runtime"/>
       <import plugin="org.eclipse.core.resources"/>
       <import plugin="org.eclipse.ui.views"/>
       <import plugin="org.eclipse.core.expressions"/>
-      <import plugin="org.eclipse.linuxtools.tmf.core" version="2.1.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.tmf.core" version="3.0.0" match="greaterOrEqual"/>
       <import plugin="org.eclipse.ui"/>
       <import plugin="org.eclipse.ui.ide"/>
       <import plugin="org.eclipse.ui.navigator"/>
index ee62b58825a3a89795a4ca946101b1482777dc55..11837536608696c26cc6efaec23ba0f9106b46a8 100644 (file)
   <parent>
     <artifactId>linuxtools-lttng-parent</artifactId>
     <groupId>org.eclipse.linuxtools.lttng</groupId>
-    <version>2.1.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>org.eclipse.linuxtools.tmf</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>eclipse-feature</packaging>
 
   <name>Linux Tools TMF (Tracing and Monitoring Framework) Feature</name>
index acc3abd47c8283324b243b4048e84f621851bcb4..8c5e9081aad565b52e02d6e6da4fece8d5bd3400 100644 (file)
@@ -90,8 +90,8 @@ eclipse.preferences.version=1
 incompatible_api_component_version=Error
 incompatible_api_component_version_include_major_without_breaking_change=Disabled
 incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
+invalid_since_tag_version=Ignore
 malformed_since_tag=Error
-missing_since_tag=Error
+missing_since_tag=Ignore
 report_api_breakage_when_major_version_incremented=Disabled
 report_resolution_errors_api_component=Warning
diff --git a/pom.xml b/pom.xml
index 1b6418b1db501ddda1c0eee7acbea9fd0bf3a23b..e18e43ca4abaf6da24edd82440855167d1e75586 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
 
   <groupId>org.eclipse.linuxtools.lttng</groupId>
   <artifactId>linuxtools-lttng-parent</artifactId>
-  <version>2.1.0-SNAPSHOT</version>
+  <version>3.0.0-SNAPSHOT</version>
   <packaging>pom</packaging>
 
   <name>Eclipse Linux Tools LTTng Parent</name>
This page took 0.263139 seconds and 5 git commands to generate.