Commit | Line | Data |
---|---|---|
8c8bf09f | 1 | /******************************************************************************* |
12c155f5 | 2 | * Copyright (c) 2009, 2011 Ericsson |
8c8bf09f ASL |
3 | * |
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 | |
8 | * | |
9 | * Contributors: | |
10 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
6c13869b | 13 | package org.eclipse.linuxtools.tmf.core.trace; |
8c8bf09f | 14 | |
12c155f5 FC |
15 | import java.io.FileNotFoundException; |
16 | ||
17 | import org.eclipse.core.resources.IProject; | |
6c13869b FC |
18 | import org.eclipse.linuxtools.tmf.core.component.ITmfComponent; |
19 | import org.eclipse.linuxtools.tmf.core.event.TmfEvent; | |
20 | import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange; | |
21 | import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp; | |
8c8bf09f ASL |
22 | |
23 | /** | |
146a887c | 24 | * <b><u>ITmfTrace</u></b> |
8c8bf09f ASL |
25 | * <p> |
26 | */ | |
12c155f5 FC |
27 | public interface ITmfTrace<T extends TmfEvent> extends ITmfComponent { |
28 | ||
29 | // initTrace variants | |
30 | public void initTrace(String path, Class<T> eventType) throws FileNotFoundException; | |
31 | ||
32 | public void initTrace(String path, Class<T> eventType, int cacheSize) throws FileNotFoundException; | |
33 | ||
34 | public void initTrace(String path, Class<T> eventType, boolean indexTrace) throws FileNotFoundException; | |
35 | ||
36 | public void initTrace(String path, Class<T> eventType, int cacheSize, boolean indexTrace) throws FileNotFoundException; | |
37 | ||
96c6806f PT |
38 | public void initTrace(String path, Class<T> eventType, int cacheSize, boolean indexTrace, String name) throws FileNotFoundException; |
39 | ||
12c155f5 FC |
40 | // Trace type validation |
41 | public boolean validate(IProject project, String path); | |
42 | ||
43 | public ITmfTrace<T> copy(); | |
b0a282fb | 44 | |
abfad0aa | 45 | /** |
12c155f5 FC |
46 | * @return the trace path |
47 | */ | |
48 | public String getPath(); | |
49 | ||
50 | /** | |
51 | * @return the trace name | |
52 | */ | |
53 | @Override | |
54 | public String getName(); | |
55 | ||
56 | /** | |
57 | * @return the cache size | |
abfad0aa FC |
58 | */ |
59 | public int getCacheSize(); | |
60 | ||
12c155f5 FC |
61 | /** |
62 | * @return the number of events in the trace | |
63 | */ | |
64 | public long getNbEvents(); | |
65 | ||
66 | /** | |
67 | * Trace time range accesses | |
68 | */ | |
69 | public TmfTimeRange getTimeRange(); | |
70 | ||
146a887c | 71 | public TmfTimestamp getStartTime(); |
12c155f5 | 72 | |
146a887c | 73 | public TmfTimestamp getEndTime(); |
62d1696a | 74 | |
1b70b6dc PT |
75 | /** |
76 | * @return the streaming interval in ms (0 if not streaming) | |
77 | */ | |
78 | public long getStreamingInterval(); | |
79 | ||
12c155f5 FC |
80 | /** |
81 | * Positions the trace at the first event with the specified timestamp or index (i.e. the nth event in the trace). | |
4e3aa37d FC |
82 | * |
83 | * Returns a context which can later be used to read the event. | |
8c8bf09f | 84 | * |
12c155f5 FC |
85 | * @param location |
86 | * @param timestamp | |
87 | * @param rank | |
8c8bf09f ASL |
88 | * @return a context object for subsequent reads |
89 | */ | |
452ad365 | 90 | public TmfContext seekLocation(ITmfLocation<?> location); |
12c155f5 | 91 | |
9f584e4c | 92 | public TmfContext seekEvent(TmfTimestamp timestamp); |
12c155f5 | 93 | |
9f584e4c | 94 | public TmfContext seekEvent(long rank); |
146a887c | 95 | |
c76c54bb FC |
96 | /** |
97 | * Positions the trace at the event located at the specified ratio. | |
98 | * | |
99 | * Returns a context which can later be used to read the event. | |
100 | * | |
12c155f5 FC |
101 | * @param ratio |
102 | * a floating-point number between 0.0 (beginning) and 1.0 (end) | |
c76c54bb FC |
103 | * @return a context object for subsequent reads |
104 | */ | |
105 | public TmfContext seekLocation(double ratio); | |
12c155f5 | 106 | |
c76c54bb FC |
107 | /** |
108 | * Returns the ratio corresponding to the specified location. | |
109 | * | |
12c155f5 FC |
110 | * @param location |
111 | * a trace location | |
c76c54bb FC |
112 | * @return a floating-point number between 0.0 (beginning) and 1.0 (end) |
113 | */ | |
114 | public double getLocationRatio(ITmfLocation<?> location); | |
12c155f5 | 115 | |
c76c54bb FC |
116 | public ITmfLocation<?> getCurrentLocation(); |
117 | ||
abfad0aa | 118 | /** |
12c155f5 FC |
119 | * Returns the rank of the first event with the requested timestamp. If none, returns the index of the next event |
120 | * (if any). | |
121 | * | |
abfad0aa FC |
122 | * @param timestamp |
123 | * @return | |
124 | */ | |
125 | public long getRank(TmfTimestamp timestamp); | |
12c155f5 | 126 | |
146a887c | 127 | /** |
12c155f5 FC |
128 | * Return the event pointed by the supplied context (or null if no event left) and updates the context to the next |
129 | * event. | |
8c8bf09f ASL |
130 | * |
131 | * @return the next event in the stream | |
132 | */ | |
9f584e4c | 133 | public TmfEvent getNextEvent(TmfContext context); |
62d1696a | 134 | |
e31e01e8 | 135 | /** |
12c155f5 | 136 | * Return the event pointed by the supplied context (or null if no event left) and *does not* update the context. |
e31e01e8 FC |
137 | * |
138 | * @return the next event in the stream | |
139 | */ | |
9f584e4c | 140 | public TmfEvent parseEvent(TmfContext context); |
e31e01e8 | 141 | |
8c8bf09f | 142 | } |