Search in sources :

Example 1 with OsExecutionGraph

use of org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsExecutionGraph 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)

Aggregations

File (java.io.File)1 Performance (org.eclipse.test.performance.Performance)1 PerformanceMeter (org.eclipse.test.performance.PerformanceMeter)1 OsExecutionGraph (org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsExecutionGraph)1 LttngKernelTrace (org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace)1 TmfAnalysisException (org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException)1 TmfTraceException (org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException)1