Search in sources :

Example 1 with LttngKernelTrace

use of org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace in project tracecompass by tracecompass.

the class StatisticsAnalysisBenchmark method runTest.

private static void runTest(CtfTestTrace testTrace, String testName, Map<String, Long> testCases) {
    Performance perf = Performance.getDefault();
    PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + '#' + testName);
    perf.tagAsSummary(pm, "Statistics Analysis: " + testName, Dimension.CPU_TIME);
    if (testTrace == CtfTestTrace.DJANGO_CLIENT || testTrace == CtfTestTrace.DJANGO_HTTPD) {
        /* Do not show all traces in the global summary */
        perf.tagAsGlobalSummary(pm, "Statistics Analysis: " + testName, Dimension.CPU_TIME);
    }
    for (int i = 0; i < LOOP_COUNT; i++) {
        LttngKernelTrace trace = null;
        TmfStatisticsModule module = null;
        try {
            trace = new LttngKernelTrace();
            module = new TmfStatisticsModule();
            module.setId("test");
            // TODO Allow the utility method to return a LttngKernelTrace directly
            CtfTmfTrace ctfTmfTrace = CtfTmfTestTraceUtils.getTrace(testTrace);
            trace.initTrace(null, ctfTmfTrace.getPath(), CtfTmfEvent.class);
            module.setTrace(trace);
            pm.start();
            TmfTestHelper.executeAnalysis(module);
            pm.stop();
            ITmfStatistics stats = module.getStatistics();
            if (stats == null) {
                throw new IllegalStateException();
            }
            Map<String, Long> map = stats.getEventTypesTotal();
            /*
                 * Test each of the entries
                 */
            try {
                for (Entry<String, Long> entry : testCases.entrySet()) {
                    Long value = map.get(entry.getKey());
                    assertNotNull(value);
                    assertTrue(value.equals(entry.getValue()));
                }
            } catch (NullPointerException e) {
                fail(e.getMessage());
            }
            /*
                 * 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();
    CtfTmfTestTraceUtils.dispose(testTrace);
}
Also used : LttngKernelTrace(org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace) TmfStatisticsModule(org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsModule) ITmfStatistics(org.eclipse.tracecompass.tmf.core.statistics.ITmfStatistics) TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) PerformanceMeter(org.eclipse.test.performance.PerformanceMeter) Performance(org.eclipse.test.performance.Performance) File(java.io.File) CtfTmfTrace(org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace)

Example 2 with LttngKernelTrace

use of org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace 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 3 with LttngKernelTrace

use of org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace 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 4 with LttngKernelTrace

use of org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace 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 LttngKernelTrace

use of org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace in project tracecompass by tracecompass.

the class SystemCallAnalysisUsageBenchmark method runTest.

private static void runTest(@NonNull CtfTestTrace testTrace, String traceName) {
    /* First, complete the analysis */
    LttngKernelTrace trace = new LttngKernelTrace();
    SystemCallLatencyAnalysis module = getModule(testTrace, trace);
    long segmentEnd = benchmarkIteration(traceName, module);
    benchmarkIntersection(traceName, module, trace.getStartTime().getValue(), segmentEnd);
    /*
         * Delete the supplementary files at the end of the benchmarks
         */
    deleteSupplementaryFiles(trace);
    module.dispose();
    trace.dispose();
    CtfTmfTestTraceUtils.dispose(testTrace);
}
Also used : SystemCallLatencyAnalysis(org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.SystemCallLatencyAnalysis) LttngKernelTrace(org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace)

Aggregations

LttngKernelTrace (org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace)10 TmfAnalysisException (org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException)6 File (java.io.File)5 Performance (org.eclipse.test.performance.Performance)5 PerformanceMeter (org.eclipse.test.performance.PerformanceMeter)5 TmfTraceException (org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException)5 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)3 SystemCallLatencyAnalysis (org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.SystemCallLatencyAnalysis)2 OsExecutionGraph (org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsExecutionGraph)1 KernelAnalysisModule (org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule)1 TidAnalysisModule (org.eclipse.tracecompass.analysis.os.linux.core.tid.TidAnalysisModule)1 IKernelAnalysisEventLayout (org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout)1 Lttng27EventLayout (org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout.Lttng27EventLayout)1 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)1 ITmfStatistics (org.eclipse.tracecompass.tmf.core.statistics.ITmfStatistics)1 TmfStatisticsModule (org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsModule)1 CtfTmfTrace (org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace)1