use of org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace 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.analysis.os.linux.core.trace.IKernelTrace in project tracecompass by tracecompass.
the class TcpLttngEventMatching method canMatchTrace.
@Override
public boolean canMatchTrace(ITmfTrace trace) {
// Get the events that this trace needs to have
if (!(trace instanceof IKernelTrace)) {
// false
return false;
}
IKernelAnalysisEventLayout layout = ((IKernelTrace) trace).getKernelEventLayout();
TRACE_LAYOUTS.put(trace, layout);
Set<String> events = REQUIRED_EVENTS.computeIfAbsent(layout, eventLayout -> {
Set<String> eventsSet = new HashSet<>();
eventsSet.addAll(eventLayout.eventsNetworkSend());
eventsSet.addAll(eventLayout.eventsNetworkReceive());
return eventsSet;
});
if (!(trace instanceof ITmfTraceWithPreDefinedEvents)) {
// No predefined events, suppose events are present
return true;
}
ITmfTraceWithPreDefinedEvents ktrace = (ITmfTraceWithPreDefinedEvents) trace;
Set<String> traceEvents = TmfEventTypeCollectionHelper.getEventNames(ktrace.getContainedEventTypes());
traceEvents.retainAll(events);
return !traceEvents.isEmpty();
}
use of org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace in project tracecompass by tracecompass.
the class KernelAnalysisModule method createStateProvider.
@Override
@NonNull
protected ITmfStateProvider createStateProvider() {
ITmfTrace trace = checkNotNull(getTrace());
IKernelAnalysisEventLayout layout;
if (trace instanceof IKernelTrace) {
layout = ((IKernelTrace) trace).getKernelEventLayout();
} else {
/* Fall-back to the base LttngEventLayout */
layout = DefaultEventLayout.getInstance();
}
return new KernelStateProvider(trace, layout);
}
use of org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace in project tracecompass by tracecompass.
the class KernelMemoryAnalysisModule method createStateProvider.
@Override
@NonNull
protected ITmfStateProvider createStateProvider() {
ITmfTrace trace = checkNotNull(getTrace());
IKernelAnalysisEventLayout layout;
if (trace instanceof IKernelTrace) {
layout = ((IKernelTrace) trace).getKernelEventLayout();
} else {
/* Fall-back to the base LttngEventLayout */
layout = DefaultEventLayout.getInstance();
}
return new KernelMemoryStateProvider(trace, layout);
}
use of org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace in project tracecompass by tracecompass.
the class CpuUsageDataProviderTest method tearDown.
/**
* Clean up
*/
@After
public void tearDown() {
IKernelTrace trace = fTrace;
if (trace != null) {
deleteSuppFiles(trace);
trace.dispose();
}
}
Aggregations