Search in sources :

Example 1 with TmfTraceOpenedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal in project tracecompass by tracecompass.

the class ContextSwitchProviderTest method setUp.

/**
 * Setup the trace for the tests
 */
@Before
public void setUp() {
    ITmfTrace 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));
    fModule = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelContextSwitchAnalysis.class, KernelContextSwitchAnalysis.ID);
    assertNotNull(fModule);
    fTrace = trace;
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) 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) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal) KernelContextSwitchAnalysis(org.eclipse.tracecompass.analysis.os.linux.core.contextswitch.KernelContextSwitchAnalysis) Before(org.junit.Before)

Example 2 with TmfTraceOpenedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal 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 3 with TmfTraceOpenedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal 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;
}
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) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfTrace(org.eclipse.tracecompass.tmf.core.trace.TmfTrace) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal) InputOutputAnalysisModule(org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.InputOutputAnalysisModule) KernelAnalysisModule(org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 4 with TmfTraceOpenedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal 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());
}
Also used : IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)

Example 5 with TmfTraceOpenedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal 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;
}
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) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)

Aggregations

TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)46 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)23 TmfTrace (org.eclipse.tracecompass.tmf.core.trace.TmfTrace)18 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)15 Before (org.junit.Before)15 Test (org.junit.Test)13 TmfTraceException (org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException)11 IPath (org.eclipse.core.runtime.IPath)10 TmfXmlKernelTraceStub (org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.TmfXmlKernelTraceStub)9 IStatus (org.eclipse.core.runtime.IStatus)8 TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)8 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)7 TmfTraceClosedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal)5 KernelAnalysisModule (org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule)4 TimeGraphEntryModel (org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel)4 Element (org.w3c.dom.Element)4 File (java.io.File)3 NonNull (org.eclipse.jdt.annotation.NonNull)3 TmfTraceSelectedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)3 TestAnalysis (org.eclipse.tracecompass.tmf.tests.stubs.analysis.TestAnalysis)3