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 the TMF.
30 public interface ITmfTrace
<T
extends ITmfEvent
> extends ITmfComponent
{
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
36 // ------------------------------------------------------------------------
38 // ------------------------------------------------------------------------
41 public void initTrace(String name
, String path
, Class
<T
> eventType
, int pageSize
) throws FileNotFoundException
;
43 public void indexTrace(boolean waitForCompletion
);
45 // Trace type validation
46 public boolean validate(IProject project
, String path
);
48 // ------------------------------------------------------------------------
50 // ------------------------------------------------------------------------
53 * @return the trace path
55 public String
getPath();
58 * @return the trace name
61 public String
getName();
64 * @return the cache size
66 public int getCacheSize();
69 * @return the number of events in the trace
71 public long getNbEvents();
74 * Trace time range accesses
76 public TmfTimeRange
getTimeRange();
78 public ITmfTimestamp
getStartTime();
80 public ITmfTimestamp
getEndTime();
83 * @return the streaming interval in ms (0 if not streaming)
85 public long getStreamingInterval();
87 // ------------------------------------------------------------------------
89 // ------------------------------------------------------------------------
92 * Positions the trace at the first event with the specified timestamp or index (i.e. the nth event in the trace).
94 * Returns a context which can later be used to read the event.
97 * @return a context object for subsequent reads
99 public ITmfContext
seekLocation(ITmfLocation
<?
> location
);
101 public ITmfContext
seekEvent(ITmfTimestamp timestamp
);
103 public ITmfContext
seekEvent(long rank
);
106 * Positions the trace at the event located at the specified ratio.
108 * Returns a context which can later be used to read the event.
111 * a floating-point number between 0.0 (beginning) and 1.0 (end)
112 * @return a context object for subsequent reads
114 public ITmfContext
seekLocation(double ratio
);
116 // ------------------------------------------------------------------------
118 // ------------------------------------------------------------------------
121 * Return the event pointed by the supplied context (or null if no event left) and updates the context to the next
124 * @return the next event in the stream
126 public ITmfEvent
getNextEvent(ITmfContext context
);
129 * Return the event pointed by the supplied context (or null if no event left) and *does not* update the context.
131 * @return the next event in the stream
133 public ITmfEvent
parseEvent(ITmfContext context
);
136 // ------------------------------------------------------------------------
138 // ------------------------------------------------------------------------
141 * Returns the ratio corresponding to the specified location.
145 * @return a floating-point number between 0.0 (beginning) and 1.0 (end)
147 public double getLocationRatio(ITmfLocation
<?
> location
);
149 public ITmfLocation
<?
> getCurrentLocation();
152 * Returns the rank of the first event with the requested timestamp. If none, returns the index of the next event
155 * @param timestamp the requested event timestamp
156 * @return the corresponding event rank
158 public long getRank(ITmfTimestamp timestamp
);
161 * Set the resource used for persistent properties on this trace
162 * @param resource the properties resource
164 public void setResource(IResource resource
);
167 * Get the resource used for persistent properties on this trace
168 * @return the properties resource or null if none is set
170 public IResource
getResource();
This page took 0.039682 seconds and 6 git commands to generate.