public synchronized CtfTmfTrace getTrace() {
CtfTmfTraceStub trace = fTrace;
if (trace != null) {
- trace.close();
+ trace.dispose();
}
trace = new CtfTmfTraceStub();
try {
@Before
public void setUp() {
assumeTrue(testTrace.exists());
- try (CtfTmfTrace trace = testTrace.getTrace();
- CtfIterator tr = (CtfIterator) trace.createIterator();) {
+ CtfTmfTrace trace = testTrace.getTrace();
+ try (CtfIterator tr = (CtfIterator) trace.createIterator();) {
tr.advance();
fixture = tr.getCurrentEvent();
nullEvent = CtfTmfEventFactory.getNullEvent(trace);
}
+ trace.dispose();
}
/**
@Test
public void testGetters() {
long rank = fixture.getRank();
- try (CtfTmfTrace trace = fixture.getTrace();) {
- assertEquals("kernel", trace.getName());
- }
+ CtfTmfTrace trace = fixture.getTrace();
+ assertEquals("kernel", trace.getName());
+
String reference = fixture.getChannel();
int cpu = fixture.getCPU();
ITmfEventType type = fixture.getType();
public void testNbEventsBug475007() {
final CtfTmfTestTrace tmfTestTrace = CtfTmfTestTrace.DYNSCOPE;
assumeTrue(tmfTestTrace.exists());
- try (CtfTmfTrace trace = tmfTestTrace.getTrace()) {
- trace.indexTrace(true);
-
- final long expectedReal = 100003;
- final long expectedLost = 1;
-
- EventCountRequest req = new EventCountRequest();
- trace.sendRequest(req);
- try {
- req.waitForCompletion();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ CtfTmfTrace trace = tmfTestTrace.getTrace();
+ trace.indexTrace(true);
+
+ final long expectedReal = 100003;
+ final long expectedLost = 1;
- assertEquals(expectedReal, req.getReal());
- assertEquals(expectedLost, req.getLost());
+ EventCountRequest req = new EventCountRequest();
+ trace.sendRequest(req);
+ try {
+ req.waitForCompletion();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
}
+
+ assertEquals(expectedReal, req.getReal());
+ assertEquals(expectedLost, req.getLost());
+
+ trace.dispose();
}
/**
*/
@Test
public void testGetCtfTmfTrace() {
- try (CtfTmfTrace result = iterator.getCtfTmfTrace();) {
- assertNotNull(result);
- }
+ CtfTmfTrace result = iterator.getCtfTmfTrace();
+ assertNotNull(result);
}
/**
long start, stop;
for (int loops = 0; loops < NUM_LOOPS; loops++) {
nbEvent = 0L;
- try (CtfTmfTrace trace = new CtfTmfTrace();) {
- try {
- trace.initTrace(null, TRACE_PATH, CtfTmfEvent.class);
- } catch (final TmfTraceException e) {
- loops = NUM_LOOPS + 1;
- break;
- }
+ CtfTmfTrace trace = new CtfTmfTrace();
+ try {
+ trace.initTrace(null, TRACE_PATH, CtfTmfEvent.class);
+ } catch (final TmfTraceException e) {
+ loops = NUM_LOOPS + 1;
+ break;
+ }
- start = System.nanoTime();
- if (nbEvent != -1) {
- final CtfTmfContext traceReader = (CtfTmfContext) trace.seekEvent(0);
+ start = System.nanoTime();
+ if (nbEvent != -1) {
+ final CtfTmfContext traceReader = (CtfTmfContext) trace.seekEvent(0);
- start = System.nanoTime();
- CtfTmfEvent current = traceReader.getCurrentEvent();
- while (current != null) {
- nbEvent++;
- if (USE_TEXT) {
+ start = System.nanoTime();
+ CtfTmfEvent current = traceReader.getCurrentEvent();
+ while (current != null) {
+ nbEvent++;
+ if (USE_TEXT) {
- System.out.println("Event " + nbEvent + " Time "
- + current.getTimestamp().toString() + " type " + current.getType().getName()
- + " on CPU " + current.getCPU() + " " + current.getContent().toString());
- }
- // advance the trace to the next event.
- boolean hasMore = traceReader.advance();
- if (hasMore) {
- // you can know the trace has more events.
- }
- current = traceReader.getCurrentEvent();
+ System.out.println("Event " + nbEvent + " Time "
+ + current.getTimestamp().toString() + " type " + current.getType().getName()
+ + " on CPU " + current.getCPU() + " " + current.getContent().toString());
}
+ // advance the trace to the next event.
+ boolean hasMore = traceReader.advance();
+ if (hasMore) {
+ // you can know the trace has more events.
+ }
+ current = traceReader.getCurrentEvent();
}
- stop = System.nanoTime();
- System.out.print('.');
- final double time = (stop - start) / (double) nbEvent;
- benchs.add(time);
- } // trace.close()
+ }
+ stop = System.nanoTime();
+ System.out.print('.');
+ final double time = (stop - start) / (double) nbEvent;
+ benchs.add(time);
+
+ trace.dispose();
}
System.out.println("");
double avg = 0;
*/
@Test
public void testCtfTmfTrace() {
- try (CtfTmfTrace result = new CtfTmfTrace();) {
- assertNotNull(result);
- assertEquals(1000, result.getCacheSize());
- assertEquals(0L, result.getNbEvents());
- assertEquals(0L, result.getStreamingInterval());
- assertNull(result.getResource());
- assertNull(result.getType());
- }
+ CtfTmfTrace result = new CtfTmfTrace();
+
+ assertNotNull(result);
+ assertEquals(1000, result.getCacheSize());
+ assertEquals(0L, result.getNbEvents());
+ assertEquals(0L, result.getStreamingInterval());
+ assertNull(result.getResource());
+ assertNull(result.getType());
+
+ result.dispose();
}
/**
* Run the void dispose() method test.
*/
@Test
- public void testClose() {
- try (CtfTmfTrace emptyFixture = new CtfTmfTrace();) {
- }
+ public void testDispose() {
+ CtfTmfTrace emptyFixture = new CtfTmfTrace();
+ emptyFixture.dispose();
}
/**
*/
@Test
public void testGetCacheSize() {
- try (CtfTmfTrace emptyFixture = new CtfTmfTrace();) {
- int result = emptyFixture.getCacheSize();
- assertEquals(1000, result);
- }
+ CtfTmfTrace emptyFixture = new CtfTmfTrace();
+ int result = emptyFixture.getCacheSize();
+ assertEquals(1000, result);
+
+ emptyFixture.dispose();
}
/**
*/
@Test
public void testValidate() {
- try (CtfTmfTrace trace = new CtfTmfTrace();) {
- IStatus status = trace.validate(null, fTrace);
- assertEquals(toString(), fServerity, status.getSeverity());
+ CtfTmfTrace trace = new CtfTmfTrace();
+ IStatus status = trace.validate(null, fTrace);
+ assertEquals(toString(), fServerity, status.getSeverity());
- if (fHasException) {
- assertNotNull(toString(), status.getException());
- }
- switch (status.getSeverity()) {
- case IStatus.OK: {
- assertTrue(status instanceof CtfTraceValidationStatus);
- CtfTraceValidationStatus ctfStatus = (CtfTraceValidationStatus) status;
- assertEquals(toString(), fConfidence, ctfStatus.getConfidence());
- assertNotNull(ctfStatus.getEnvironment());
- break;
- }
- case IStatus.WARNING: {
- assertTrue(status instanceof TraceValidationStatus);
- TraceValidationStatus ctfStatus = (TraceValidationStatus) status;
- assertEquals(fConfidence, ctfStatus.getConfidence());
- break;
- }
- case IStatus.ERROR: {
- // nothing else to check here
- break;
- }
- default:
- // no other severity should be returned
- fail();
- break;
- }
- assertEquals(fServerity, status.getSeverity());
+ if (fHasException) {
+ assertNotNull(toString(), status.getException());
}
+ switch (status.getSeverity()) {
+ case IStatus.OK: {
+ assertTrue(status instanceof CtfTraceValidationStatus);
+ CtfTraceValidationStatus ctfStatus = (CtfTraceValidationStatus) status;
+ assertEquals(toString(), fConfidence, ctfStatus.getConfidence());
+ assertNotNull(ctfStatus.getEnvironment());
+ break;
+ }
+ case IStatus.WARNING: {
+ assertTrue(status instanceof TraceValidationStatus);
+ TraceValidationStatus ctfStatus = (TraceValidationStatus) status;
+ assertEquals(fConfidence, ctfStatus.getConfidence());
+ break;
+ }
+ case IStatus.ERROR: {
+ // nothing else to check here
+ break;
+ }
+ default:
+ // no other severity should be returned
+ fail();
+ break;
+ }
+ assertEquals(fServerity, status.getSeverity());
+ trace.dispose();
}
}
*/
public class CtfTmfTrace extends TmfTrace
implements ITmfTraceProperties, ITmfPersistentlyIndexable,
- ITmfTraceWithPreDefinedEvents, AutoCloseable {
+ ITmfTraceWithPreDefinedEvents {
// -------------------------------------------
// Constants
}
}
- @Override
- public void close() {
- dispose();
- }
-
@Override
public synchronized void dispose() {
fIteratorManager.dispose();
/**
* Gets an event at a given rank
+ *
* @param rank
* a rank
* @return the event at given rank
*/
protected CtfTmfEvent getEvent(int rank) {
- try (CtfTmfTrace trace = fTrace.getTrace()) {
- ITmfContext ctx = trace.seekEvent(0);
- for (int i = 0; i < rank; i++) {
- trace.getNext(ctx);
- }
- return trace.getNext(ctx);
+ CtfTmfTrace trace = fTrace.getTrace();
+ ITmfContext ctx = trace.seekEvent(0);
+ for (int i = 0; i < rank; i++) {
+ trace.getNext(ctx);
}
+ CtfTmfEvent ret = trace.getNext(ctx);
+ trace.dispose();
+ return ret;
}
/**
}
for (int i = 0; i < LOOP_COUNT; i++) {
+ LttngKernelTrace trace = null;
IAnalysisModule module = null;
- try (LttngKernelTrace trace = new LttngKernelTrace()) {
+ try {
+ trace = new LttngKernelTrace();
module = new KernelAnalysisModule();
module.setId("test");
trace.initTrace(null, testTrace.getPath(), CtfTmfEvent.class);
if (module != null) {
module.dispose();
}
+ if (trace != null) {
+ trace.dispose();
+ }
}
}
pm.commit();
}
for (int i = 0; i < LOOP_COUNT; i++) {
+ LttngKernelTrace trace = null;
TmfStatisticsModule module = null;
- try (LttngKernelTrace trace = new LttngKernelTrace()) {
+ try {
+ trace = new LttngKernelTrace();
module = new TmfStatisticsModule();
module.setId("test");
trace.initTrace(null, testTrace.getPath(), CtfTmfEvent.class);
if (module != null) {
module.dispose();
}
+ if (trace != null) {
+ trace.dispose();
+ }
}
}
pm.commit();
public void testSmallTraces() {
assumeTrue(CtfTmfTestTrace.SYNC_SRC.exists());
assumeTrue(CtfTmfTestTrace.SYNC_DEST.exists());
- try (CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace();
- CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();) {
- Set<ITmfTrace> traces = ImmutableSet.of((ITmfTrace) trace1, trace2);
- runCpuTest(traces, "Match TCP events", 100);
- }
+
+ CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace();
+ CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();
+
+ Set<ITmfTrace> traces = ImmutableSet.of((ITmfTrace) trace1, trace2);
+ runCpuTest(traces, "Match TCP events", 100);
+
+ trace1.dispose();
+ trace2.dispose();
+
}
/**
assumeTrue(CtfTmfTestTrace.DJANGO_CLIENT.exists());
assumeTrue(CtfTmfTestTrace.DJANGO_DB.exists());
assumeTrue(CtfTmfTestTrace.DJANGO_HTTPD.exists());
- try (CtfTmfTrace trace1 = CtfTmfTestTrace.DJANGO_CLIENT.getTrace();
- CtfTmfTrace trace2 = CtfTmfTestTrace.DJANGO_DB.getTrace();
- CtfTmfTrace trace3 = CtfTmfTestTrace.DJANGO_HTTPD.getTrace();) {
- Set<ITmfTrace> traces = ImmutableSet.of((ITmfTrace) trace1, trace2, trace3);
- runCpuTest(traces, "Django traces", 10);
- runMemoryTest(traces, "Django traces", 10);
- }
+
+ CtfTmfTrace trace1 = CtfTmfTestTrace.DJANGO_CLIENT.getTrace();
+ CtfTmfTrace trace2 = CtfTmfTestTrace.DJANGO_DB.getTrace();
+ CtfTmfTrace trace3 = CtfTmfTestTrace.DJANGO_HTTPD.getTrace();
+
+ Set<ITmfTrace> traces = ImmutableSet.of((ITmfTrace) trace1, trace2, trace3);
+ runCpuTest(traces, "Django traces", 10);
+ runMemoryTest(traces, "Django traces", 10);
+
+ trace1.dispose();
+ trace2.dispose();
+ trace3.dispose();
}
private static void runCpuTest(Set<ITmfTrace> testTraces, String testName, int loop_count) {
public void testSmallTraces() {
assumeTrue(CtfTmfTestTrace.SYNC_SRC.exists());
assumeTrue(CtfTmfTestTrace.SYNC_DEST.exists());
- try (CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace();
- CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();) {
- ITmfTrace[] traces = { trace1, trace2 };
- TmfExperiment experiment = new TmfExperiment(CtfTmfEvent.class, "Test experiment", traces, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
- runCpuTest(experiment, "Match TCP events", 40);
- }
+ CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace();
+ CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();
+
+ ITmfTrace[] traces = { trace1, trace2 };
+ TmfExperiment experiment = new TmfExperiment(CtfTmfEvent.class, "Test experiment", traces, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
+ runCpuTest(experiment, "Match TCP events", 40);
+
+ trace1.dispose();
+ trace2.dispose();
}
/**
assumeTrue(CtfTmfTestTrace.DJANGO_CLIENT.exists());
assumeTrue(CtfTmfTestTrace.DJANGO_DB.exists());
assumeTrue(CtfTmfTestTrace.DJANGO_HTTPD.exists());
- try (CtfTmfTrace trace1 = CtfTmfTestTrace.DJANGO_CLIENT.getTrace();
- CtfTmfTrace trace2 = CtfTmfTestTrace.DJANGO_DB.getTrace();
- CtfTmfTrace trace3 = CtfTmfTestTrace.DJANGO_HTTPD.getTrace();) {
- ITmfTrace[] traces = { trace1, trace2, trace3 };
- TmfExperiment experiment = new TmfExperiment(CtfTmfEvent.class, "Test experiment", traces, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
- runCpuTest(experiment, "Django traces", 10);
- runMemoryTest(experiment, "Django traces", 10);
- }
+
+ CtfTmfTrace trace1 = CtfTmfTestTrace.DJANGO_CLIENT.getTrace();
+ CtfTmfTrace trace2 = CtfTmfTestTrace.DJANGO_DB.getTrace();
+ CtfTmfTrace trace3 = CtfTmfTestTrace.DJANGO_HTTPD.getTrace();
+
+ ITmfTrace[] traces = { trace1, trace2, trace3 };
+ TmfExperiment experiment = new TmfExperiment(CtfTmfEvent.class, "Test experiment", traces, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
+ runCpuTest(experiment, "Django traces", 10);
+ runMemoryTest(experiment, "Django traces", 10);
+
+ trace1.dispose();
+ trace2.dispose();
+ trace3.dispose();
}
private static void runCpuTest(TmfExperiment experiment, String testName, int loop_count) {
/* Test with a CTF trace that does not have required events */
assumeTrue(CtfTmfTestTrace.CYG_PROFILE.exists());
- try (CtfTmfTrace trace = CtfTmfTestTrace.CYG_PROFILE.getTrace();) {
- /*
- * TODO: This should be false, but for now there is no mandatory
- * events in the kernel analysis so it will return true.
- */
- assertTrue(fKernelAnalysisModule.canExecute(trace));
- }
+ CtfTmfTrace trace = CtfTmfTestTrace.CYG_PROFILE.getTrace();
+ /*
+ * TODO: This should be false, but for now there is no mandatory events
+ * in the kernel analysis so it will return true.
+ */
+ assertTrue(fKernelAnalysisModule.canExecute(trace));
+ trace.dispose();
}
/**
/* Prepare the files */
File logFile = File.createTempFile("TestValues", ".java");
- try (final CtfTmfTrace trace = testTrace.getTrace();
- PrintWriter writer = new PrintWriter(new FileWriter(logFile), true);) {
+ try (PrintWriter writer = new PrintWriter(new FileWriter(logFile), true);) {
/* Build and query the state system */
+ final CtfTmfTrace trace = testTrace.getTrace();
TmfStateSystemAnalysisModule module = new KernelAnalysisModule() {
@Override
protected String getSsFileName() {
writer.println();
module.dispose();
+ trace.dispose();
}
System.exit(0);
}
public void testExperimentSync() {
assumeTrue(CtfTmfTestTrace.SYNC_SRC.exists());
assumeTrue(CtfTmfTestTrace.SYNC_DEST.exists());
- try (CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace();
- CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();) {
+ CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace();
+ CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();
- ITmfTrace[] traces = { trace1, trace2 };
- TmfExperiment experiment = new TmfExperiment(traces[0].getEventType(), EXPERIMENT, traces, BLOCK_SIZE, null);
+ ITmfTrace[] traces = { trace1, trace2 };
+ TmfExperiment experiment = new TmfExperiment(traces[0].getEventType(), EXPERIMENT, traces, BLOCK_SIZE, null);
- SynchronizationAlgorithm syncAlgo = experiment.synchronizeTraces(true);
+ SynchronizationAlgorithm syncAlgo = experiment.synchronizeTraces(true);
- ITmfTimestampTransform tt1 = syncAlgo.getTimestampTransform(trace1);
- ITmfTimestampTransform tt2 = syncAlgo.getTimestampTransform(trace2);
+ ITmfTimestampTransform tt1 = syncAlgo.getTimestampTransform(trace1);
+ ITmfTimestampTransform tt2 = syncAlgo.getTimestampTransform(trace2);
- trace1.setTimestampTransform(tt1);
- trace2.setTimestampTransform(tt2);
+ trace1.setTimestampTransform(tt1);
+ trace2.setTimestampTransform(tt2);
- assertEquals("TmfTimestampTransformLinearFast [ slope = 0.9999413783703139011056845831168394, offset = 79796507913179.33347660124688298171 ]", tt1.toString());
- assertEquals(TimestampTransformFactory.getDefaultTransform(), tt2);
+ assertEquals("TmfTimestampTransformLinearFast [ slope = 0.9999413783703139011056845831168394, offset = 79796507913179.33347660124688298171 ]", tt1.toString());
+ assertEquals(TimestampTransformFactory.getDefaultTransform(), tt2);
- assertEquals(syncAlgo.getTimestampTransform(trace1.getHostId()), trace1.getTimestampTransform());
- assertEquals(syncAlgo.getTimestampTransform(trace2.getHostId()), trace2.getTimestampTransform());
+ assertEquals(syncAlgo.getTimestampTransform(trace1.getHostId()), trace1.getTimestampTransform());
+ assertEquals(syncAlgo.getTimestampTransform(trace2.getHostId()), trace2.getTimestampTransform());
- }
+ trace1.dispose();
+ trace2.dispose();
}
/**
assumeTrue(CtfTmfTestTrace.DJANGO_CLIENT.exists());
assumeTrue(CtfTmfTestTrace.DJANGO_DB.exists());
assumeTrue(CtfTmfTestTrace.DJANGO_HTTPD.exists());
- try (CtfTmfTrace trace1 = CtfTmfTestTrace.DJANGO_CLIENT.getTrace();
- CtfTmfTrace trace2 = CtfTmfTestTrace.DJANGO_DB.getTrace();
- CtfTmfTrace trace3 = CtfTmfTestTrace.DJANGO_HTTPD.getTrace();) {
- ITmfTrace[] traces = { trace1, trace2, trace3 };
- TmfExperiment experiment = new TmfExperiment(traces[0].getEventType(), EXPERIMENT, traces, BLOCK_SIZE, null);
- SynchronizationAlgorithm syncAlgo = experiment.synchronizeTraces(true);
+ CtfTmfTrace trace1 = CtfTmfTestTrace.DJANGO_CLIENT.getTrace();
+ CtfTmfTrace trace2 = CtfTmfTestTrace.DJANGO_DB.getTrace();
+ CtfTmfTrace trace3 = CtfTmfTestTrace.DJANGO_HTTPD.getTrace();
- ITmfTimestampTransform tt1 = syncAlgo.getTimestampTransform(trace1);
- ITmfTimestampTransform tt2 = syncAlgo.getTimestampTransform(trace2);
- ITmfTimestampTransform tt3 = syncAlgo.getTimestampTransform(trace3);
+ ITmfTrace[] traces = { trace1, trace2, trace3 };
+ TmfExperiment experiment = new TmfExperiment(traces[0].getEventType(), EXPERIMENT, traces, BLOCK_SIZE, null);
- trace1.setTimestampTransform(tt1);
- trace2.setTimestampTransform(tt2);
- trace3.setTimestampTransform(tt3);
+ SynchronizationAlgorithm syncAlgo = experiment.synchronizeTraces(true);
- assertEquals(TimestampTransformFactory.getDefaultTransform(), tt1);
- assertEquals("TmfTimestampTransformLinearFast [ slope = 0.9999996313017589597204633828681240, offset = 498490309972.0038068817738527724192 ]", tt2.toString());
- assertEquals("TmfTimestampTransformLinearFast [ slope = 1.000000119014882262265342419815932, offset = -166652893534.6189900382736187431134 ]", tt3.toString());
+ ITmfTimestampTransform tt1 = syncAlgo.getTimestampTransform(trace1);
+ ITmfTimestampTransform tt2 = syncAlgo.getTimestampTransform(trace2);
+ ITmfTimestampTransform tt3 = syncAlgo.getTimestampTransform(trace3);
- }
+ trace1.setTimestampTransform(tt1);
+ trace2.setTimestampTransform(tt2);
+ trace3.setTimestampTransform(tt3);
+
+ assertEquals(TimestampTransformFactory.getDefaultTransform(), tt1);
+ assertEquals("TmfTimestampTransformLinearFast [ slope = 0.9999996313017589597204633828681240, offset = 498490309972.0038068817738527724192 ]", tt2.toString());
+ assertEquals("TmfTimestampTransformLinearFast [ slope = 1.000000119014882262265342419815932, offset = -166652893534.6189900382736187431134 ]", tt3.toString());
+
+ trace1.dispose();
+ trace2.dispose();
+ trace3.dispose();
}
}
public void testMatching() {
assumeTrue(CtfTmfTestTrace.SYNC_SRC.exists());
assumeTrue(CtfTmfTestTrace.SYNC_DEST.exists());
- try (CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace();
- CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();) {
+ CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace();
+ CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();
- List<ITmfTrace> tracearr = new LinkedList<>();
- tracearr.add(trace1);
- tracearr.add(trace2);
+ List<ITmfTrace> tracearr = new LinkedList<>();
+ tracearr.add(trace1);
+ tracearr.add(trace2);
- TmfEventMatching.registerMatchObject(new TcpEventMatching());
- TmfEventMatching.registerMatchObject(new TcpLttngEventMatching());
+ TmfEventMatching.registerMatchObject(new TcpEventMatching());
+ TmfEventMatching.registerMatchObject(new TcpLttngEventMatching());
- TmfEventMatching twoTraceMatch = new TmfEventMatching(tracearr);
- assertTrue(twoTraceMatch.matchEvents());
+ TmfEventMatching twoTraceMatch = new TmfEventMatching(tracearr);
+ assertTrue(twoTraceMatch.matchEvents());
- /* Set method and fields accessible to make sure the counts are ok */
- try {
- /* Verify number of matches */
- Method method = TmfEventMatching.class.getDeclaredMethod("getProcessingUnit");
- method.setAccessible(true);
- IMatchProcessingUnit procUnit = (IMatchProcessingUnit) method.invoke(twoTraceMatch);
- assertEquals(46, procUnit.countMatches());
-
- } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- fail(e.getMessage());
- }
+ /* Set method and fields accessible to make sure the counts are ok */
+ try {
+ /* Verify number of matches */
+ Method method = TmfEventMatching.class.getDeclaredMethod("getProcessingUnit");
+ method.setAccessible(true);
+ IMatchProcessingUnit procUnit = (IMatchProcessingUnit) method.invoke(twoTraceMatch);
+ assertEquals(46, procUnit.countMatches());
+ } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ fail(e.getMessage());
+ } finally {
+ trace1.dispose();
+ trace2.dispose();
}
}
Matcher<IEditorReference> matcher = WidgetMatcherFactory.withPartName(CTT.getTrace().getName());
IEditorPart iep = fBot.editor(matcher).getReference().getEditor(true);
final TmfEventsEditor tmfEd = (TmfEventsEditor) iep;
- try (CtfTmfTrace trace = CtfTmfTestTrace.SYNTHETIC_TRACE.getTrace();) {
- fDesired1 = getEvent(trace, 100);
- fDesired2 = getEvent(trace, 10000);
- }
+ CtfTmfTrace trace = CtfTmfTestTrace.SYNTHETIC_TRACE.getTrace();
+ fDesired1 = getEvent(trace, 100);
+ fDesired2 = getEvent(trace, 10000);
+
UIThreadRunnable.syncExec(new VoidResult() {
@Override
public void run() {
testHV(getViewPart("Histogram"));
testCFV((ControlFlowView) getViewPart("Control Flow"));
testRV((ResourcesView) getViewPart("Resources"));
+ trace.dispose();
}
private static void testCFV(ControlFlowView vp) {
public void testOtherUstTrace() {
/* Initialize the trace and analysis module */
File suppDir;
- try (CtfTmfTrace ustTrace = otherUstTrace.getTrace();) {
- TestLttngCallStackModule module = null;
+ CtfTmfTrace ustTrace = otherUstTrace.getTrace();
+ TestLttngCallStackModule module = null;
+ try {
+ module = new TestLttngCallStackModule();
try {
- module = new TestLttngCallStackModule();
- try {
- assertTrue(module.setTrace(ustTrace));
- } catch (TmfAnalysisException e) {
- fail();
- }
- module.schedule();
- assertTrue(module.waitForCompletion());
-
- /* Make sure the generated state system exists, but is empty */
- ITmfStateSystem ss = module.getStateSystem();
- assertNotNull(ss);
- assertTrue(ss.getStartTime() >= ustTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue());
- assertEquals(0, ss.getNbAttributes());
- } finally {
- if (module != null) {
- module.dispose();
- }
+ assertTrue(module.setTrace(ustTrace));
+ } catch (TmfAnalysisException e) {
+ fail();
+ }
+ module.schedule();
+ assertTrue(module.waitForCompletion());
+
+ /* Make sure the generated state system exists, but is empty */
+ ITmfStateSystem ss = module.getStateSystem();
+ assertNotNull(ss);
+ assertTrue(ss.getStartTime() >= ustTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue());
+ assertEquals(0, ss.getNbAttributes());
+ } finally {
+ if (module != null) {
+ module.dispose();
}
- suppDir = new File(TmfTraceManager.getSupplementaryFileDir(ustTrace));
}
+ suppDir = new File(TmfTraceManager.getSupplementaryFileDir(ustTrace));
+
+ ustTrace.dispose();
deleteDirectory(suppDir);
assertFalse(suppDir.exists());
}
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 2.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.tracecompass.lttng2.ust.core;singleton:=true
Bundle-Activator: org.eclipse.tracecompass.internal.lttng2.ust.core.Activator
</parent>
<artifactId>org.eclipse.tracecompass.lttng2.ust.core</artifactId>
- <version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Trace Compass LTTng Userspace Tracer Analysis Core Plug-in</name>
fModule.setXmlFile(TmfXmlTestFiles.VALID_FILE.getPath());
- try (CtfTmfTrace trace = CtfTmfTestTrace.KERNEL.getTrace();) {
+ CtfTmfTrace trace = CtfTmfTestTrace.KERNEL.getTrace();
+ try {
fModule.setTrace(trace);
fModule.schedule();
-
assertTrue(fModule.waitForCompletion(new NullProgressMonitor()));
+
} catch (TmfAnalysisException e) {
fail("Cannot set trace " + e.getMessage());
+ } finally {
+ trace.dispose();
}
}