ctf: Add a benchmark trace enum
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Mon, 27 Feb 2017 15:44:02 +0000 (10:44 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Mon, 1 May 2017 12:55:53 +0000 (08:55 -0400)
And add a first trace to be used for benchmarks. These traces are too
big to be added to the test traces repo, so they should be optional
resources to download to run some benchmarks on.

Change-Id: Icba00c9a49fb81d9ed86485dc7e2d9890655c0e4
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/91917
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
ctf/org.eclipse.tracecompass.ctf.core.tests/shared/org/eclipse/tracecompass/ctf/core/tests/shared/CtfBenchmarkTrace.java [new file with mode: 0644]
ctf/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/CtfCoreTestPlugin.java
ctf/org.eclipse.tracecompass.ctf.core.tests/traces/get-traces.xml

diff --git a/ctf/org.eclipse.tracecompass.ctf.core.tests/shared/org/eclipse/tracecompass/ctf/core/tests/shared/CtfBenchmarkTrace.java b/ctf/org.eclipse.tracecompass.ctf.core.tests/shared/org/eclipse/tracecompass/ctf/core/tests/shared/CtfBenchmarkTrace.java
new file mode 100644 (file)
index 0000000..46e331d
--- /dev/null
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2017 É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.ctf.core.tests.shared;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.tests.CtfCoreTestPlugin;
+import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
+
+/**
+ * List of test traces larger than the ones provided by {@link CtfTestTrace}, to
+ * be used for benchmarks that require CTF traces.
+ *
+ * @author Geneviève Bastien
+ */
+public enum CtfBenchmarkTrace {
+
+    /**
+     * Kernel trace that contains all the events necessary to run all the
+     * analyses available as of Trace Compass 2.3
+     *
+     * Trivia: This trace traced the startup of Trace Compass from the Eclipse
+     * IDE
+     *
+     * <pre>
+     * Trace Size: 149 MB
+     * Tracer: lttng-modules 2.9
+     * Kernel version: 4.9.6-1
+     * Event count: 5 065 710
+     * Trace length: ~31 s
+     * </pre>
+     */
+    ALL_OS_ANALYSES("/os-events");
+
+    private static final @NonNull String TRACE_PATH = "traces";
+    private final String fTraceName;
+
+    private CtfBenchmarkTrace(String traceName) {
+        fTraceName = traceName;
+    }
+
+    /**
+     * Get the URL for this trace
+     *
+     * @return The path for this trace
+     */
+    public IPath getTraceURL() {
+        IPath url = CtfCoreTestPlugin.getAbsolutePath(new Path(TRACE_PATH + fTraceName));
+        if (url == null) {
+            /* Project configuration problem? */
+            throw new IllegalStateException("Test trace not found");
+        }
+        return url;
+    }
+
+}
index fcd0b0bd62479d0ef05f1bec25a006f842ea5c58..12c9e01d01429b6807d658d36126b5304318c564 100644 (file)
 package org.eclipse.tracecompass.ctf.core.tests;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.URISyntaxException;
+import java.net.URL;
 
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Plugin;
 import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.internal.ctf.core.Activator;
 import org.osgi.framework.BundleContext;
 
@@ -106,4 +112,29 @@ public class CtfCoreTestPlugin extends Plugin {
         }
         return System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
     }
+
+    /**
+     * Gets the absolute path from a path relative to this plugin's root
+     *
+     * @param relativePath
+     *            The path relative to this plugin
+     * @return The absolute path corresponding to this relative path
+     */
+    public static @Nullable IPath getAbsolutePath(Path relativePath) {
+        CtfCoreTestPlugin plugin2 = getDefault();
+        if (plugin2 == null) {
+            /*
+             * Shouldn't happen but at least throw something to get the test to
+             * fail early
+             */
+            throw new IllegalStateException();
+        }
+        URL location = FileLocator.find(plugin2.getBundle(), relativePath, null);
+        try {
+            IPath path = new Path(FileLocator.toFileURL(location).getPath());
+            return path;
+        } catch (IOException e) {
+            return null;
+        }
+    }
 }
index 0ff205a39e0c2cfa1aa48d555f1373c80930f684..c9db9d0fbb2afcaed451d867504ae5fb3c6f3e2f 100644 (file)
@@ -73,6 +73,7 @@
 <target name="downloadTraceFiles">
   <echo message="Attempting to download test traces"/>
   <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="synctraces.tar.gz" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/synctraces.tar.gz" />
+  <get ignoreerrors="true" maxtime="120" skipexisting="true" dest="os-events.tar.gz" src="http://archive.eclipse.org/tracecompass/test-traces/os-events.tar.gz" />
 </target>
 
 <target name="pullTestSuite" if="testSuiteExists">
     </antcall>
     <gunzip src="synctraces.tar.gz" />
     <untar src="synctraces.tar" dest="." />
+    <gunzip src="os-events.tar.gz" />
+    <untar src="os-events.tar" dest="." />
 
     <echo message="Traces extracted successfully"/>
 </target>
This page took 0.026323 seconds and 5 git commands to generate.