Rename xxx.lttng to xxx.lttng.core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / trace / ITmfTrace.java
CommitLineData
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
13package org.eclipse.linuxtools.tmf.trace;
14
12c155f5
FC
15import java.io.FileNotFoundException;
16
17import org.eclipse.core.resources.IProject;
ff4ed569 18import org.eclipse.linuxtools.tmf.component.ITmfComponent;
8c8bf09f
ASL
19import org.eclipse.linuxtools.tmf.event.TmfEvent;
20import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
21import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
22
23/**
146a887c 24 * <b><u>ITmfTrace</u></b>
8c8bf09f
ASL
25 * <p>
26 */
12c155f5
FC
27public 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
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
146a887c 69 public TmfTimestamp getStartTime();
12c155f5 70
146a887c 71 public TmfTimestamp getEndTime();
62d1696a 72
12c155f5
FC
73 /**
74 * Positions the trace at the first event with the specified timestamp or index (i.e. the nth event in the trace).
4e3aa37d
FC
75 *
76 * Returns a context which can later be used to read the event.
8c8bf09f 77 *
12c155f5
FC
78 * @param location
79 * @param timestamp
80 * @param rank
8c8bf09f
ASL
81 * @return a context object for subsequent reads
82 */
452ad365 83 public TmfContext seekLocation(ITmfLocation<?> location);
12c155f5 84
9f584e4c 85 public TmfContext seekEvent(TmfTimestamp timestamp);
12c155f5 86
9f584e4c 87 public TmfContext seekEvent(long rank);
146a887c 88
c76c54bb
FC
89 /**
90 * Positions the trace at the event located at the specified ratio.
91 *
92 * Returns a context which can later be used to read the event.
93 *
12c155f5
FC
94 * @param ratio
95 * a floating-point number between 0.0 (beginning) and 1.0 (end)
c76c54bb
FC
96 * @return a context object for subsequent reads
97 */
98 public TmfContext seekLocation(double ratio);
12c155f5 99
c76c54bb
FC
100 /**
101 * Returns the ratio corresponding to the specified location.
102 *
12c155f5
FC
103 * @param location
104 * a trace location
c76c54bb
FC
105 * @return a floating-point number between 0.0 (beginning) and 1.0 (end)
106 */
107 public double getLocationRatio(ITmfLocation<?> location);
12c155f5 108
c76c54bb
FC
109 public ITmfLocation<?> getCurrentLocation();
110
abfad0aa 111 /**
12c155f5
FC
112 * Returns the rank of the first event with the requested timestamp. If none, returns the index of the next event
113 * (if any).
114 *
abfad0aa
FC
115 * @param timestamp
116 * @return
117 */
118 public long getRank(TmfTimestamp timestamp);
12c155f5 119
146a887c 120 /**
12c155f5
FC
121 * Return the event pointed by the supplied context (or null if no event left) and updates the context to the next
122 * event.
8c8bf09f
ASL
123 *
124 * @return the next event in the stream
125 */
9f584e4c 126 public TmfEvent getNextEvent(TmfContext context);
62d1696a 127
e31e01e8 128 /**
12c155f5 129 * Return the event pointed by the supplied context (or null if no event left) and *does not* update the context.
e31e01e8
FC
130 *
131 * @return the next event in the stream
132 */
9f584e4c 133 public TmfEvent parseEvent(TmfContext context);
e31e01e8 134
8c8bf09f 135}
This page took 0.036939 seconds and 5 git commands to generate.