Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Khouzam2012-04-10 14:27:14 +0000
committerFrancois Chouinard2012-04-16 18:20:05 +0000
commitdad5bdc62af79bbf033f289556d0d8716e66fe44 (patch)
tree082f964ad8ff0bd9bf99109987145d7801ec5304
parentf61e1b03d280a1f7b634db545c315b655d955a12 (diff)
downloadorg.eclipse.linuxtools-dad5bdc62af79bbf033f289556d0d8716e66fe44.tar.gz
org.eclipse.linuxtools-dad5bdc62af79bbf033f289556d0d8716e66fe44.tar.xz
org.eclipse.linuxtools-dad5bdc62af79bbf033f289556d0d8716e66fe44.zip
add benchmarks
Conflicts: lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/headless/ReadTrace.java
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/headless/ReadTrace.java59
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java15
2 files changed, 66 insertions, 8 deletions
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/headless/ReadTrace.java b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/headless/ReadTrace.java
index d3977e2fc5..bd13a1f90c 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/headless/ReadTrace.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/headless/ReadTrace.java
@@ -93,6 +93,65 @@ public class ReadTrace {
System.out.print(", ");
}
+ try {
+ testSeekIndex(trace);
+ } catch (CTFReaderException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ * @return
+ */
+ private static long getTimestamp(CTFTraceReader fixture) {
+ if (fixture.getCurrentEventDef() != null) {
+ return fixture.getCurrentEventDef().timestamp;
+ }
+ return Long.MIN_VALUE;
+ }
+
+ public static void testSeekIndex(CTFTrace trace) throws CTFReaderException {
+ CTFTraceReader fixture = new CTFTraceReader(trace);
+ long rank = 300000L;
+ long timeRank = 4281275394331L;
+ long nearEnd = 4287422858132L;
+ long seekTime_0;
+ long seekIndex_0 = 0;
+ long seekNext_300000 = 0;
+ long seekIndex_300000 = 0;
+ long seekTime_300000 = 0;
+ String cr = "\n"; //$NON-NLS-1$
+ fixture.seek(0);
+ for (int i = 0; i < 100; i++) {
+ fixture.advance();
+ }
+
+ fixture.seek(nearEnd);
+ /*
+ * we need to read the trace before seeking
+ */
+ fixture.seek(0);
+ seekTime_0 = getTimestamp(fixture);
+ for (int i = 0; i < rank; i++) {
+ fixture.advance();
+ }
+ seekNext_300000 = getTimestamp(fixture);
+ fixture.seek(timeRank);
+ seekTime_300000 = getTimestamp(fixture);
+ fixture.seekIndex(0);
+ seekIndex_0 = getTimestamp(fixture);
+
+ fixture.seekIndex(rank);
+ seekIndex_300000 = getTimestamp(fixture);
+ System.out.print(cr);
+ System.out.println("seek(0) " + seekTime_0 + cr + //$NON-NLS-1$
+ "seekIndex(0) " + seekIndex_0 + cr + //$NON-NLS-1$
+ "Next(300000) " + seekNext_300000 + cr + //$NON-NLS-1$
+ "seek(time(300000)) " + seekTime_300000 + cr + //$NON-NLS-1$
+ "seekIndex(300000) " + seekIndex_300000 //$NON-NLS-1$
+ );
}
/**
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java b/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java
index 84a048fd89..a5d214b0f8 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java
@@ -12,7 +12,6 @@
package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor.headless;
import java.io.FileNotFoundException;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -34,13 +33,13 @@ public class Benchmark {
// Change this to enable text output
final boolean USE_TEXT = false;
-
- try {
- System.in.read();
- } catch (IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
+//
+// try {
+// System.in.read();
+// } catch (IOException e1) {
+// // TODO Auto-generated catch block
+// e1.printStackTrace();
+// }
// Work variables
Long nbEvent = 0L;
Vector<Double> benchs = new Vector<Double>();

Back to the top