1 package org
.eclipse
.linuxtools
.lttng
.core
.tests
.headless
;
2 /*******************************************************************************
3 * Copyright (c) 2009 Ericsson
5 * All rights reserved. This program and the accompanying materials are
6 * made available under the terms of the Eclipse Public License v1.0 which
7 * accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
11 * William Bourque (wbourque@gmail.com) - Initial API and implementation
12 *******************************************************************************/
14 import java
.util
.ArrayList
;
16 import org
.eclipse
.linuxtools
.internal
.lttng
.jni
.common
.JniTime
;
17 import org
.eclipse
.linuxtools
.lttng
.jni
.JniEvent
;
18 import org
.eclipse
.linuxtools
.lttng
.jni
.JniMarkerField
;
19 import org
.eclipse
.linuxtools
.lttng
.jni
.JniTrace
;
20 import org
.eclipse
.linuxtools
.lttng
.jni
.factory
.JniTraceFactory
;
23 @SuppressWarnings("nls")
24 public class JniTraceTest
{
26 public static void main(String
[] args
) {
29 final String TRACE_PATH
= "/home/william/trace-614601events-nolost-newformat";
31 // *** Change this to run several time over the same trace
32 final int NB_OF_PASS
= 1;
34 // *** Change this to true to parse all the events in the trace
35 // Otherwise, events are just read
36 final boolean PARSE_EVENTS
= true;
40 JniTrace tmptrace
= null;
41 JniEvent tmpevent
= null;
45 // Get the trace from the Factory...
46 // This assume the path is correct and that the correct version of the lib is installed
47 tmptrace
= JniTraceFactory
.getJniTrace(TRACE_PATH
, null, false);
50 tmptrace
.seekToTime(new JniTime(0L));
52 // Run up to "NB_OF_PASS" on the same trace
53 for (int x
=0; x
<NB_OF_PASS
; x
++ ){
54 tmpevent
= tmptrace
.readNextEvent();
57 while ( tmpevent
!= null ) {
59 // Parse event if asked
61 ArrayList
<JniMarkerField
> tmpFields
= tmpevent
.getMarkersMap().get(tmpevent
.getEventMarkerId()).getMarkerFieldsArrayList();
62 for ( int pos
=0; pos
<tmpFields
.size(); pos
++ ) {
63 @SuppressWarnings("unused")
64 Object newValue
= tmpevent
.parseFieldById(pos
);
66 // *** Uncomment the following to print the parsed content
67 // Warning : this is VERY intensive
68 //if ( pos == (tmpFields.size() -1) ) {
69 // tmptrace.printC(tmpevent.getEventPtr().getLibraryId(), tmpFields.get(pos).getField() + ":" + newValue + " ");
71 // tmptrace.printlnC(tmpevent.getEventPtr().getLibraryId(), tmpFields.get(pos).getField() + ":" + newValue + " ");
76 tmpevent
= tmptrace
.readNextEvent();
81 System
.out
.println("NB Events read : " + nbEvent
);
This page took 0.03281 seconds and 5 git commands to generate.