Improve timing in TMF UML2SD test, remove dead entry in build.properties
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / trace / ITmfTrace.java
CommitLineData
8c8bf09f 1/*******************************************************************************
8636b448 2 * Copyright (c) 2009, 2011, 2012 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
8636b448 11 * Francois Chouinard - Updated as per TMF Trace Model 1.0
8c8bf09f
ASL
12 *******************************************************************************/
13
6c13869b 14package org.eclipse.linuxtools.tmf.core.trace;
8c8bf09f 15
12c155f5
FC
16import java.io.FileNotFoundException;
17
18import org.eclipse.core.resources.IProject;
a1091415 19import org.eclipse.core.resources.IResource;
6c13869b 20import org.eclipse.linuxtools.tmf.core.component.ITmfComponent;
72f1e62a 21import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
4df4581d 22import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
6c13869b 23import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
8c8bf09f
ASL
24
25/**
146a887c 26 * <b><u>ITmfTrace</u></b>
8c8bf09f 27 * <p>
8636b448 28 * The basic event trace structure in the TMF.
8c8bf09f 29 */
72f1e62a 30public interface ITmfTrace<T extends ITmfEvent> extends ITmfComponent {
12c155f5 31
8636b448
FC
32 // ------------------------------------------------------------------------
33 // Constants
34 // ------------------------------------------------------------------------
12c155f5 35
8636b448
FC
36 // ------------------------------------------------------------------------
37 // Initializers
38 // ------------------------------------------------------------------------
12c155f5 39
8636b448
FC
40 // initTrace variants
41 public void initTrace(String name, String path, Class<T> eventType, int pageSize) throws FileNotFoundException;
12c155f5 42
8636b448 43 public void indexTrace(boolean waitForCompletion);
96c6806f 44
12c155f5
FC
45 // Trace type validation
46 public boolean validate(IProject project, String path);
47
8636b448
FC
48 // ------------------------------------------------------------------------
49 // Getters
50 // ------------------------------------------------------------------------
b0a282fb 51
abfad0aa 52 /**
12c155f5
FC
53 * @return the trace path
54 */
55 public String getPath();
56
57 /**
58 * @return the trace name
59 */
60 @Override
61 public String getName();
62
63 /**
64 * @return the cache size
abfad0aa
FC
65 */
66 public int getCacheSize();
67
12c155f5
FC
68 /**
69 * @return the number of events in the trace
70 */
71 public long getNbEvents();
72
73 /**
74 * Trace time range accesses
75 */
76 public TmfTimeRange getTimeRange();
77
4df4581d 78 public ITmfTimestamp getStartTime();
12c155f5 79
4df4581d 80 public ITmfTimestamp getEndTime();
62d1696a 81
1b70b6dc
PT
82 /**
83 * @return the streaming interval in ms (0 if not streaming)
84 */
85 public long getStreamingInterval();
86
8636b448
FC
87 // ------------------------------------------------------------------------
88 // Seek operations
89 // ------------------------------------------------------------------------
90
12c155f5
FC
91 /**
92 * Positions the trace at the first event with the specified timestamp or index (i.e. the nth event in the trace).
4e3aa37d
FC
93 *
94 * Returns a context which can later be used to read the event.
8c8bf09f 95 *
12c155f5 96 * @param location
8c8bf09f
ASL
97 * @return a context object for subsequent reads
98 */
34ccf9a9 99 public ITmfContext seekLocation(ITmfLocation<?> location);
12c155f5 100
34ccf9a9 101 public ITmfContext seekEvent(ITmfTimestamp timestamp);
12c155f5 102
34ccf9a9 103 public ITmfContext seekEvent(long rank);
146a887c 104
c76c54bb
FC
105 /**
106 * Positions the trace at the event located at the specified ratio.
107 *
108 * Returns a context which can later be used to read the event.
109 *
12c155f5
FC
110 * @param ratio
111 * a floating-point number between 0.0 (beginning) and 1.0 (end)
c76c54bb
FC
112 * @return a context object for subsequent reads
113 */
34ccf9a9 114 public ITmfContext seekLocation(double ratio);
12c155f5 115
8636b448
FC
116 // ------------------------------------------------------------------------
117 // Read operations
118 // ------------------------------------------------------------------------
119
120 /**
121 * Return the event pointed by the supplied context (or null if no event left) and updates the context to the next
122 * event.
123 *
124 * @return the next event in the stream
125 */
126 public ITmfEvent getNextEvent(ITmfContext context);
127
128 /**
129 * Return the event pointed by the supplied context (or null if no event left) and *does not* update the context.
130 *
131 * @return the next event in the stream
132 */
133 public ITmfEvent parseEvent(ITmfContext context);
134
135
136 // ------------------------------------------------------------------------
137 // misc
138 // ------------------------------------------------------------------------
139
c76c54bb
FC
140 /**
141 * Returns the ratio corresponding to the specified location.
142 *
12c155f5
FC
143 * @param location
144 * a trace location
c76c54bb
FC
145 * @return a floating-point number between 0.0 (beginning) and 1.0 (end)
146 */
147 public double getLocationRatio(ITmfLocation<?> location);
12c155f5 148
c76c54bb
FC
149 public ITmfLocation<?> getCurrentLocation();
150
abfad0aa 151 /**
12c155f5
FC
152 * Returns the rank of the first event with the requested timestamp. If none, returns the index of the next event
153 * (if any).
154 *
0d9a6d76
FC
155 * @param timestamp the requested event timestamp
156 * @return the corresponding event rank
abfad0aa 157 */
4df4581d 158 public long getRank(ITmfTimestamp timestamp);
12c155f5 159
a1091415
PT
160 /**
161 * Set the resource used for persistent properties on this trace
162 * @param resource the properties resource
163 */
164 public void setResource(IResource resource);
165
166 /**
167 * Get the resource used for persistent properties on this trace
168 * @return the properties resource or null if none is set
169 */
170 public IResource getResource();
8636b448 171
8c8bf09f 172}
This page took 0.042063 seconds and 5 git commands to generate.