+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * 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:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
-
-import java.util.ArrayList;
-import org.eclipse.linuxtools.lttng.jni.JniEvent;
-import org.eclipse.linuxtools.lttng.jni.JniMarkerField;
-import org.eclipse.linuxtools.lttng.jni.JniTrace;
-import org.eclipse.linuxtools.lttng.jni.common.JniTime;
-import org.eclipse.linuxtools.lttng.jni.factory.JniTraceFactory;
-
-
-@SuppressWarnings("nls")
-public class JniTraceTest {
-
- public static void main(String[] args) {
-
- // Path of the trace
- final String TRACE_PATH = "/home/william/trace-614601events-nolost-newformat";
-
- // *** Change this to run several time over the same trace
- final int NB_OF_PASS = 1;
-
- // *** Change this to true to parse all the events in the trace
- // Otherwise, events are just read
- final boolean PARSE_EVENTS = true;
-
-
- // Work variables
- JniTrace tmptrace = null;
- JniEvent tmpevent = null;
- Long nbEvent = 0L;
-
- try {
- // Get the trace from the Factory...
- // This assume the path is correct and that the correct version of the lib is installed
- tmptrace = JniTraceFactory.getJniTrace(TRACE_PATH, false);
-
- // Seek beginning
- tmptrace.seekToTime(new JniTime(0L));
-
- // Run up to "NB_OF_PASS" on the same trace
- for (int x=0; x<NB_OF_PASS; x++ ){
- tmpevent = tmptrace.readNextEvent();
- nbEvent++;
-
- while ( tmpevent != null ) {
-
- // Parse event if asked
- if ( PARSE_EVENTS ) {
- ArrayList<JniMarkerField> tmpFields = tmpevent.getMarkersMap().get(tmpevent.getEventMarkerId()).getMarkerFieldsArrayList();
- for ( int pos=0; pos<tmpFields.size(); pos++ ) {
- @SuppressWarnings("unused")
- Object newValue = tmpevent.parseFieldById(pos);
-
- // *** Uncomment the following to print the parsed content
- // Warning : this is VERY intensive
- //if ( pos == (tmpFields.size() -1) ) {
- // tmptrace.printC(tmpevent.getEventPtr().getLibraryId(), tmpFields.get(pos).getField() + ":" + newValue + " ");
- //} else {
- // tmptrace.printlnC(tmpevent.getEventPtr().getLibraryId(), tmpFields.get(pos).getField() + ":" + newValue + " ");
- //}
- }
- }
-
- tmpevent = tmptrace.readNextEvent();
- nbEvent++;
- }
- }
-
- System.out.println("NB Events read : " + nbEvent);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * 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:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
-
-import org.eclipse.linuxtools.lttng.event.LttngEvent;
-import org.eclipse.linuxtools.lttng.event.LttngLocation;
-import org.eclipse.linuxtools.lttng.event.LttngTimestamp;
-import org.eclipse.linuxtools.lttng.trace.LTTngTextTrace;
-import org.eclipse.linuxtools.lttng.trace.LTTngTrace;
-import org.eclipse.linuxtools.tmf.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.trace.TmfTrace;
-
-
-@SuppressWarnings("nls")
-public class LttngTraceTest {
-
- /**
- * @param args
- */
- public static void main(String[] args) {
-
- // Path of the trace
- final String TRACE_PATH = "/home/francois/Desktop/Workspaces/LTTngTraces/trace_2GB";
-
- // *** Change to true to use the "fake" LttngTextTrace instead of LTTngTrace
- // To use this, you need a ".txt" trace.
- // You can get it using LTTv with the command "lttv -m textDump -t /tmp/sometrace > mytrace.txt"
- final boolean USE_TEXT_TRACE = false;
-
- // *** Change this to run several time over the same trace
- final int NB_OF_PASS = 1;
-
- // *** Change this to true to parse all the events in the trace
- // Otherwise, events are just read
- final boolean PARSE_EVENTS = true;
-
-
- // Work variables
- TmfTrace<LttngEvent> tmptrace = null;
- LttngEvent tmpevent = null;
- TmfContext tmpContext = null;
- Long nbEvent = 0L;
-
- try {
- // ** Use TextTrace (slow!) if it was asked
- if ( USE_TEXT_TRACE ) {
- tmptrace = new LTTngTextTrace(TRACE_PATH, true);
- } else {
- tmptrace = new LTTngTrace(TRACE_PATH, true, true);
- }
-
- LttngTimestamp tmpTime = new LttngTimestamp(0L);
- tmpContext = new TmfContext(new LttngLocation(0L), 0);
-
-
- long startTime = System.nanoTime();
- System.out.println("Start: " + startTime);
- for ( int nb=0; nb<NB_OF_PASS; nb++) {
-
- // Seek to the beginning of the trace
- tmpContext = tmptrace.seekEvent( tmpTime );
- tmpevent = (LttngEvent)tmptrace.getNextEvent(tmpContext);
-
- while ( tmpevent != null ) {
- tmpevent = (LttngEvent)tmptrace.getNextEvent(tmpContext);
-
- // Parse the events if it was asked
- if ( (tmpevent != null) && (PARSE_EVENTS) ) {
- tmpevent.getContent().getFields();
-
- // *** Uncomment the following to print the parsed content
- // Warning : this is VERY intensive
- //
-// System.out.println(tmpevent.toString());
- //System.out.println(testEvent.getContent().toString());
- }
-
- nbEvent++;
- }
- }
-
- System.out.println("NB events : " + nbEvent);
-
- long endTime = System.nanoTime();
- long elapsed = endTime - startTime;
- System.out.println("End: " + endTime);
- System.out.println("Elapsed: " + elapsed + ", Average: " + (elapsed/nbEvent) + "ns/evt");
-
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * 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:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
-
-import org.eclipse.linuxtools.lttng.event.LttngEvent;
-import org.eclipse.linuxtools.lttng.event.LttngTimestamp;
-import org.eclipse.linuxtools.lttng.trace.LTTngTrace;
-import org.eclipse.linuxtools.tmf.event.TmfEvent;
-import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.experiment.TmfExperiment;
-import org.eclipse.linuxtools.tmf.request.TmfEventRequest;
-import org.eclipse.linuxtools.tmf.trace.ITmfTrace;
-
-@SuppressWarnings("nls")
-public class TmfTraceTest extends TmfEventRequest<LttngEvent> {
-
- @SuppressWarnings("unchecked")
- public TmfTraceTest(Class<? extends TmfEvent> dataType, TmfTimeRange range, int nbRequested) {
- super((Class<LttngEvent>)dataType, range, nbRequested, 1);
- }
-
-
- // Path of the trace
- public static final String TRACE_PATH = "/home/william/trace-614601events-nolost-newformat";
-
- // *** Change this to run several time over the same trace
- public static final int NB_OF_PASS = 1;
-
- // *** Change this to true to parse all the events in the trace
- // Otherwise, events are just read
- public final boolean PARSE_EVENTS = true;
-
-
- // Work variables
- public static int nbEvent = 0;
- public static int nbPassDone = 0;
- public static TmfExperiment<LttngEvent> fExperiment = null;
-
-
- public static void main(String[] args) {
-
- try {
- // OUr experiment will contains ONE trace
- ITmfTrace[] traces = new ITmfTrace[1];
- traces[0] = new LTTngTrace(TRACE_PATH);
- // Create our new experiment
- fExperiment = new TmfExperiment<LttngEvent>(LttngEvent.class, "Headless", traces);
-
-
- // Create a new time range from -infinity to +infinity
- // That way, we will get "everything" in the trace
- LttngTimestamp ts1 = new LttngTimestamp(Long.MIN_VALUE);
- LttngTimestamp ts2 = new LttngTimestamp(Long.MAX_VALUE);
- TmfTimeRange tmpRange = new TmfTimeRange(ts1, ts2);
-
-
- // We will issue a request for each "pass".
- // TMF will then process them synchonously
- TmfTraceTest request = null;
- for ( int x=0; x<NB_OF_PASS; x++ ) {
- request = new TmfTraceTest(LttngEvent.class, tmpRange, Integer.MAX_VALUE );
- fExperiment.sendRequest(request);
- nbPassDone++;
- }
- }
- catch (NullPointerException e) {
- // Silently dismiss Null pointer exception
- // The only way to "finish" the threads in TMF is by crashing them with null
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- @Override
- public void handleData(LttngEvent event) {
- super.handleData(event);
- if ( (event != null) && (PARSE_EVENTS) ) {
- ((LttngEvent) event).getContent().getFields();
-
- // *** Uncomment the following to print the parsed content
- // Warning : this is VERY intensive
- //
- //System.out.println((LttngEvent)evt[0]);
- //System.out.println(((LttngEvent)evt[0]).getContent());
-
- nbEvent++;
- }
- }
-
- @Override
- public void handleCompleted() {
- if ( nbPassDone >= NB_OF_PASS ) {
- try {
- System.out.println("Nb events : " + nbEvent);
-
- fExperiment.sendRequest(null);
- }
- catch (Exception e) {}
- }
- }
-
- @Override
- public void handleSuccess() {
- }
-
- @Override
- public void handleFailure() {
- }
-
- @Override
- public void handleCancel() {
- }
-
-}
+2010-11-10 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxxtools/lttng/tests/headless/JniTraceTest.java: New file.
+ * src/org/eclipse/linuxxtools/lttng/tests/headless/LttngTraceTest.java: New file.
+ * src/org/eclipse/linuxxtools/lttng/tests/headless/TmfTraceTest.java: New file.
+
2010-11-09 Francois Chouinard <fchouinard@gmail.com>
Suppress warning for non-externalized strings
--- /dev/null
+package org.eclipse.linuxxtools.lttng.tests.headless;
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ *
+ * 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:
+ * William Bourque (wbourque@gmail.com) - Initial API and implementation
+ *******************************************************************************/
+
+import java.util.ArrayList;
+import org.eclipse.linuxtools.lttng.jni.JniEvent;
+import org.eclipse.linuxtools.lttng.jni.JniMarkerField;
+import org.eclipse.linuxtools.lttng.jni.JniTrace;
+import org.eclipse.linuxtools.lttng.jni.common.JniTime;
+import org.eclipse.linuxtools.lttng.jni.factory.JniTraceFactory;
+
+
+@SuppressWarnings("nls")
+public class JniTraceTest {
+
+ public static void main(String[] args) {
+
+ // Path of the trace
+ final String TRACE_PATH = "/home/william/trace-614601events-nolost-newformat";
+
+ // *** Change this to run several time over the same trace
+ final int NB_OF_PASS = 1;
+
+ // *** Change this to true to parse all the events in the trace
+ // Otherwise, events are just read
+ final boolean PARSE_EVENTS = true;
+
+
+ // Work variables
+ JniTrace tmptrace = null;
+ JniEvent tmpevent = null;
+ Long nbEvent = 0L;
+
+ try {
+ // Get the trace from the Factory...
+ // This assume the path is correct and that the correct version of the lib is installed
+ tmptrace = JniTraceFactory.getJniTrace(TRACE_PATH, false);
+
+ // Seek beginning
+ tmptrace.seekToTime(new JniTime(0L));
+
+ // Run up to "NB_OF_PASS" on the same trace
+ for (int x=0; x<NB_OF_PASS; x++ ){
+ tmpevent = tmptrace.readNextEvent();
+ nbEvent++;
+
+ while ( tmpevent != null ) {
+
+ // Parse event if asked
+ if ( PARSE_EVENTS ) {
+ ArrayList<JniMarkerField> tmpFields = tmpevent.getMarkersMap().get(tmpevent.getEventMarkerId()).getMarkerFieldsArrayList();
+ for ( int pos=0; pos<tmpFields.size(); pos++ ) {
+ @SuppressWarnings("unused")
+ Object newValue = tmpevent.parseFieldById(pos);
+
+ // *** Uncomment the following to print the parsed content
+ // Warning : this is VERY intensive
+ //if ( pos == (tmpFields.size() -1) ) {
+ // tmptrace.printC(tmpevent.getEventPtr().getLibraryId(), tmpFields.get(pos).getField() + ":" + newValue + " ");
+ //} else {
+ // tmptrace.printlnC(tmpevent.getEventPtr().getLibraryId(), tmpFields.get(pos).getField() + ":" + newValue + " ");
+ //}
+ }
+ }
+
+ tmpevent = tmptrace.readNextEvent();
+ nbEvent++;
+ }
+ }
+
+ System.out.println("NB Events read : " + nbEvent);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
--- /dev/null
+package org.eclipse.linuxxtools.lttng.tests.headless;
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ *
+ * 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:
+ * William Bourque (wbourque@gmail.com) - Initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.linuxtools.lttng.event.LttngEvent;
+import org.eclipse.linuxtools.lttng.event.LttngLocation;
+import org.eclipse.linuxtools.lttng.event.LttngTimestamp;
+import org.eclipse.linuxtools.lttng.trace.LTTngTextTrace;
+import org.eclipse.linuxtools.lttng.trace.LTTngTrace;
+import org.eclipse.linuxtools.tmf.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.trace.TmfTrace;
+
+
+@SuppressWarnings("nls")
+public class LttngTraceTest {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+ // Path of the trace
+ final String TRACE_PATH = "/home/francois/Desktop/Workspaces/LTTngTraces/trace_2GB";
+
+ // *** Change to true to use the "fake" LttngTextTrace instead of LTTngTrace
+ // To use this, you need a ".txt" trace.
+ // You can get it using LTTv with the command "lttv -m textDump -t /tmp/sometrace > mytrace.txt"
+ final boolean USE_TEXT_TRACE = false;
+
+ // *** Change this to run several time over the same trace
+ final int NB_OF_PASS = 1;
+
+ // *** Change this to true to parse all the events in the trace
+ // Otherwise, events are just read
+ final boolean PARSE_EVENTS = true;
+
+
+ // Work variables
+ TmfTrace<LttngEvent> tmptrace = null;
+ LttngEvent tmpevent = null;
+ TmfContext tmpContext = null;
+ Long nbEvent = 0L;
+
+ try {
+ // ** Use TextTrace (slow!) if it was asked
+ if ( USE_TEXT_TRACE ) {
+ tmptrace = new LTTngTextTrace(TRACE_PATH, true);
+ } else {
+ tmptrace = new LTTngTrace(TRACE_PATH, true, true);
+ }
+
+ LttngTimestamp tmpTime = new LttngTimestamp(0L);
+ tmpContext = new TmfContext(new LttngLocation(0L), 0);
+
+
+ long startTime = System.nanoTime();
+ System.out.println("Start: " + startTime);
+ for ( int nb=0; nb<NB_OF_PASS; nb++) {
+
+ // Seek to the beginning of the trace
+ tmpContext = tmptrace.seekEvent( tmpTime );
+ tmpevent = (LttngEvent)tmptrace.getNextEvent(tmpContext);
+
+ while ( tmpevent != null ) {
+ tmpevent = (LttngEvent)tmptrace.getNextEvent(tmpContext);
+
+ // Parse the events if it was asked
+ if ( (tmpevent != null) && (PARSE_EVENTS) ) {
+ tmpevent.getContent().getFields();
+
+ // *** Uncomment the following to print the parsed content
+ // Warning : this is VERY intensive
+ //
+// System.out.println(tmpevent.toString());
+ //System.out.println(testEvent.getContent().toString());
+ }
+
+ nbEvent++;
+ }
+ }
+
+ System.out.println("NB events : " + nbEvent);
+
+ long endTime = System.nanoTime();
+ long elapsed = endTime - startTime;
+ System.out.println("End: " + endTime);
+ System.out.println("Elapsed: " + elapsed + ", Average: " + (elapsed/nbEvent) + "ns/evt");
+
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+}
--- /dev/null
+package org.eclipse.linuxxtools.lttng.tests.headless;
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ *
+ * 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:
+ * William Bourque (wbourque@gmail.com) - Initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.linuxtools.lttng.event.LttngEvent;
+import org.eclipse.linuxtools.lttng.event.LttngTimestamp;
+import org.eclipse.linuxtools.lttng.trace.LTTngTrace;
+import org.eclipse.linuxtools.tmf.event.TmfEvent;
+import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.experiment.TmfExperiment;
+import org.eclipse.linuxtools.tmf.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.trace.ITmfTrace;
+
+@SuppressWarnings("nls")
+public class TmfTraceTest extends TmfEventRequest<LttngEvent> {
+
+ @SuppressWarnings("unchecked")
+ public TmfTraceTest(Class<? extends TmfEvent> dataType, TmfTimeRange range, int nbRequested) {
+ super((Class<LttngEvent>)dataType, range, nbRequested, 1);
+ }
+
+
+ // Path of the trace
+ public static final String TRACE_PATH = "/home/william/trace-614601events-nolost-newformat";
+
+ // *** Change this to run several time over the same trace
+ public static final int NB_OF_PASS = 1;
+
+ // *** Change this to true to parse all the events in the trace
+ // Otherwise, events are just read
+ public final boolean PARSE_EVENTS = true;
+
+
+ // Work variables
+ public static int nbEvent = 0;
+ public static int nbPassDone = 0;
+ public static TmfExperiment<LttngEvent> fExperiment = null;
+
+
+ public static void main(String[] args) {
+
+ try {
+ // OUr experiment will contains ONE trace
+ ITmfTrace[] traces = new ITmfTrace[1];
+ traces[0] = new LTTngTrace(TRACE_PATH);
+ // Create our new experiment
+ fExperiment = new TmfExperiment<LttngEvent>(LttngEvent.class, "Headless", traces);
+
+
+ // Create a new time range from -infinity to +infinity
+ // That way, we will get "everything" in the trace
+ LttngTimestamp ts1 = new LttngTimestamp(Long.MIN_VALUE);
+ LttngTimestamp ts2 = new LttngTimestamp(Long.MAX_VALUE);
+ TmfTimeRange tmpRange = new TmfTimeRange(ts1, ts2);
+
+
+ // We will issue a request for each "pass".
+ // TMF will then process them synchonously
+ TmfTraceTest request = null;
+ for ( int x=0; x<NB_OF_PASS; x++ ) {
+ request = new TmfTraceTest(LttngEvent.class, tmpRange, Integer.MAX_VALUE );
+ fExperiment.sendRequest(request);
+ nbPassDone++;
+ }
+ }
+ catch (NullPointerException e) {
+ // Silently dismiss Null pointer exception
+ // The only way to "finish" the threads in TMF is by crashing them with null
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ @Override
+ public void handleData(LttngEvent event) {
+ super.handleData(event);
+ if ( (event != null) && (PARSE_EVENTS) ) {
+ ((LttngEvent) event).getContent().getFields();
+
+ // *** Uncomment the following to print the parsed content
+ // Warning : this is VERY intensive
+ //
+ //System.out.println((LttngEvent)evt[0]);
+ //System.out.println(((LttngEvent)evt[0]).getContent());
+
+ nbEvent++;
+ }
+ }
+
+ @Override
+ public void handleCompleted() {
+ if ( nbPassDone >= NB_OF_PASS ) {
+ try {
+ System.out.println("Nb events : " + nbEvent);
+
+ fExperiment.sendRequest(null);
+ }
+ catch (Exception e) {}
+ }
+ }
+
+ @Override
+ public void handleSuccess() {
+ }
+
+ @Override
+ public void handleFailure() {
+ }
+
+ @Override
+ public void handleCancel() {
+ }
+
+}