Commit | Line | Data |
---|---|---|
efc403bb AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2012 Ericsson | |
3 | * Copyright (c) 2010, 2011 École Polytechnique de Montréal | |
4 | * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com> | |
5 | * | |
6 | * All rights reserved. This program and the accompanying materials are | |
7 | * made available under the terms of the Eclipse Public License v1.0 which | |
8 | * accompanies this distribution, and is available at | |
9 | * http://www.eclipse.org/legal/epl-v10.html | |
10 | * | |
11 | *******************************************************************************/ | |
12 | ||
fd6d173c | 13 | package org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider; |
efc403bb AM |
14 | |
15 | import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator; | |
16 | import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent; | |
17 | import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace; | |
18 | import org.eclipse.linuxtools.tmf.core.statesystem.StateSystem; | |
19 | import org.eclipse.linuxtools.tmf.core.statesystem.helpers.IStateChangeInput; | |
20 | ||
21 | /** | |
22 | * "Dummy" version of the CTF event input plugin. This one only reads events | |
23 | * (and creates the Event/EventWrapper objects) but discards them instead of | |
24 | * inserting them in the Queue. | |
25 | * | |
26 | * Only useful for benchmarking purposes. | |
27 | * | |
28 | * @author alexmont | |
29 | * | |
30 | */ | |
dc0f7bfe | 31 | public class CtfDummyInput implements IStateChangeInput { |
efc403bb AM |
32 | |
33 | private final CtfIterator iterator; | |
34 | ||
35 | /** | |
36 | * Create a new dummy CTF state change input. | |
37 | * | |
38 | * @param traceFile | |
39 | * The CTF trace to read from (can be any type of CTF trace) | |
40 | */ | |
dc0f7bfe | 41 | public CtfDummyInput(CtfTmfTrace trace) { |
efc403bb AM |
42 | this.iterator = new CtfIterator(trace); |
43 | ||
44 | } | |
45 | ||
46 | @SuppressWarnings("unused") | |
47 | @Override | |
48 | public void run() { | |
49 | /* We know currentEvent is unused here, it's by design! */ | |
50 | CtfTmfEvent currentEvent; | |
51 | currentEvent = iterator.getCurrentEvent(); | |
52 | while (iterator.advance()) { | |
53 | currentEvent = iterator.getCurrentEvent(); | |
54 | } | |
55 | } | |
56 | ||
57 | @Override | |
58 | public long getStartTime() { | |
59 | return iterator.getLocation().getLocation(); | |
60 | } | |
61 | ||
62 | /** | |
63 | * This dummy input does not insert any state changes anywhere, so this | |
64 | * method does nothing. | |
65 | */ | |
66 | @Override | |
67 | public void assignTargetStateSystem(StateSystem ss) { | |
68 | // | |
69 | } | |
70 | ||
71 | /** | |
72 | * Since there is no target state system in the dummy input, this always | |
73 | * returns null. | |
74 | */ | |
75 | @Override | |
76 | public StateSystem getStateSystem() { | |
77 | return null; | |
78 | } | |
79 | ||
80 | } |