use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException 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.tmf.core.exceptions.TmfTraceException in project tracecompass by tracecompass.
the class LttngTraceAnalysisBenchmark method runAllBenchmarks.
/**
* Runs all the benchmarks
*/
@Test
public void runAllBenchmarks() {
Supplier<IAnalysisModule> moduleSupplier = () -> new KernelAnalysisModule();
String directoryPath = "null";
File parentDirectory = new File(directoryPath);
if (!parentDirectory.isDirectory() || parentDirectory.list() == null) {
System.err.println(String.format("Trace directory not found !\nYou need to setup the directory path before " + "running this benchmark. See the javadoc of this class."));
return;
}
File[] filesList = parentDirectory.listFiles();
for (File file : filesList) {
String path = file.getAbsolutePath() + "/kernel";
CtfTmfTrace trace = new CtfTmfTrace();
try {
trace.initTrace(null, path, CtfTmfEvent.class);
} catch (TmfTraceException e) {
e.printStackTrace();
break;
}
runOneBenchmark(trace, String.format(TEST_CPU, trace.toString()), cpu, Dimension.CPU_TIME, moduleSupplier);
runOneBenchmark(trace, String.format(TEST_MEMORY, trace.toString()), memory, Dimension.USED_JAVA_HEAP, moduleSupplier);
trace.dispose();
}
}
use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException 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.tmf.core.exceptions.TmfTraceException in project tracecompass by tracecompass.
the class KernelAnalysisUsageBenchmark method getModule.
private static KernelAnalysisModule getModule(@NonNull CtfTestTrace testTrace, @NonNull LttngKernelTrace trace) {
KernelAnalysisModule module = null;
String path = CtfTmfTestTraceUtils.getTrace(testTrace).getPath();
try {
/* Initialize the analysis module */
module = new KernelAnalysisModule();
module.setId("test");
trace.initTrace(null, path, CtfTmfEvent.class);
module.setTrace(trace);
TmfTestHelper.executeAnalysis(module);
} catch (TmfAnalysisException | TmfTraceException e) {
fail(e.getMessage());
}
return module;
}
use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException in project tracecompass by tracecompass.
the class TidAnalysisUsageBenchmark method getModule.
private static TidAnalysisModule getModule(@NonNull CtfTestTrace testTrace, @NonNull LttngKernelTrace trace) {
TidAnalysisModule module = null;
String path = CtfTmfTestTraceUtils.getTrace(testTrace).getPath();
try {
/* Initialize the analysis module */
module = new TidAnalysisModule();
module.setId("test");
trace.initTrace(null, path, CtfTmfEvent.class);
module.setTrace(trace);
TmfTestHelper.executeAnalysis(module);
} catch (TmfAnalysisException | TmfTraceException e) {
fail(e.getMessage());
}
return module;
}
Aggregations