use of org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule in project tracecompass by tracecompass.
the class LttngExperimentAnalysisBenchmark method testExperiment.
/**
* Tests an experiment (group of traces) with an analysis module
* (OsExecutionGraph() in this example)
*
* @param directoryPath
* Path to the directory containing the group of traces
* @param loopCount
* Number of iterations
* @param moduleSupplier
* Parameter specifying which analysis module we want to test
* @param isExperiment
* Boolean parameter to specify whether the analysis module is
* for an experiment (like the OsExecutionGraph module) or for a
* trace (like KernelAnalysisModule)
* @throws TmfTraceException
* @throws TmfAnalysisException
*/
private static void testExperiment(String directoryPath, int loopCount, Supplier<IAnalysisModule> moduleSupplier, boolean isExperiment) throws TmfTraceException, TmfAnalysisException {
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 for the LttngExperimentAnalysisBenchmar class." + " See the javadoc of this class."));
return;
}
// List of all files and directories
File[] filesList = parentDirectory.listFiles();
int size = filesList.length;
String testName = "Experiment of" + Integer.toString(size);
Performance perf = Performance.getDefault();
PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + testName + CPU);
perf.tagAsSummary(pm, TEST_SUMMARY + ':' + testName + CPU, Dimension.CPU_TIME);
for (int j = 0; j < loopCount; j++) {
CtfTmfTrace[] traces = new CtfTmfTrace[size];
IAnalysisModule[] modules = new IAnalysisModule[size];
int i = 0;
for (File file : filesList) {
String path = file.getAbsolutePath() + "/kernel";
CtfTmfTrace trace = new CtfTmfTrace();
try {
trace.initTrace(null, path, CtfTmfEvent.class);
} finally {
}
traces[i] = trace;
if (!isExperiment) {
try {
IAnalysisModule module = null;
module = moduleSupplier.get();
module.setId("test");
try {
module.setTrace(trace);
} finally {
}
modules[i] = module;
} finally {
}
}
i++;
}
TmfExperiment experiment = new TmfExperiment(CtfTmfEvent.class, "Test experiment", traces, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
IAnalysisModule module = null;
if (isExperiment) {
try {
module = moduleSupplier.get();
module.setId("test");
try {
module.setTrace(experiment);
} finally {
}
} finally {
}
pm.start();
module.schedule();
module.waitForCompletion();
pm.stop();
module.dispose();
} else {
pm.start();
for (IAnalysisModule mod : modules) {
mod.schedule();
}
for (IAnalysisModule mod : modules) {
mod.waitForCompletion();
}
pm.stop();
for (IAnalysisModule mod : modules) {
mod.dispose();
}
}
experiment.dispose();
}
pm.commit();
}
use of org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule in project tracecompass by tracecompass.
the class LttngExecutionGraphTest method setUpTrace.
/**
* Setup the trace for the tests
*
* @param traceFile
* File name relative to this plugin for the trace file to load
* @return The trace with its graph module executed
*/
public ITmfTrace setUpTrace(String traceFile) {
TmfXmlKernelTraceStub trace = new TmfXmlKernelTraceStub();
IPath filePath = Activator.getAbsoluteFilePath(traceFile);
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());
}
trace.traceOpened(new TmfTraceOpenedSignal(this, trace, null));
IAnalysisModule module = null;
for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, TmfGraphBuilderModule.class)) {
module = mod;
}
assertNotNull(module);
module.schedule();
module.waitForCompletion();
return trace;
}
use of org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule in project tracecompass by tracecompass.
the class CriticalPathParameterProvider method getParameter.
@Override
public Object getParameter(String name) {
if (name.equals(CriticalPathModule.PARAM_WORKER)) {
final HostThread currentHostThread = fCurrentHostThread;
if (currentHostThread == null) {
return null;
}
/* Try to find the worker for the critical path */
IAnalysisModule mod = getModule();
if (mod instanceof CriticalPathModule) {
// $NON-NLS-1$
OsWorker worker = new OsWorker(currentHostThread, "", 0);
return worker;
}
}
return null;
}
use of org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule in project tracecompass by tracecompass.
the class LttngUstResponseBenchmark method beforeRunningTest.
@Override
protected void beforeRunningTest(ITmfTrace trace) {
List<IAnalysisModule> modules = new ArrayList<>(3);
modules.add(trace.getAnalysisModule(LttngUstCallStackAnalysis.ID));
for (IAnalysisModule module : modules) {
if (module != null) {
module.schedule();
}
}
for (IAnalysisModule module : modules) {
if (module != null) {
assertTrue(module.waitForCompletion());
}
}
}
use of org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule in project tracecompass by tracecompass.
the class XmlXyDataProviderTest method runModule.
private static void runModule(ITmfTrace trace) {
IAnalysisModule module = trace.getAnalysisModule(ANALYSIS_ID);
assertNotNull(module);
module.schedule();
assertTrue(module.waitForCompletion());
}
Aggregations