Search in sources :

Example 1 with KernelAnalysisModule

use of org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule 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 2 with KernelAnalysisModule

use of org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule 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();
    }
}
Also used : IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) KernelAnalysisModule(org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule) File(java.io.File) CtfTmfTrace(org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace) Test(org.junit.Test)

Example 3 with KernelAnalysisModule

use of org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule in project tracecompass by tracecompass.

the class KernelAnalysisUsageBenchmark method getModule.

private static KernelAnalysisModule getModule(@NonNull CtfTestTrace testTrace, @NonNull LttngKernelTrace trace) {
    KernelAnalysisModule module = null;
    String path = CtfTmfTestTraceUtils.getTrace(testTrace).getPath();
    try {
        /* Initialize the analysis module */
        module = new KernelAnalysisModule();
        module.setId("test");
        trace.initTrace(null, path, CtfTmfEvent.class);
        module.setTrace(trace);
        TmfTestHelper.executeAnalysis(module);
    } catch (TmfAnalysisException | TmfTraceException e) {
        fail(e.getMessage());
    }
    return module;
}
Also used : TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) KernelAnalysisModule(org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule)

Example 4 with KernelAnalysisModule

use of org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule in project tracecompass by tracecompass.

the class KernelAnalysisUsageBenchmark method runTest.

private static void runTest(@NonNull CtfTestTrace testTrace, String testName) {
    /* First, complete the analysis */
    LttngKernelTrace trace = new LttngKernelTrace();
    deleteSupplementaryFiles(trace);
    KernelAnalysisModule module = getModule(testTrace, trace);
    /* Benchmark some query use cases */
    benchmarkGetThreadOnCpu(testName, module);
    benchmarkFullQueries(testName, module);
    /*
         * Delete the supplementary files at the end of the benchmarks
         */
    deleteSupplementaryFiles(trace);
    module.dispose();
    trace.dispose();
    CtfTmfTestTraceUtils.dispose(testTrace);
}
Also used : LttngKernelTrace(org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace) KernelAnalysisModule(org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule)

Example 5 with KernelAnalysisModule

use of org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule in project tracecompass by tracecompass.

the class LttngKernelAnalysisTest method setUp.

/**
 * Set-up the test
 */
@Before
public void setUp() {
    fKernelAnalysisModule = new KernelAnalysisModule();
    fTrace = LttngKernelTestTraceUtils.getTrace(CtfTestTrace.KERNEL);
}
Also used : KernelAnalysisModule(org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule) Before(org.junit.Before)

Aggregations

KernelAnalysisModule (org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule)25 Test (org.junit.Test)14 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)6 Nullable (org.eclipse.jdt.annotation.Nullable)5 NonNull (org.eclipse.jdt.annotation.NonNull)4 ITmfStateInterval (org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval)4 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)4 ProcessStatus (org.eclipse.tracecompass.analysis.os.linux.core.model.ProcessStatus)3 TmfTraceException (org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException)3 TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)3 Before (org.junit.Before)3 File (java.io.File)2 Objects (java.util.Objects)2 IPath (org.eclipse.core.runtime.IPath)2 KernelThreadInformationProvider (org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelThreadInformationProvider)2 TmfXmlKernelTraceStub (org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.TmfXmlKernelTraceStub)2 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)2 TmfTraceSelectedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)2 ITmfContext (org.eclipse.tracecompass.tmf.core.trace.ITmfContext)2 TmfTraceUtils (org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils)2