Search in sources :

Example 6 with TmfTraceException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException in project tracecompass by tracecompass.

the class KernelExecutionGraphBenchmark method runOneBenchmark.

private void runOneBenchmark(String testName, RunMethod method, Dimension dimension, int loopCount) {
    Performance perf = Performance.getDefault();
    PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + testName);
    PerformanceMeter pmCritPath = perf.createPerformanceMeter(CRIT_PATH_TEST_ID + testName);
    perf.tagAsSummary(pm, "Execution graph " + testName, dimension);
    for (int i = 0; i < loopCount; i++) {
        LttngKernelTrace trace = null;
        OsExecutionGraph module = null;
        try {
            trace = new LttngKernelTrace();
            module = new OsExecutionGraph();
            module.setId("test");
            trace.initTrace(null, fFileTracePath, CtfTmfEvent.class);
            module.setTrace(trace);
            method.execute(pm, module);
            // If a thread is specified, benchmark the critical path
            if (fThreadId > 0) {
                benchmarkCriticalPath(testName, method, pmCritPath, trace, module);
            }
            /*
                 * Delete the supplementary files, so that the next iteration
                 * rebuilds the state system.
                 */
            File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace));
            for (File file : suppDir.listFiles()) {
                file.delete();
            }
        } catch (TmfAnalysisException | TmfTraceException e) {
            fail(e.getMessage());
        } finally {
            if (module != null) {
                module.dispose();
            }
            if (trace != null) {
                trace.dispose();
            }
        }
    }
    pm.commit();
    pmCritPath.commit();
}
Also used : TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) OsExecutionGraph(org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsExecutionGraph) PerformanceMeter(org.eclipse.test.performance.PerformanceMeter) LttngKernelTrace(org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace) Performance(org.eclipse.test.performance.Performance) File(java.io.File)

Example 7 with TmfTraceException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException 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 8 with TmfTraceException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException in project tracecompass by tracecompass.

the class LttngTraceAnalysisBenchmark method runOneBenchmark.

private static void runOneBenchmark(@NonNull CtfTmfTrace testTrace, String testName, runMethod method, Dimension dimension, Supplier<IAnalysisModule> moduleSupplier) {
    Performance perf = Performance.getDefault();
    PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + testName);
    perf.tagAsSummary(pm, "Trace Compass Analysis " + testName, dimension);
    for (int i = 0; i < LOOP_COUNT; i++) {
        LttngKernelTrace trace = null;
        IAnalysisModule module = null;
        String path = testTrace.getPath();
        try {
            trace = new LttngKernelTrace();
            module = moduleSupplier.get();
            module.setId("test");
            trace.initTrace(null, path, CtfTmfEvent.class);
            module.setTrace(trace);
            method.execute(pm, module);
            File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace));
            for (File file : suppDir.listFiles()) {
                file.delete();
            }
        } catch (TmfAnalysisException | TmfTraceException e) {
            fail(e.getMessage());
        } finally {
            if (module != null) {
                module.dispose();
            }
            if (trace != null) {
                trace.dispose();
            }
        }
    }
    pm.commit();
}
Also used : IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) PerformanceMeter(org.eclipse.test.performance.PerformanceMeter) LttngKernelTrace(org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace) Performance(org.eclipse.test.performance.Performance) File(java.io.File)

Example 9 with TmfTraceException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException 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 10 with TmfTraceException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException in project tracecompass by tracecompass.

the class TidAnalysisUsageBenchmark method getModule.

private static TidAnalysisModule getModule(@NonNull CtfTestTrace testTrace, @NonNull LttngKernelTrace trace) {
    TidAnalysisModule module = null;
    String path = CtfTmfTestTraceUtils.getTrace(testTrace).getPath();
    try {
        /* Initialize the analysis module */
        module = new TidAnalysisModule();
        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) TidAnalysisModule(org.eclipse.tracecompass.analysis.os.linux.core.tid.TidAnalysisModule)

Aggregations

TmfTraceException (org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException)50 File (java.io.File)17 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)14 IStatus (org.eclipse.core.runtime.IStatus)12 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)12 TmfTraceStub (org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub)11 IOException (java.io.IOException)10 IPath (org.eclipse.core.runtime.IPath)8 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)8 TmfAnalysisException (org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException)8 TmfXmlKernelTraceStub (org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.TmfXmlKernelTraceStub)7 Performance (org.eclipse.test.performance.Performance)6 PerformanceMeter (org.eclipse.test.performance.PerformanceMeter)6 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)6 TmfTrace (org.eclipse.tracecompass.tmf.core.trace.TmfTrace)6 Before (org.junit.Before)6 LttngKernelTrace (org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace)5 CtfTmfTrace (org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4