1 /*******************************************************************************
2 * Copyright (c) 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Matthew Khouzam - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.btf
.core
.tests
.utils
;
15 import java
.io
.IOException
;
17 import org
.eclipse
.tracecompass
.btf
.core
.trace
.BtfTrace
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.exceptions
.TmfTraceException
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfContext
;
23 * Helpers for testing the btf trace. There is a main() top run the code without
24 * eclipse (for educational purposes) and an event printer
26 * @author Matthew Khouzam
28 public class TestBtfTrace
{
35 * @throws TmfTraceException
38 public static void main(String
[] args
) throws TmfTraceException
{
39 try (BtfTrace trace
= new BtfTrace()) {
40 trace
.initTrace(null, BtfTestTrace
.BTF_TEST
.getFullPath(), null);
41 System
.out
.println(trace
.toString());
42 ITmfContext ctx
= trace
.seekEvent(0);
43 ITmfContext ctx1
= trace
.seekEvent(10);
44 ITmfEvent event
= trace
.getNext(ctx
);
45 ITmfEvent compare
= null;
46 while (event
!= null) {
47 if (event
.getRank() == 10) {
51 event
= trace
.getNext(ctx
);
53 ITmfEvent other
= trace
.getNext(ctx1
);
56 } catch (IOException e
) {
61 private static void printEvent(ITmfEvent event
) {
63 System
.out
.println("null");
65 System
.out
.println(event
.getRank() + " " + event
.getTimestamp().getValue() + " " + event
.getType().getName() + " " + event
.getContent().toString());
This page took 0.069585 seconds and 5 git commands to generate.