Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeneviève Bastien2014-08-29 19:47:33 +0000
committerGenevieve Bastien2014-09-02 17:19:47 +0000
commit2f77929bf91420442f3b4a3ed335f36ef889da2d (patch)
tree5bbe1f9655909a2c54f2ce8b1a4af4a6481168b8
parent606c86ecca324e7d319bb51aae963171170803a7 (diff)
downloadorg.eclipse.linuxtools-2f77929bf91420442f3b4a3ed335f36ef889da2d.tar.gz
org.eclipse.linuxtools-2f77929bf91420442f3b4a3ed335f36ef889da2d.tar.xz
org.eclipse.linuxtools-2f77929bf91420442f3b4a3ed335f36ef889da2d.zip
TMF: Add benchmarks for timestamp transforms
Change-Id: I4b1e2c220473f1c9b7eba5002cbcdbfe4e5c56d8 Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net> Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com> Reviewed-on: https://git.eclipse.org/r/32575 Tested-by: Hudson CI Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.alltests/src/org/eclipse/linuxtools/lttng/alltests/RunAllPerfTests.java1
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/.classpath1
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/META-INF/MANIFEST.MF4
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/build.properties3
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/perf/org/eclipse/linuxtools/tmf/core/tests/perf/AllPerfTests.java31
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/perf/org/eclipse/linuxtools/tmf/core/tests/perf/synchronization/AllPerfTests.java29
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/perf/org/eclipse/linuxtools/tmf/core/tests/perf/synchronization/TimestampTransformBenchmark.java78
7 files changed, 145 insertions, 2 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng.alltests/src/org/eclipse/linuxtools/lttng/alltests/RunAllPerfTests.java b/lttng/org.eclipse.linuxtools.lttng.alltests/src/org/eclipse/linuxtools/lttng/alltests/RunAllPerfTests.java
index 2d9b4bb85f..70dd3c4963 100644
--- a/lttng/org.eclipse.linuxtools.lttng.alltests/src/org/eclipse/linuxtools/lttng/alltests/RunAllPerfTests.java
+++ b/lttng/org.eclipse.linuxtools.lttng.alltests/src/org/eclipse/linuxtools/lttng/alltests/RunAllPerfTests.java
@@ -23,6 +23,7 @@ import org.junit.runners.Suite;
org.eclipse.linuxtools.ctf.core.tests.perf.AllPerfTests.class,
org.eclipse.linuxtools.lttng2.kernel.core.tests.perf.AllPerfTests.class,
org.eclipse.linuxtools.pcap.core.tests.perf.AllPerfTests.class,
+ org.eclipse.linuxtools.tmf.core.tests.perf.AllPerfTests.class,
org.eclipse.linuxtools.tmf.ctf.core.tests.perf.AllPerfTests.class
})
public class RunAllPerfTests {
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/.classpath b/lttng/org.eclipse.linuxtools.tmf.core.tests/.classpath
index 9bacd0f47a..f2804a9f0d 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core.tests/.classpath
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/.classpath
@@ -5,5 +5,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="stubs"/>
<classpathentry kind="src" path="shared"/>
+ <classpathentry kind="src" path="perf"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/META-INF/MANIFEST.MF b/lttng/org.eclipse.linuxtools.tmf.core.tests/META-INF/MANIFEST.MF
index 39850b9a5b..aed1ba1cf1 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core.tests/META-INF/MANIFEST.MF
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/META-INF/MANIFEST.MF
@@ -11,8 +11,10 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.junit;bundle-version="4.0.0",
org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.test.performance
Export-Package: org.eclipse.linuxtools.tmf.core.tests,
+ org.eclipse.linuxtools.tmf.core.tests.perf,
org.eclipse.linuxtools.tmf.core.tests.shared,
org.eclipse.linuxtools.tmf.tests.stubs.trace
Import-Package: com.google.common.collect
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/build.properties b/lttng/org.eclipse.linuxtools.tmf.core.tests/build.properties
index 594953dae6..10715adf74 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core.tests/build.properties
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/build.properties
@@ -12,7 +12,8 @@
source.. = stubs/,\
shared/,\
- src/
+ src/,\
+ perf/
output.. = bin/
bin.includes = META-INF/,\
.,\
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/perf/org/eclipse/linuxtools/tmf/core/tests/perf/AllPerfTests.java b/lttng/org.eclipse.linuxtools.tmf.core.tests/perf/org/eclipse/linuxtools/tmf/core/tests/perf/AllPerfTests.java
new file mode 100644
index 0000000000..f1d50f1389
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/perf/org/eclipse/linuxtools/tmf/core/tests/perf/AllPerfTests.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2014 É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
+ *
+ * Contributors:
+ * Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.perf;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * The class <code>AllPerformanceTests</code> builds a suite that can be used to
+ * run all of the performance tests within its package as well as within any
+ * subpackages of its package.
+ *
+ * @author Geneviève Bastien
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ org.eclipse.linuxtools.tmf.core.tests.perf.synchronization.AllPerfTests.class
+})
+public class AllPerfTests {
+
+}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/perf/org/eclipse/linuxtools/tmf/core/tests/perf/synchronization/AllPerfTests.java b/lttng/org.eclipse.linuxtools.tmf.core.tests/perf/org/eclipse/linuxtools/tmf/core/tests/perf/synchronization/AllPerfTests.java
new file mode 100644
index 0000000000..3d9971f6b6
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/perf/org/eclipse/linuxtools/tmf/core/tests/perf/synchronization/AllPerfTests.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2014 É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
+ *
+ * Contributors:
+ * Geneviève Bastien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.perf.synchronization;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Performance tests for the synchronization classes
+ *
+ * @author Geneviève Bastien
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ TimestampTransformBenchmark.class
+})
+public class AllPerfTests {
+
+}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/perf/org/eclipse/linuxtools/tmf/core/tests/perf/synchronization/TimestampTransformBenchmark.java b/lttng/org.eclipse.linuxtools.tmf.core.tests/perf/org/eclipse/linuxtools/tmf/core/tests/perf/synchronization/TimestampTransformBenchmark.java
new file mode 100644
index 0000000000..d3dc0677fe
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/perf/org/eclipse/linuxtools/tmf/core/tests/perf/synchronization/TimestampTransformBenchmark.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2014 É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
+ *
+ * Contributors:
+ * Francis Giraldeau - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.perf.synchronization;
+
+import org.eclipse.linuxtools.tmf.core.synchronization.ITmfTimestampTransform;
+import org.eclipse.linuxtools.tmf.core.synchronization.TimestampTransformFactory;
+import org.eclipse.test.performance.Dimension;
+import org.eclipse.test.performance.Performance;
+import org.eclipse.test.performance.PerformanceMeter;
+import org.junit.Test;
+
+/**
+ * Test the performance of linear transforms classes
+ *
+ * @author Francis Giraldeau
+ */
+public class TimestampTransformBenchmark {
+
+ private static final String TEST_ID = "org.eclipse.linuxtools#Trace synchronization#";
+ private static final String TEST_SUMMARY = "Timestamp Transform: ";
+
+ /** Number of transformations done for each transform: 50 millions */
+ private static final long NB_TRANSFORMATIONS = 50000000L;
+
+ /**
+ * Test the timestamp transform performances
+ */
+ @Test
+ public void testTimestampTransformPerformance() {
+ ITmfTimestampTransform transform = TimestampTransformFactory.getDefaultTransform();
+ doTimestampTransformRun("Identity transform", transform, 10);
+
+ transform = TimestampTransformFactory.createWithOffset(123456789);
+ doTimestampTransformRun("Transform with offset", transform, 10);
+
+ transform = TimestampTransformFactory.createLinear(Math.PI, 1234);
+ doTimestampTransformRun("Linear transform", transform, 5);
+
+ transform = TimestampTransformFactory.createLinear(10000.1234545565635, -4312278758437L);
+ doTimestampTransformRun("Linear transform with larger slope and negative offset", transform, 5);
+ }
+
+ private static void doTimestampTransformRun(String testName, ITmfTimestampTransform xform, long loopCount) {
+ Performance perf = Performance.getDefault();
+ PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + testName);
+ perf.tagAsSummary(pm, TEST_SUMMARY + testName, Dimension.CPU_TIME);
+
+ for (int x = 0; x < loopCount; x++) {
+ /**
+ * We use timestamps with values in the order of 10^18, which about
+ * corresponds to timestamps in nanoseconds since epoch
+ */
+ long time = (long) Math.pow(10, 18);
+ pm.start();
+ /**
+ * Apply the timestamp transform NB_TRANSFORMATIONS times, with
+ * timestamps incremented by 200 each time
+ */
+ for (long i = 0; i < NB_TRANSFORMATIONS; i++) {
+ xform.transform(time);
+ time += 200;
+ }
+ pm.stop();
+ }
+ pm.commit();
+ }
+
+}

Back to the top