Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Khouzam2012-07-12 13:59:41 +0000
committerMatthew Khouzam2012-11-16 19:46:11 +0000
commit8908e8d6d617926cd4ae7f740f9c4d0cf6baa79a (patch)
tree3a0a794abe39664ccfaa61643cd025e67311b36c
parent124ed86e5ed1693e005a2ed61c3920a47327801d (diff)
downloadorg.eclipse.linuxtools-8908e8d6d617926cd4ae7f740f9c4d0cf6baa79a.tar.gz
org.eclipse.linuxtools-8908e8d6d617926cd4ae7f740f9c4d0cf6baa79a.tar.xz
org.eclipse.linuxtools-8908e8d6d617926cd4ae7f740f9c4d0cf6baa79a.zip
Fix benchmark to use ctftmflightweightcontexts
Change-Id: I64ff93f6564aec865370d4f166f7dcadf58a3295 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Reviewed-on: https://git.eclipse.org/r/6769 Tested-by: Hudson CI Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> IP-Clean: Patrick Tasse <patrick.tasse@gmail.com> Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java29
1 files changed, 8 insertions, 21 deletions
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 7c92ca4d09..dca3716795 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
@@ -14,8 +14,8 @@ package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor.headless;
import java.util.Vector;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfLightweightContext;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
@@ -38,11 +38,6 @@ public class Benchmark {
// Change this to enable text output
final boolean USE_TEXT = true;
-// try {
-// System.in.read();
-// } catch (final IOException e1) {
-// e1.printStackTrace();
-// }
// Work variables
Long nbEvent = 0L;
final Vector<Double> benchs = new Vector<Double>();
@@ -60,7 +55,7 @@ public class Benchmark {
start = System.nanoTime();
if (nbEvent != -1) {
- final CtfIterator traceReader = (CtfIterator) trace.seekEvent(0);
+ final CtfTmfLightweightContext traceReader = (CtfTmfLightweightContext) trace.seekEvent(0);
start = System.nanoTime();
CtfTmfEvent current = traceReader.getCurrentEvent();
@@ -68,11 +63,15 @@ public class Benchmark {
nbEvent++;
if (USE_TEXT) {
- System.out.println("Event " + traceReader.getRank() + " Time " //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println("Event " + nbEvent + " Time " //$NON-NLS-1$ //$NON-NLS-2$
+ current.getTimestamp().toString() + " type " + current.getEventName() //$NON-NLS-1$
+ " on CPU " + current.getSource() + " " + current.getContent().toString()) ; //$NON-NLS-1$ //$NON-NLS-2$
}
- traceReader.advance();
+ // advance the trace to the next event.
+ boolean hasMore = traceReader.advance();
+ if( hasMore ){
+ // you can know the trace has more events.
+ }
current = traceReader.getCurrentEvent();
}
}
@@ -95,16 +94,4 @@ public class Benchmark {
}
-// /**
-// * @param timestamp
-// * the timestamp in UTC to convert to nanoseconds.
-// * @return formatted string.
-// */
-// private static String formatDate(final long timestamp) {
-// final Date d = new Date(timestamp / 1000000);
-// final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss."); //$NON-NLS-1$
-// final String output = df.format(d) + (timestamp % 1000000000);
-// return output;
-// }
-
}

Back to the top