use of org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace in project tracecompass by tracecompass.
the class StatisticsAnalysisBenchmark method runTest.
private static void runTest(CtfTestTrace testTrace, String testName, Map<String, Long> testCases) {
Performance perf = Performance.getDefault();
PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + '#' + testName);
perf.tagAsSummary(pm, "Statistics Analysis: " + testName, Dimension.CPU_TIME);
if (testTrace == CtfTestTrace.DJANGO_CLIENT || testTrace == CtfTestTrace.DJANGO_HTTPD) {
/* Do not show all traces in the global summary */
perf.tagAsGlobalSummary(pm, "Statistics Analysis: " + testName, Dimension.CPU_TIME);
}
for (int i = 0; i < LOOP_COUNT; i++) {
LttngKernelTrace trace = null;
TmfStatisticsModule module = null;
try {
trace = new LttngKernelTrace();
module = new TmfStatisticsModule();
module.setId("test");
// TODO Allow the utility method to return a LttngKernelTrace directly
CtfTmfTrace ctfTmfTrace = CtfTmfTestTraceUtils.getTrace(testTrace);
trace.initTrace(null, ctfTmfTrace.getPath(), CtfTmfEvent.class);
module.setTrace(trace);
pm.start();
TmfTestHelper.executeAnalysis(module);
pm.stop();
ITmfStatistics stats = module.getStatistics();
if (stats == null) {
throw new IllegalStateException();
}
Map<String, Long> map = stats.getEventTypesTotal();
/*
* Test each of the entries
*/
try {
for (Entry<String, Long> entry : testCases.entrySet()) {
Long value = map.get(entry.getKey());
assertNotNull(value);
assertTrue(value.equals(entry.getValue()));
}
} catch (NullPointerException e) {
fail(e.getMessage());
}
/*
* Delete the supplementary files, so that the next iteration
* rebuilds the state system.
*/
File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace));
for (File file : suppDir.listFiles()) {
file.delete();
}
} catch (TmfAnalysisException | TmfTraceException e) {
fail(e.getMessage());
} finally {
if (module != null) {
module.dispose();
}
if (trace != null) {
trace.dispose();
}
}
}
pm.commit();
CtfTmfTestTraceUtils.dispose(testTrace);
}
use of org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace in project tracecompass by tracecompass.
the class KernelExecutionGraphBenchmark method runOneBenchmark.
private void runOneBenchmark(String testName, RunMethod method, Dimension dimension, int loopCount) {
Performance perf = Performance.getDefault();
PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + testName);
PerformanceMeter pmCritPath = perf.createPerformanceMeter(CRIT_PATH_TEST_ID + testName);
perf.tagAsSummary(pm, "Execution graph " + testName, dimension);
for (int i = 0; i < loopCount; i++) {
LttngKernelTrace trace = null;
OsExecutionGraph module = null;
try {
trace = new LttngKernelTrace();
module = new OsExecutionGraph();
module.setId("test");
trace.initTrace(null, fFileTracePath, CtfTmfEvent.class);
module.setTrace(trace);
method.execute(pm, module);
// If a thread is specified, benchmark the critical path
if (fThreadId > 0) {
benchmarkCriticalPath(testName, method, pmCritPath, trace, module);
}
/*
* Delete the supplementary files, so that the next iteration
* rebuilds the state system.
*/
File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace));
for (File file : suppDir.listFiles()) {
file.delete();
}
} catch (TmfAnalysisException | TmfTraceException e) {
fail(e.getMessage());
} finally {
if (module != null) {
module.dispose();
}
if (trace != null) {
trace.dispose();
}
}
}
pm.commit();
pmCritPath.commit();
}
use of org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace in project tracecompass by tracecompass.
the class LttngTraceAnalysisBenchmark method runOneBenchmark.
private static void runOneBenchmark(@NonNull CtfTmfTrace testTrace, String testName, runMethod method, Dimension dimension, Supplier<IAnalysisModule> moduleSupplier) {
Performance perf = Performance.getDefault();
PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + testName);
perf.tagAsSummary(pm, "Trace Compass Analysis " + testName, dimension);
for (int i = 0; i < LOOP_COUNT; i++) {
LttngKernelTrace trace = null;
IAnalysisModule module = null;
String path = testTrace.getPath();
try {
trace = new LttngKernelTrace();
module = moduleSupplier.get();
module.setId("test");
trace.initTrace(null, path, CtfTmfEvent.class);
module.setTrace(trace);
method.execute(pm, module);
File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace));
for (File file : suppDir.listFiles()) {
file.delete();
}
} catch (TmfAnalysisException | TmfTraceException e) {
fail(e.getMessage());
} finally {
if (module != null) {
module.dispose();
}
if (trace != null) {
trace.dispose();
}
}
}
pm.commit();
}
use of org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace in project tracecompass by tracecompass.
the class KernelAnalysisUsageBenchmark method runTest.
private static void runTest(@NonNull CtfTestTrace testTrace, String testName) {
/* First, complete the analysis */
LttngKernelTrace trace = new LttngKernelTrace();
deleteSupplementaryFiles(trace);
KernelAnalysisModule module = getModule(testTrace, trace);
/* Benchmark some query use cases */
benchmarkGetThreadOnCpu(testName, module);
benchmarkFullQueries(testName, module);
/*
* Delete the supplementary files at the end of the benchmarks
*/
deleteSupplementaryFiles(trace);
module.dispose();
trace.dispose();
CtfTmfTestTraceUtils.dispose(testTrace);
}
use of org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace in project tracecompass by tracecompass.
the class SystemCallAnalysisUsageBenchmark method runTest.
private static void runTest(@NonNull CtfTestTrace testTrace, String traceName) {
/* First, complete the analysis */
LttngKernelTrace trace = new LttngKernelTrace();
SystemCallLatencyAnalysis module = getModule(testTrace, trace);
long segmentEnd = benchmarkIteration(traceName, module);
benchmarkIntersection(traceName, module, trace.getStartTime().getValue(), segmentEnd);
/*
* Delete the supplementary files at the end of the benchmarks
*/
deleteSupplementaryFiles(trace);
module.dispose();
trace.dispose();
CtfTmfTestTraceUtils.dispose(testTrace);
}
Aggregations