use of org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule in project tracecompass by tracecompass.
the class AbstractTestInputOutput method setUp.
/**
* Setup the trace for the tests and return the InputOutputAnalysisModule,
* not executed.
*
* @param fileName
* The file name of the trace to open
* @return The input output analysis module
*/
@NonNull
protected InputOutputAnalysisModule setUp(String fileName) {
TmfXmlKernelTraceStub trace = new TmfXmlKernelTraceStub();
trace.addEventAspect(KernelTidAspect.INSTANCE);
trace.setKernelEventLayout(EVENT_LAYOUT);
IPath filePath = Activator.getAbsoluteFilePath(IO_FILE_PATH + fileName);
IStatus status = trace.validate(null, filePath.toOSString());
if (!status.isOK()) {
fail(status.getException().getMessage());
}
try {
trace.initTrace(null, filePath.toOSString(), TmfEvent.class);
} catch (TmfTraceException e) {
fail(e.getMessage());
}
deleteSuppFiles(trace);
((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null));
fTrace = trace;
/* Start the kernel analysis module */
KernelAnalysisModule kernelMod = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID);
assertNotNull(kernelMod);
kernelMod.schedule();
kernelMod.waitForCompletion();
InputOutputAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, InputOutputAnalysisModule.class, InputOutputAnalysisModule.ID);
assertNotNull(module);
return module;
}
use of org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule 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.analysis.os.linux.core.kernel.KernelAnalysisModule 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.analysis.os.linux.core.kernel.KernelAnalysisModule 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.analysis.os.linux.core.kernel.KernelAnalysisModule in project tracecompass by tracecompass.
the class LttngKernelAnalysisTest method setUp.
/**
* Set-up the test
*/
@Before
public void setUp() {
fKernelAnalysisModule = new KernelAnalysisModule();
fTrace = LttngKernelTestTraceUtils.getTrace(CtfTestTrace.KERNEL);
}
Aggregations