lttng: Add System Call Analysis benchmarks
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Tue, 17 May 2016 20:21:58 +0000 (16:21 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Wed, 18 May 2016 20:15:59 +0000 (16:15 -0400)
This benchmarks the build time and memory usage of system call latency analysis
on some lttng kernel traces

Change-Id: Ib88063a1468c21b7856f12c00a4d12ce70b6958c
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/72974
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
analysis/org.eclipse.tracecompass.analysis.os.linux.core/META-INF/MANIFEST.MF
lttng/org.eclipse.tracecompass.lttng2.kernel.core.tests/META-INF/MANIFEST.MF
lttng/org.eclipse.tracecompass.lttng2.kernel.core.tests/perf/org/eclipse/tracecompass/lttng2/kernel/core/tests/perf/analysis/syscall/SystemCallAnalysisBenchmark.java [new file with mode: 0644]
releng/org.eclipse.tracecompass.alltests/src/org/eclipse/tracecompass/alltests/perf/RunAllPerfTests.java

index df25f432dd64da3bf5aa0b6c3585ad93370dd997..5dce2ea041cae02e6b35e9dc86eaaa6b5a3a7c64 100644 (file)
@@ -34,5 +34,5 @@ Export-Package: org.eclipse.tracecompass.analysis.os.linux.core.contextswitch,
  org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.handlers;x-internal:=true,
  org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel;x-friends:="org.eclipse.tracecompass.analysis.os.linux.core.tests,org.eclipse.tracecompass.analysis.os.linux.ui,org.eclipse.tracecompass.lttng2.kernel.core.tests",
  org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;x-friends:="org.eclipse.tracecompass.analysis.os.linux.core.tests",
- org.eclipse.tracecompass.internal.analysis.os.linux.core.latency;x-friends:="org.eclipse.tracecompass.analysis.os.linux.core.tests,org.eclipse.tracecompass.analysis.os.linux.ui",
+ org.eclipse.tracecompass.internal.analysis.os.linux.core.latency;x-friends:="org.eclipse.tracecompass.analysis.os.linux.core.tests,org.eclipse.tracecompass.analysis.os.linux.ui,org.eclipse.tracecompass.lttng2.kernel.core.tests",
  org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.statistics;x-friends:="org.eclipse.tracecompass.analysis.os.linux.ui,org.eclipse.tracecompass.analysis.os.linux.core.tests"
index 76df71419382ddfd8b396915c85327224f1c9520..8b3039a84b4c9f209a9f7a453bbeb00d3e7ab1e1 100644 (file)
@@ -20,7 +20,8 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.tracecompass.lttng2.control.core,
  org.eclipse.tracecompass.analysis.os.linux.core,
  org.eclipse.tracecompass.analysis.os.linux.core.tests,
- org.eclipse.tracecompass.analysis.graph.core
+ org.eclipse.tracecompass.analysis.graph.core,
+ org.eclipse.tracecompass.analysis.timing.core
 Export-Package: org.eclipse.tracecompass.lttng2.kernel.core.tests,
  org.eclipse.tracecompass.lttng2.kernel.core.tests.analysis.graph,
  org.eclipse.tracecompass.lttng2.kernel.core.tests.analysis.kernel;x-internal:=true,
@@ -29,6 +30,7 @@ Export-Package: org.eclipse.tracecompass.lttng2.kernel.core.tests,
  org.eclipse.tracecompass.lttng2.kernel.core.tests.event.matchandsync;x-internal:=true,
  org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis,
  org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis.kernel,
+ org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis.syscall,
  org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis.tid,
  org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.event.matching,
  org.eclipse.tracecompass.lttng2.lttng.kernel.core.tests.shared.vm
diff --git a/lttng/org.eclipse.tracecompass.lttng2.kernel.core.tests/perf/org/eclipse/tracecompass/lttng2/kernel/core/tests/perf/analysis/syscall/SystemCallAnalysisBenchmark.java b/lttng/org.eclipse.tracecompass.lttng2.kernel.core.tests/perf/org/eclipse/tracecompass/lttng2/kernel/core/tests/perf/analysis/syscall/SystemCallAnalysisBenchmark.java
new file mode 100644 (file)
index 0000000..81d5748
--- /dev/null
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2016 École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis.syscall;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.test.performance.Dimension;
+import org.eclipse.test.performance.Performance;
+import org.eclipse.test.performance.PerformanceMeter;
+import org.eclipse.tracecompass.analysis.os.linux.core.tid.TidAnalysisModule;
+import org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.SystemCallLatencyAnalysis;
+import org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace;
+import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
+import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
+import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestHelper;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils;
+import org.junit.Test;
+
+/**
+ * Benchmarks the system call latency analysis
+ *
+ * @author Geneviève Bastien
+ */
+public class SystemCallAnalysisBenchmark {
+
+    /**
+     * Test test ID for the system call analysis benchmarks
+     */
+    public static final String TEST_ID = "org.eclipse.tracecompass#System Call Analysis#";
+    private static final String TEST_BUILD = "Building Analysis (%s)";
+    private static final String TEST_MEMORY = "Memory Usage (%s)";
+
+    private static final int LOOP_COUNT = 25;
+
+    private interface RunMethod {
+        void execute(PerformanceMeter pm, IAnalysisModule module);
+    }
+
+    private RunMethod cpu = (pm, module) -> {
+        pm.start();
+        TmfTestHelper.executeAnalysis(module);
+        pm.stop();
+    };
+
+    private RunMethod memory = (pm, module) -> {
+        System.gc();
+        pm.start();
+        TmfTestHelper.executeAnalysis(module);
+        System.gc();
+        pm.stop();
+    };
+
+    /**
+     * Run the benchmark with "trace2"
+     */
+    @Test
+    public void testTrace2() {
+        runTest(CtfTestTrace.TRACE2, String.format(TEST_BUILD, "Trace2"), cpu, Dimension.CPU_TIME);
+        runTest(CtfTestTrace.TRACE2, String.format(TEST_MEMORY, "Trace2"), memory, Dimension.USED_JAVA_HEAP);
+    }
+
+    /**
+     * Run the benchmark with "many thread"
+     */
+    @Test
+    public void testManyThreads() {
+        runTest(CtfTestTrace.MANY_THREADS, String.format(TEST_BUILD, "Many threads"), cpu, Dimension.CPU_TIME);
+        runTest(CtfTestTrace.MANY_THREADS, String.format(TEST_MEMORY, "Many threads"), memory, Dimension.USED_JAVA_HEAP);
+    }
+
+    /**
+     * Run the benchmark with "django httpd"
+     */
+    @Test
+    public void testDjangoHttpd() {
+        runTest(CtfTestTrace.DJANGO_HTTPD, String.format(TEST_BUILD, "Django HTTPD"), cpu, Dimension.CPU_TIME);
+        runTest(CtfTestTrace.DJANGO_HTTPD, String.format(TEST_MEMORY, "Django HTTPD"), memory, Dimension.USED_JAVA_HEAP);
+    }
+
+    private static void runTest(@NonNull CtfTestTrace testTrace, String testName, RunMethod method, Dimension dimension) {
+        Performance perf = Performance.getDefault();
+        PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + testName);
+        perf.tagAsSummary(pm, "Syscall " + testName, dimension);
+
+        for (int i = 0; i < LOOP_COUNT; i++) {
+            LttngKernelTrace trace = null;
+            IAnalysisModule module = null;
+
+            String path = CtfTmfTestTraceUtils.getTrace(testTrace).getPath();
+
+            try {
+                // Make sure the TID analysis has run on this trace
+                trace = new LttngKernelTrace();
+                trace.initTrace(null, path, CtfTmfEvent.class);
+                trace.traceOpened(new TmfTraceOpenedSignal(trace, trace, null));
+                module = trace.getAnalysisModule(TidAnalysisModule.ID);
+                assertNotNull(module);
+                module.schedule();
+                module.waitForCompletion();
+
+                module = new SystemCallLatencyAnalysis();
+                module.setId("test");
+                module.setTrace(trace);
+
+                method.execute(pm, 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();
+        CtfTmfTestTraceUtils.dispose(testTrace);
+    }
+
+}
index a71a3d321d20294c09e36ba503104abb4462c109..5d8404219210c052954da99190882e7b02b39fd5 100644 (file)
@@ -25,6 +25,7 @@ import org.junit.runners.Suite;
 
     org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis.kernel.KernelAnalysisBenchmark.class,
     org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis.kernel.KernelAnalysisUsageBenchmark.class,
+    org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis.syscall.SystemCallAnalysisBenchmark.class,
     org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis.tid.TidAnalysisUsageBenchmark.class,
     org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis.StatisticsAnalysisBenchmark.class,
     org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.event.matching.EventMatchingBenchmark.class,
This page took 0.029234 seconds and 5 git commands to generate.