1 /*******************************************************************************
2 * Copyright (c) 2009, 2011, 2012 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 * Francois Chouinard - Initial API and implementation
11 * Francois Chouinard - Updated as per TMF Trace Model 1.0
12 *******************************************************************************/
14 package org
.eclipse
.linuxtools
.tmf
.core
.trace
;
16 import java
.io
.FileNotFoundException
;
18 import org
.eclipse
.core
.resources
.IProject
;
19 import org
.eclipse
.core
.resources
.IResource
;
20 import org
.eclipse
.linuxtools
.tmf
.core
.component
.ITmfComponent
;
21 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
22 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfTimestamp
;
23 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimeRange
;
26 * <b><u>ITmfTrace</u></b>
28 * The basic event trace structure in TMF.
30 public interface ITmfTrace
<T
extends ITmfEvent
> extends ITmfComponent
{
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
37 * Initialize a newly instantiated "empty" trace object. This is used to
38 * parameterize an ITmfTrace instantiated with its parameterless constructor.
40 * @param name the trace name
41 * @param path the trace path
42 * @param eventType the trace event type
43 * @throws FileNotFoundException
45 public void initTrace(String name
, String path
, Class
<T
> eventType
) throws FileNotFoundException
;
48 * Validate that the trace is of the correct type.
50 * @param project the eclipse project
51 * @param path the trace path
53 * @return true if trace is valid
55 public boolean validate(IProject project
, String path
);
58 * Set the resource used for persistent properties on this trace
60 * @param resource the properties resource
62 public void setResource(IResource resource
);
65 * Get the resource used for persistent properties on this trace
67 * @return the properties resource or null if none is set
69 public IResource
getResource();
72 * Start the trace indexing, optionally wait for the index to be fully
73 * built before returning.
75 * @param waitForCompletion
77 public void indexTrace(boolean waitForCompletion
);
79 // ------------------------------------------------------------------------
81 // ------------------------------------------------------------------------
84 * @return the trace path
86 public String
getPath();
89 * @return the trace name
92 public String
getName();
95 * @return the number of events in the trace
97 public long getNbEvents();
100 * @return the trace time range
102 public TmfTimeRange
getTimeRange();
105 * @return the timestamp of the first trace event
107 public ITmfTimestamp
getStartTime();
110 * @return the timestamp of the last trace event
112 public ITmfTimestamp
getEndTime();
115 * @return the streaming interval in ms (0 if not streaming)
117 public long getStreamingInterval();
120 * @return the trace index page size
122 public int getIndexPageSize();
124 // ------------------------------------------------------------------------
126 // ------------------------------------------------------------------------
129 * Position the trace at the specified location. The null location
130 * is used to indicate that the first trace event.
132 * @param location the trace specific location (null for 1st event)
133 * @return a context which can later be used to read the corresponding event
135 public ITmfContext
seekLocation(ITmfLocation
<?
> location
);
138 * Position the trace at the event located at the specified ratio in the
141 * The notion of ratio (0.0 <= r <= 1.0) is trace specific and left
142 * voluntarily vague. Typically, it would refer to the event proportional
143 * rank or timestamp in the trace file.
145 * @param ratio the proportional 'rank' in the trace
146 * @return a context which can later be used to read the corresponding event
148 public ITmfContext
seekLocation(double ratio
);
151 * Position the trace at the first event with the specified timestamp. If
152 * there is no event with the requested timestamp, a context pointing to
153 * the chronologically next event is returned.
155 * @param timestamp the timestamp of desired event
156 * @return a context which can later be used to read the corresponding event
158 public ITmfContext
seekEvent(ITmfTimestamp timestamp
);
161 * Position the trace at the Nth event in the trace.
163 * @param rank the event rank
164 * @return a context which can later be used to read the corresponding event
166 public ITmfContext
seekEvent(long rank
);
168 // ------------------------------------------------------------------------
170 // ------------------------------------------------------------------------
173 * Return the event pointed by the supplied context (or null if no event
174 * left) and updates the context to point the next event.
176 * @param context the read context
177 * @return the next event in the stream
179 public ITmfEvent
getNextEvent(ITmfContext context
);
182 * Return the event pointed by the supplied context (or null if no event
183 * left) and *does not* update the context.
185 * @param context the read context
186 * @return the next event in the stream
188 public ITmfEvent
parseEvent(ITmfContext context
);
191 // ------------------------------------------------------------------------
193 // ------------------------------------------------------------------------
196 * Returns the ratio (proportion) corresponding to the specified location.
198 * @param location a trace specific location
199 * @return a floating-point number between 0.0 (beginning) and 1.0 (end)
201 public double getLocationRatio(ITmfLocation
<?
> location
);
204 * @return the curretn trace location
206 public ITmfLocation
<?
> getCurrentLocation();
209 * Returns the rank of the first event with the requested timestamp.
210 * If none, returns the index of the subsequent event (if any).
212 * @param timestamp the requested event timestamp
213 * @return the corresponding event rank
215 public long getRank(ITmfTimestamp timestamp
);
This page took 0.042474 seconds and 6 git commands to generate.