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