package org.eclipse.linuxtools.lttng2.kernel.core.tests.perf.event.matching;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assume.assumeTrue;
+import java.util.Arrays;
+
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.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationAlgorithm;
+import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationManager;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
-import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
import org.eclipse.test.performance.Dimension;
private static final String TIME = " (time)";
private static final String MEMORY = " (memory usage)";
private static final String TEST_SUMMARY = "Trace synchronization";
- private static int BLOCK_SIZE = 1000;
/**
* Initialize some data
perf.tagAsSummary(pm, TEST_SUMMARY + ':' + testName + TIME, Dimension.CPU_TIME);
for (int i = 0; i < loop_count; i++) {
- TmfExperiment experiment = new TmfExperiment(CtfTmfEvent.class, "Test experiment", testTraces, BLOCK_SIZE);
-
pm.start();
- try {
- experiment.synchronizeTraces(true);
- } catch (TmfTraceException e) {
- fail("Failed at iteration " + i + " with message: " + e.getMessage());
- }
+ SynchronizationManager.synchronizeTraces(null, Arrays.asList(testTraces), true);
pm.stop();
-
}
pm.commit();
perf.tagAsSummary(pm, TEST_SUMMARY + ':' + testName + MEMORY, Dimension.USED_JAVA_HEAP);
for (int i = 0; i < loop_count; i++) {
- TmfExperiment experiment = new TmfExperiment(CtfTmfEvent.class, "Test experiment", testTraces, BLOCK_SIZE);
System.gc();
pm.start();
- try {
- experiment.synchronizeTraces(true);
- } catch (TmfTraceException e) {
- fail("Failed at iteration " + i + " with message: " + e.getMessage());
- }
+ SynchronizationAlgorithm algo = SynchronizationManager.synchronizeTraces(null, Arrays.asList(testTraces), true);
+ assertNotNull(algo);
+
System.gc();
pm.stop();
-
}
pm.commit();
}
Kernel time: Time spent in kernel mode
-Used Java Heap: It is the difference between the memory used at the beginning of the execution and at the end. This metric may be useful to calculate the overall size occupied by the data generated by the test run, by forcing a garbage collection before taking the metrics at the beginning and at the end of the execution. But it will not show the memory used throughout the execution.
+Used Java Heap: It is the difference between the memory used at the beginning of the execution and at the end. This metric may be useful to calculate the overall size occupied by the data generated by the test run, by forcing a garbage collection before taking the metrics at the beginning and at the end of the execution. But it will not show the memory used throughout the execution. There can be a large standard deviation. The reason for this is that when benchmarking methods that trigger tasks in different threads, like signals and/or analysis, these other threads might be in various states at each run of the test, which will impact the memory usage calculated. When using this metric, either make sure the method to test does not trigger external threads or make sure you wait for them to finish.