Search in sources :

Example 1 with IKernelTrace

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;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) TmfXmlKernelTraceStub(org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.TmfXmlKernelTraceStub) IPath(org.eclipse.core.runtime.IPath) TmfTrace(org.eclipse.tracecompass.tmf.core.trace.TmfTrace) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) KernelCpuUsageAnalysis(org.eclipse.tracecompass.analysis.os.linux.core.cpuusage.KernelCpuUsageAnalysis) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal) IKernelTrace(org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace) Before(org.junit.Before)

Example 2 with IKernelTrace

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();
}
Also used : ITmfTraceWithPreDefinedEvents(org.eclipse.tracecompass.tmf.core.trace.ITmfTraceWithPreDefinedEvents) IKernelAnalysisEventLayout(org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout) IKernelTrace(org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace) HashSet(java.util.HashSet)

Example 3 with IKernelTrace

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);
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) KernelStateProvider(org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.KernelStateProvider) IKernelAnalysisEventLayout(org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout) IKernelTrace(org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 4 with IKernelTrace

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);
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) IKernelAnalysisEventLayout(org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout) IKernelTrace(org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 5 with IKernelTrace

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();
    }
}
Also used : IKernelTrace(org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace) After(org.junit.After)

Aggregations

IKernelTrace (org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace)12 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)9 IKernelAnalysisEventLayout (org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout)8 NonNull (org.eclipse.jdt.annotation.NonNull)4 Before (org.junit.Before)4 IPath (org.eclipse.core.runtime.IPath)3 IStatus (org.eclipse.core.runtime.IStatus)3 KernelCpuUsageAnalysis (org.eclipse.tracecompass.analysis.os.linux.core.cpuusage.KernelCpuUsageAnalysis)3 TmfXmlKernelTraceStub (org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.TmfXmlKernelTraceStub)3 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)3 TmfTraceException (org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException)3 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)3 TmfTrace (org.eclipse.tracecompass.tmf.core.trace.TmfTrace)3 Nullable (org.eclipse.jdt.annotation.Nullable)2 KernelStateProvider (org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.KernelStateProvider)2 After (org.junit.After)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1