use of org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule in project tracecompass by tracecompass.
the class CriticalPathView method analysisStarted.
/**
* Signal handler for analysis started, we need to rebuilt the entry list with
* updated statistics values for the current graph worker of the critical path
* module.
*
* @param signal
* The signal
*/
@TmfSignalHandler
public void analysisStarted(TmfStartAnalysisSignal signal) {
IAnalysisModule analysis = signal.getAnalysisModule();
if (analysis instanceof CriticalPathModule) {
CriticalPathModule criticalPath = (CriticalPathModule) analysis;
/*
* We need to wait for CriticalPathDataProviderFactory to have
* received this signal. Create a new phaser and register, and wait
* for the end synch signal to arrive and advance in a new thread.
*/
fPhaser = new Phaser();
fPhaser.register();
new Thread() {
@Override
public void run() {
fPhaser.awaitAdvance(0);
Collection<ITmfTrace> traces = TmfTraceManager.getTraceSetWithExperiment(getTrace());
if (traces.contains(criticalPath.getTrace())) {
rebuild();
}
}
}.start();
}
}
use of org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule in project tracecompass by tracecompass.
the class CpuUsageDataProviderTest method setUp.
/**
* Setup the trace for the tests
*/
@Before
public void setUp() {
IKernelTrace trace = new TmfXmlKernelTraceStub();
IPath filePath = Activator.getAbsoluteFilePath(CPU_USAGE_FILE);
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));
/*
* FIXME: Make sure this analysis is finished before running the CPU analysis.
* This block can be removed once analysis dependency and request precedence is
* implemented
*/
IAnalysisModule module = null;
for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, TidAnalysisModule.class)) {
module = mod;
}
assertNotNull(module);
module.schedule();
module.waitForCompletion();
/* End of the FIXME block */
module = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelCpuUsageAnalysis.class, KernelCpuUsageAnalysis.ID);
assertNotNull(module);
module.schedule();
module.waitForCompletion();
fDataProvider = CpuUsageDataProvider.create(trace);
assertNotNull(fDataProvider);
fTrace = trace;
}
use of org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule in project tracecompass by tracecompass.
the class CPUAnalysisBenchmark method initializeTrace.
private void initializeTrace(@NonNull String path, @NonNull LttngKernelTrace trace) throws TmfTraceException {
trace.initTrace(null, path, CtfTmfEvent.class);
trace.traceOpened(new TmfTraceOpenedSignal(this, trace, null));
IAnalysisModule module = trace.getAnalysisModule(TidAnalysisModule.ID);
assertNotNull(module);
module.schedule();
assertTrue(module.waitForCompletion());
// The data provider will use this module, so execute it
module = trace.getAnalysisModule(KernelCpuUsageAnalysis.ID);
assertNotNull(module);
module.schedule();
assertTrue(module.waitForCompletion());
}
use of org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule 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.analysis.IAnalysisModule 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();
}
Aggregations