Commit | Line | Data |
---|---|---|
8c8bf09f | 1 | /******************************************************************************* |
0316808c | 2 | * Copyright (c) 2009, 2010, 2012 Ericsson |
ce2388e0 | 3 | * |
8c8bf09f ASL |
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 | |
ce2388e0 | 8 | * |
8c8bf09f ASL |
9 | * Contributors: |
10 | * Francois Chouinard - Initial API and implementation | |
0316808c | 11 | * Francois Chouinard - Updated as per TMF Trace Model 1.0 |
8c8bf09f ASL |
12 | *******************************************************************************/ |
13 | ||
6c13869b | 14 | package org.eclipse.linuxtools.tmf.core.experiment; |
8c8bf09f | 15 | |
a1091415 | 16 | import org.eclipse.core.resources.IFile; |
12c155f5 | 17 | import org.eclipse.core.resources.IProject; |
828e5592 | 18 | import org.eclipse.core.resources.IResource; |
72f1e62a | 19 | import org.eclipse.linuxtools.tmf.core.event.ITmfEvent; |
4df4581d | 20 | import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; |
6c13869b FC |
21 | import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange; |
22 | import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp; | |
0316808c | 23 | import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException; |
6c13869b FC |
24 | import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest; |
25 | import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest; | |
1b70b6dc | 26 | import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal; |
6c13869b FC |
27 | import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentDisposedSignal; |
28 | import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal; | |
29 | import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentSelectedSignal; | |
30 | import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentUpdatedSignal; | |
31 | import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler; | |
c32744d6 | 32 | import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal; |
6c13869b | 33 | import org.eclipse.linuxtools.tmf.core.trace.ITmfContext; |
0316808c | 34 | import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser; |
6c13869b FC |
35 | import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation; |
36 | import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; | |
0316808c FC |
37 | import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpointIndexer; |
38 | import org.eclipse.linuxtools.tmf.core.trace.TmfTrace; | |
8c8bf09f ASL |
39 | |
40 | /** | |
cbdacf03 FC |
41 | * TmfExperiment presents a time-ordered, unified view of a set of TmfTraces |
42 | * that are part of a tracing experiment. | |
8c8bf09f | 43 | */ |
0316808c | 44 | public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements ITmfEventParser<T> { |
8c8bf09f | 45 | |
c32744d6 FC |
46 | // ------------------------------------------------------------------------ |
47 | // Constants | |
48 | // ------------------------------------------------------------------------ | |
49 | ||
50 | // The index page size | |
51 | private static final int DEFAULT_INDEX_PAGE_SIZE = 5000; | |
52 | ||
8c8bf09f ASL |
53 | // ------------------------------------------------------------------------ |
54 | // Attributes | |
55 | // ------------------------------------------------------------------------ | |
56 | ||
a79913eb | 57 | // The currently selected experiment |
c32744d6 | 58 | protected static TmfExperiment<?> fCurrentExperiment = null; |
e31e01e8 | 59 | |
a79913eb | 60 | // The set of traces that constitute the experiment |
c32744d6 | 61 | protected ITmfTrace<T>[] fTraces; |
8c8bf09f | 62 | |
828e5592 | 63 | // Flag to initialize only once |
c32744d6 | 64 | protected boolean fInitialized = false; |
828e5592 | 65 | |
a1091415 | 66 | // The experiment bookmarks file |
c32744d6 | 67 | protected IFile fBookmarksFile; |
a1091415 | 68 | |
07671572 FC |
69 | // // The properties resource |
70 | // private IResource fResource; | |
828e5592 | 71 | |
8c8bf09f ASL |
72 | // ------------------------------------------------------------------------ |
73 | // Constructors | |
74 | // ------------------------------------------------------------------------ | |
75 | ||
12c155f5 | 76 | @Override |
cbdacf03 | 77 | public boolean validate(final IProject project, final String path) { |
12c155f5 FC |
78 | return true; |
79 | } | |
80 | ||
81 | @Override | |
07671572 FC |
82 | public void initTrace(final IResource resource, final String path, final Class<T> type) { |
83 | // fResource = resource; | |
84 | try { | |
85 | super.initTrace(resource, path, type); | |
86 | } catch (TmfTraceException e) { | |
87 | // TODO Auto-generated catch block | |
88 | e.printStackTrace(); | |
89 | } | |
96c6806f PT |
90 | } |
91 | ||
8c8bf09f ASL |
92 | /** |
93 | * @param type | |
94 | * @param id | |
95 | * @param traces | |
96 | * @param epoch | |
97 | * @param indexPageSize | |
0316808c | 98 | * @throws TmfTraceException |
8c8bf09f | 99 | */ |
cbdacf03 | 100 | public TmfExperiment(final Class<T> type, final String id, final ITmfTrace<T>[] traces, final ITmfTimestamp epoch, |
0316808c FC |
101 | final int indexPageSize) |
102 | { | |
a4115405 | 103 | this(type, id, traces, TmfTimestamp.ZERO, indexPageSize, false); |
a79913eb | 104 | } |
cb866e08 | 105 | |
0316808c FC |
106 | @SuppressWarnings({ "unchecked", "rawtypes" }) |
107 | public TmfExperiment(final Class<T> type, final String path, final ITmfTrace<T>[] traces, final ITmfTimestamp epoch, | |
108 | final int indexPageSize, final boolean preIndexExperiment) | |
109 | { | |
110 | setCacheSize(indexPageSize); | |
111 | setStreamingInterval(0); | |
07671572 | 112 | setIndexer(new TmfCheckpointIndexer(this, indexPageSize)); |
0316808c FC |
113 | setParser(this); |
114 | try { | |
115 | super.initialize(null, path, type); | |
116 | } catch (TmfTraceException e) { | |
117 | e.printStackTrace(); | |
118 | } | |
8c8bf09f | 119 | |
a79913eb | 120 | fTraces = traces; |
a87cc4ef | 121 | setTimeRange(TmfTimeRange.NULL_RANGE); |
8c8bf09f | 122 | |
a87cc4ef FC |
123 | if (preIndexExperiment) { |
124 | getIndexer().buildIndex(true); | |
a87cc4ef | 125 | } |
a79913eb | 126 | } |
8c8bf09f ASL |
127 | |
128 | /** | |
129 | * @param type | |
130 | * @param id | |
131 | * @param traces | |
0316808c | 132 | * @throws TmfTraceException |
8c8bf09f | 133 | */ |
cbdacf03 | 134 | public TmfExperiment(final Class<T> type, final String id, final ITmfTrace<T>[] traces) { |
a4115405 | 135 | this(type, id, traces, TmfTimestamp.ZERO, DEFAULT_INDEX_PAGE_SIZE); |
8c8bf09f ASL |
136 | } |
137 | ||
138 | /** | |
139 | * @param type | |
140 | * @param id | |
141 | * @param traces | |
142 | * @param indexPageSize | |
0316808c | 143 | * @throws TmfTraceException |
8c8bf09f | 144 | */ |
cbdacf03 | 145 | public TmfExperiment(final Class<T> type, final String id, final ITmfTrace<T>[] traces, final int indexPageSize) { |
a4115405 | 146 | this(type, id, traces, TmfTimestamp.ZERO, indexPageSize); |
8c8bf09f | 147 | } |
a79913eb | 148 | |
8c8bf09f | 149 | /** |
ff4ed569 | 150 | * Clears the experiment |
8c8bf09f ASL |
151 | */ |
152 | @Override | |
12c155f5 | 153 | @SuppressWarnings("rawtypes") |
a79913eb FC |
154 | public synchronized void dispose() { |
155 | ||
cbdacf03 | 156 | final TmfExperimentDisposedSignal<T> signal = new TmfExperimentDisposedSignal<T>(this, this); |
a79913eb | 157 | broadcast(signal); |
cbdacf03 | 158 | if (fCurrentExperiment == this) |
09d11238 | 159 | fCurrentExperiment = null; |
a79913eb FC |
160 | |
161 | if (fTraces != null) { | |
cbdacf03 | 162 | for (final ITmfTrace trace : fTraces) |
a79913eb | 163 | trace.dispose(); |
a79913eb FC |
164 | fTraces = null; |
165 | } | |
2fb2eb37 | 166 | super.dispose(); |
8c8bf09f ASL |
167 | } |
168 | ||
169 | // ------------------------------------------------------------------------ | |
e31e01e8 | 170 | // Accessors |
8c8bf09f ASL |
171 | // ------------------------------------------------------------------------ |
172 | ||
cbdacf03 FC |
173 | public static void setCurrentExperiment(final TmfExperiment<?> experiment) { |
174 | if (fCurrentExperiment != null && fCurrentExperiment != experiment) | |
09d11238 | 175 | fCurrentExperiment.dispose(); |
a79913eb | 176 | fCurrentExperiment = experiment; |
f6b14ce2 FC |
177 | } |
178 | ||
e31e01e8 | 179 | public static TmfExperiment<?> getCurrentExperiment() { |
a79913eb | 180 | return fCurrentExperiment; |
8c8bf09f ASL |
181 | } |
182 | ||
12c155f5 | 183 | public ITmfTrace<T>[] getTraces() { |
a79913eb | 184 | return fTraces; |
8c8bf09f ASL |
185 | } |
186 | ||
8c8bf09f | 187 | /** |
cbdacf03 FC |
188 | * Returns the timestamp of the event at the requested index. If none, |
189 | * returns null. | |
a79913eb | 190 | * |
0d9a6d76 FC |
191 | * @param index the event index (rank) |
192 | * @return the corresponding event timestamp | |
8c8bf09f | 193 | */ |
cbdacf03 | 194 | public ITmfTimestamp getTimestamp(final int index) { |
0316808c | 195 | final ITmfContext context = seekEvent(index); |
c32744d6 | 196 | final ITmfEvent event = getNext(context); |
a79913eb | 197 | return (event != null) ? event.getTimestamp() : null; |
8c8bf09f ASL |
198 | } |
199 | ||
8c8bf09f ASL |
200 | // ------------------------------------------------------------------------ |
201 | // TmfProvider | |
202 | // ------------------------------------------------------------------------ | |
a79913eb | 203 | |
a79913eb | 204 | @Override |
cbdacf03 | 205 | public ITmfContext armRequest(final ITmfDataRequest<T> request) { |
ce2388e0 | 206 | ITmfTimestamp timestamp = (request instanceof ITmfEventRequest<?>) ? ((ITmfEventRequest<T>) request).getRange().getStartTime() : null; |
07671572 FC |
207 | if (TmfTimestamp.BIG_BANG.equals(timestamp) || request.getIndex() > 0) { |
208 | timestamp = null; | |
209 | } | |
210 | ||
0316808c | 211 | ITmfContext context = null; |
07671572 | 212 | if (timestamp != null) { // Seek by timestamp |
a79913eb FC |
213 | context = seekEvent(timestamp); |
214 | ((ITmfEventRequest<T>) request).setStartIndex((int) context.getRank()); | |
07671572 FC |
215 | } else { // Seek by rank |
216 | context = seekEvent(request.getIndex()); | |
217 | } | |
218 | ||
a79913eb FC |
219 | return context; |
220 | } | |
221 | ||
a79913eb | 222 | // ------------------------------------------------------------------------ |
9f584e4c FC |
223 | // ITmfTrace trace positioning |
224 | // ------------------------------------------------------------------------ | |
225 | ||
a79913eb FC |
226 | // Returns a brand new context based on the location provided |
227 | // and initializes the event queues | |
228 | @Override | |
7e6347b0 | 229 | public synchronized TmfExperimentContext seekEvent(final ITmfLocation<?> location) { |
a79913eb | 230 | // Validate the location |
cbdacf03 | 231 | if (location != null && !(location instanceof TmfExperimentLocation)) |
a79913eb | 232 | return null; // Throw an exception? |
8f50c396 | 233 | |
cbdacf03 | 234 | if (fTraces == null) |
a79913eb | 235 | return null; |
8f50c396 | 236 | |
a79913eb | 237 | // Instantiate the location |
cbdacf03 | 238 | final TmfExperimentLocation expLocation = (location == null) ? new TmfExperimentLocation(new TmfLocationArray( |
0316808c | 239 | new ITmfLocation<?>[fTraces.length])) : (TmfExperimentLocation) location.clone(); |
8f50c396 | 240 | |
a79913eb | 241 | // Create and populate the context's traces contexts |
0316808c | 242 | final TmfExperimentContext context = new TmfExperimentContext(new ITmfContext[fTraces.length]); |
9b635e61 | 243 | |
a79913eb FC |
244 | for (int i = 0; i < fTraces.length; i++) { |
245 | // Get the relevant trace attributes | |
0316808c | 246 | final ITmfLocation<?> traceLocation = expLocation.getLocation().getLocations()[i]; |
7e6347b0 | 247 | context.getContexts()[i] = fTraces[i].seekEvent(traceLocation); |
0316808c | 248 | expLocation.getLocation().getLocations()[i] = context.getContexts()[i].getLocation().clone(); |
c32744d6 | 249 | context.getEvents()[i] = fTraces[i].getNext(context.getContexts()[i]); |
a79913eb | 250 | } |
8f50c396 | 251 | |
a79913eb FC |
252 | // Finalize context |
253 | context.setLocation(expLocation); | |
254 | context.setLastTrace(TmfExperimentContext.NO_TRACE); | |
0316808c | 255 | context.setRank(ITmfContext.UNKNOWN_RANK); |
a79913eb FC |
256 | return context; |
257 | } | |
9f584e4c | 258 | |
c76c54bb | 259 | @Override |
0316808c FC |
260 | public ITmfContext seekEvent(final double ratio) { |
261 | final ITmfContext context = seekEvent((long) (ratio * getNbEvents())); | |
c76c54bb FC |
262 | return context; |
263 | } | |
264 | ||
a79913eb | 265 | @Override |
cbdacf03 FC |
266 | public double getLocationRatio(final ITmfLocation<?> location) { |
267 | if (location instanceof TmfExperimentLocation) | |
7e6347b0 | 268 | return (double) seekEvent(location).getRank() / getNbEvents(); |
c76c54bb FC |
269 | return 0; |
270 | } | |
271 | ||
a79913eb FC |
272 | @Override |
273 | public ITmfLocation<?> getCurrentLocation() { | |
a87cc4ef FC |
274 | ITmfLocation<?>[] locations = new ITmfLocation<?>[fTraces.length]; |
275 | for (int i = 0; i < fTraces.length; i++) { | |
276 | locations[i] = fTraces[i].getCurrentLocation(); | |
277 | } | |
278 | return new TmfExperimentLocation(new TmfLocationArray(locations)); | |
a79913eb | 279 | } |
c76c54bb | 280 | |
07671572 FC |
281 | /* (non-Javadoc) |
282 | * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#readNextEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfContext) | |
283 | */ | |
284 | @Override | |
c32744d6 | 285 | public synchronized T getNext(final ITmfContext context) { |
a0a4901e | 286 | final ITmfContext previousContext = (TmfExperimentContext) context.clone(); |
c32744d6 | 287 | final T event = parseEvent(context); |
07671572 | 288 | if (event != null) { |
a0a4901e | 289 | updateAttributes(previousContext, event.getTimestamp()); |
07671572 FC |
290 | |
291 | TmfExperimentContext expContext = (TmfExperimentContext) context; | |
292 | int trace = expContext.getLastTrace(); | |
293 | if (trace != TmfExperimentContext.NO_TRACE) { | |
294 | TmfExperimentLocation location = (TmfExperimentLocation) expContext.getLocation(); | |
295 | location.getLocation().getLocations()[trace] = expContext.getContexts()[trace].getLocation(); | |
296 | } | |
297 | ||
298 | context.increaseRank(); | |
299 | processEvent(event); | |
300 | } | |
301 | return event; | |
302 | } | |
a79913eb | 303 | |
ce2388e0 FC |
304 | /* (non-Javadoc) |
305 | * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#parseEvent(org.eclipse.linuxtools .tmf.trace.TmfContext) | |
a79913eb | 306 | */ |
0316808c FC |
307 | @SuppressWarnings("unchecked") |
308 | @Override | |
a87cc4ef | 309 | public T parseEvent(ITmfContext context) { |
a79913eb FC |
310 | |
311 | // Validate the context | |
cbdacf03 | 312 | if (!(context instanceof TmfExperimentContext)) |
a79913eb | 313 | return null; // Throw an exception? |
a79913eb | 314 | |
a87cc4ef | 315 | TmfExperimentContext expContext = (TmfExperimentContext) context; |
a79913eb | 316 | |
a87cc4ef | 317 | // If an event was consumed previously, first get the next one from that trace |
cbdacf03 | 318 | final int lastTrace = expContext.getLastTrace(); |
a79913eb | 319 | if (lastTrace != TmfExperimentContext.NO_TRACE) { |
cbdacf03 | 320 | final ITmfContext traceContext = expContext.getContexts()[lastTrace]; |
c32744d6 | 321 | expContext.getEvents()[lastTrace] = fTraces[lastTrace].getNext(traceContext); |
a79913eb | 322 | expContext.setLastTrace(TmfExperimentContext.NO_TRACE); |
a79913eb FC |
323 | } |
324 | ||
325 | // Scan the candidate events and identify the "next" trace to read from | |
326 | int trace = TmfExperimentContext.NO_TRACE; | |
a4115405 | 327 | ITmfTimestamp timestamp = TmfTimestamp.BIG_CRUNCH; |
0316808c | 328 | for (int i = 0; i < fTraces.length; i++) { |
cbdacf03 | 329 | final ITmfEvent event = expContext.getEvents()[i]; |
a79913eb | 330 | if (event != null && event.getTimestamp() != null) { |
cbdacf03 | 331 | final ITmfTimestamp otherTS = event.getTimestamp(); |
a79913eb FC |
332 | if (otherTS.compareTo(timestamp, true) < 0) { |
333 | trace = i; | |
334 | timestamp = otherTS; | |
335 | } | |
336 | } | |
337 | } | |
a87cc4ef FC |
338 | |
339 | T event = null; | |
07671572 | 340 | if (trace != TmfExperimentContext.NO_TRACE) { |
a87cc4ef | 341 | event = (T) expContext.getEvents()[trace]; |
07671572 | 342 | } |
a87cc4ef | 343 | |
a87cc4ef FC |
344 | expContext.setLastTrace(trace); |
345 | return event; | |
a79913eb FC |
346 | } |
347 | ||
bcbea6a6 | 348 | /* (non-Javadoc) |
a79913eb FC |
349 | * @see java.lang.Object#toString() |
350 | */ | |
351 | @Override | |
3b38ea61 | 352 | @SuppressWarnings("nls") |
a79913eb FC |
353 | public String toString() { |
354 | return "[TmfExperiment (" + getName() + ")]"; | |
355 | } | |
8c8bf09f ASL |
356 | |
357 | // ------------------------------------------------------------------------ | |
358 | // Indexing | |
359 | // ------------------------------------------------------------------------ | |
360 | ||
1b70b6dc | 361 | private synchronized void initializeStreamingMonitor() { |
cbdacf03 | 362 | if (fInitialized) |
828e5592 | 363 | return; |
828e5592 PT |
364 | fInitialized = true; |
365 | ||
1b70b6dc | 366 | if (getStreamingInterval() == 0) { |
0316808c | 367 | final ITmfContext context = seekEvent(0); |
cbdacf03 FC |
368 | final ITmfEvent event = getNext(context); |
369 | if (event == null) | |
1b70b6dc | 370 | return; |
cbdacf03 | 371 | final TmfTimeRange timeRange = new TmfTimeRange(event.getTimestamp().clone(), TmfTimestamp.BIG_CRUNCH); |
828e5592 PT |
372 | final TmfExperimentRangeUpdatedSignal signal = new TmfExperimentRangeUpdatedSignal(this, this, timeRange); |
373 | ||
374 | // Broadcast in separate thread to prevent deadlock | |
375 | new Thread() { | |
376 | @Override | |
377 | public void run() { | |
378 | broadcast(signal); | |
379 | } | |
380 | }.start(); | |
1b70b6dc PT |
381 | return; |
382 | } | |
383 | ||
bcbea6a6 FC |
384 | final Thread thread = new Thread("Streaming Monitor for experiment " + getName()) { ////$NON-NLS-1$ |
385 | private ITmfTimestamp safeTimestamp = null; | |
386 | private TmfTimeRange timeRange = null; | |
1b70b6dc PT |
387 | |
388 | @Override | |
389 | public void run() { | |
390 | while (!fExecutor.isShutdown()) { | |
391 | if (!isIndexingBusy()) { | |
a4115405 FC |
392 | ITmfTimestamp startTimestamp = TmfTimestamp.BIG_CRUNCH; |
393 | ITmfTimestamp endTimestamp = TmfTimestamp.BIG_BANG; | |
cbdacf03 FC |
394 | for (final ITmfTrace<T> trace : fTraces) { |
395 | if (trace.getStartTime().compareTo(startTimestamp) < 0) | |
1b70b6dc | 396 | startTimestamp = trace.getStartTime(); |
cbdacf03 | 397 | if (trace.getStreamingInterval() != 0 && trace.getEndTime().compareTo(endTimestamp) > 0) |
1b70b6dc | 398 | endTimestamp = trace.getEndTime(); |
1b70b6dc | 399 | } |
cbdacf03 | 400 | if (safeTimestamp != null && safeTimestamp.compareTo(getTimeRange().getEndTime(), false) > 0) |
1b70b6dc | 401 | timeRange = new TmfTimeRange(startTimestamp, safeTimestamp); |
cbdacf03 | 402 | else |
1b70b6dc | 403 | timeRange = null; |
1b70b6dc PT |
404 | safeTimestamp = endTimestamp; |
405 | if (timeRange != null) { | |
cbdacf03 | 406 | final TmfExperimentRangeUpdatedSignal signal = |
1b70b6dc PT |
407 | new TmfExperimentRangeUpdatedSignal(TmfExperiment.this, TmfExperiment.this, timeRange); |
408 | broadcast(signal); | |
409 | } | |
410 | } | |
411 | try { | |
412 | Thread.sleep(getStreamingInterval()); | |
cbdacf03 | 413 | } catch (final InterruptedException e) { |
1b70b6dc PT |
414 | e.printStackTrace(); |
415 | } | |
416 | } | |
417 | } | |
418 | }; | |
419 | thread.start(); | |
420 | } | |
421 | ||
cbdacf03 FC |
422 | /* |
423 | * (non-Javadoc) | |
424 | * | |
1b70b6dc PT |
425 | * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#getStreamingInterval() |
426 | */ | |
427 | @Override | |
428 | public long getStreamingInterval() { | |
429 | long interval = 0; | |
cbdacf03 | 430 | for (final ITmfTrace<T> trace : fTraces) |
1b70b6dc | 431 | interval = Math.max(interval, trace.getStreamingInterval()); |
1b70b6dc PT |
432 | return interval; |
433 | } | |
434 | ||
a79913eb | 435 | /* |
cbdacf03 FC |
436 | * The experiment holds the globally ordered events of its set of traces. It |
437 | * is expected to provide access to each individual event by index i.e. it | |
438 | * must be possible to request the Nth event of the experiment. | |
a79913eb | 439 | * |
cbdacf03 FC |
440 | * The purpose of the index is to keep the information needed to rapidly |
441 | * restore the traces contexts at regular intervals (every INDEX_PAGE_SIZE | |
442 | * event). | |
a79913eb | 443 | */ |
8c8bf09f | 444 | |
a87cc4ef | 445 | // protected int fIndexPageSize; |
a79913eb | 446 | protected boolean fIndexing = false; |
c32744d6 | 447 | // protected TmfTimeRange fIndexingPendingRange = TmfTimeRange.NULL_RANGE; |
e31e01e8 | 448 | |
1b70b6dc PT |
449 | private Integer fEndSynchReference; |
450 | ||
a79913eb | 451 | protected boolean isIndexingBusy() { |
07671572 | 452 | return fIndexing; |
a79913eb FC |
453 | } |
454 | ||
a79913eb | 455 | |
c32744d6 FC |
456 | // protected void notifyListeners() { |
457 | // broadcast(new TmfExperimentUpdatedSignal(this, this)); | |
458 | // } | |
a79913eb | 459 | |
8c8bf09f ASL |
460 | // ------------------------------------------------------------------------ |
461 | // Signal handlers | |
462 | // ------------------------------------------------------------------------ | |
463 | ||
c32744d6 FC |
464 | @TmfSignalHandler |
465 | public void traceUpdated(final TmfTraceUpdatedSignal signal) { | |
466 | if (signal.getTrace() == this) { | |
467 | broadcast(new TmfExperimentUpdatedSignal(this, this)); | |
468 | } | |
469 | } | |
470 | ||
8c8bf09f | 471 | @TmfSignalHandler |
cbdacf03 FC |
472 | public void experimentSelected(final TmfExperimentSelectedSignal<T> signal) { |
473 | final TmfExperiment<?> experiment = signal.getExperiment(); | |
a79913eb FC |
474 | if (experiment == this) { |
475 | setCurrentExperiment(experiment); | |
6e85c58d | 476 | fEndSynchReference = Integer.valueOf(signal.getReference()); |
a79913eb | 477 | } |
8c8bf09f ASL |
478 | } |
479 | ||
1b70b6dc | 480 | @TmfSignalHandler |
cbdacf03 | 481 | public void endSync(final TmfEndSynchSignal signal) { |
1b70b6dc PT |
482 | if (fEndSynchReference != null && fEndSynchReference.intValue() == signal.getReference()) { |
483 | fEndSynchReference = null; | |
484 | initializeStreamingMonitor(); | |
485 | } | |
1b70b6dc PT |
486 | } |
487 | ||
8c8bf09f | 488 | @TmfSignalHandler |
cbdacf03 | 489 | public void experimentUpdated(final TmfExperimentUpdatedSignal signal) { |
8c8bf09f ASL |
490 | } |
491 | ||
1b70b6dc | 492 | @TmfSignalHandler |
cbdacf03 | 493 | public void experimentRangeUpdated(final TmfExperimentRangeUpdatedSignal signal) { |
0316808c | 494 | if (signal.getExperiment() == this) { |
0316808c FC |
495 | getIndexer().buildIndex(false); |
496 | } | |
1b70b6dc PT |
497 | } |
498 | ||
12c155f5 FC |
499 | @Override |
500 | public String getPath() { | |
501 | // TODO Auto-generated method stub | |
502 | return null; | |
503 | } | |
504 | ||
828e5592 | 505 | /** |
a1091415 | 506 | * Set the file to be used for bookmarks on this experiment |
cbdacf03 | 507 | * |
a1091415 | 508 | * @param file the bookmarks file |
828e5592 | 509 | */ |
cbdacf03 | 510 | public void setBookmarksFile(final IFile file) { |
a1091415 PT |
511 | fBookmarksFile = file; |
512 | } | |
513 | ||
514 | /** | |
515 | * Get the file used for bookmarks on this experiment | |
cbdacf03 | 516 | * |
a1091415 PT |
517 | * @return the bookmarks file or null if none is set |
518 | */ | |
519 | public IFile getBookmarksFile() { | |
520 | return fBookmarksFile; | |
521 | } | |
522 | ||
07671572 FC |
523 | // /* |
524 | // * (non-Javadoc) | |
525 | // * | |
526 | // * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getResource() | |
527 | // */ | |
528 | // @Override | |
529 | // public IResource getResource() { | |
530 | // return fResource; | |
531 | // } | |
4dc47e28 | 532 | } |
07671572 FC |
533 | |
534 | ||
535 | ///******************************************************************************* | |
536 | // * Copyright (c) 2009, 2010 Ericsson | |
537 | // * | |
538 | // * All rights reserved. This program and the accompanying materials are | |
539 | // * made available under the terms of the Eclipse Public License v1.0 which | |
540 | // * accompanies this distribution, and is available at | |
541 | // * http://www.eclipse.org/legal/epl-v10.html | |
542 | // * | |
543 | // * Contributors: | |
544 | // * Francois Chouinard - Initial API and implementation | |
545 | // *******************************************************************************/ | |
546 | // | |
547 | //package org.eclipse.linuxtools.tmf.core.experiment; | |
548 | // | |
549 | //import java.util.Collections; | |
550 | //import java.util.Vector; | |
551 | // | |
552 | //import org.eclipse.core.resources.IFile; | |
553 | //import org.eclipse.core.resources.IProject; | |
554 | //import org.eclipse.core.resources.IResource; | |
555 | //import org.eclipse.core.runtime.IProgressMonitor; | |
556 | //import org.eclipse.core.runtime.IStatus; | |
557 | //import org.eclipse.core.runtime.Status; | |
558 | //import org.eclipse.core.runtime.jobs.Job; | |
559 | //import org.eclipse.linuxtools.tmf.core.component.TmfEventProvider; | |
560 | //import org.eclipse.linuxtools.tmf.core.event.ITmfEvent; | |
561 | //import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; | |
562 | //import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange; | |
563 | //import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp; | |
564 | //import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest; | |
565 | //import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest; | |
566 | //import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest; | |
567 | //import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest; | |
568 | //import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal; | |
569 | //import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentDisposedSignal; | |
570 | //import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal; | |
571 | //import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentSelectedSignal; | |
572 | //import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentUpdatedSignal; | |
573 | //import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler; | |
574 | //import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal; | |
575 | //import org.eclipse.linuxtools.tmf.core.trace.ITmfContext; | |
576 | //import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation; | |
577 | //import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; | |
578 | //import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpoint; | |
579 | //import org.eclipse.linuxtools.tmf.core.trace.TmfContext; | |
580 | // | |
581 | ///** | |
582 | // * <b><u>TmfExperiment</u></b> | |
583 | // * <p> | |
584 | // * TmfExperiment presents a time-ordered, unified view of a set of TmfTraces | |
585 | // * that are part of a tracing experiment. | |
586 | // * <p> | |
587 | // */ | |
588 | //public class TmfExperiment<T extends ITmfEvent> extends TmfEventProvider<T> implements ITmfTrace<T> { | |
589 | // | |
590 | // // ------------------------------------------------------------------------ | |
591 | // // Attributes | |
592 | // // ------------------------------------------------------------------------ | |
593 | // | |
594 | // // The currently selected experiment | |
595 | // protected static TmfExperiment<?> fCurrentExperiment = null; | |
596 | // | |
597 | // // The set of traces that constitute the experiment | |
598 | // protected ITmfTrace<T>[] fTraces; | |
599 | // | |
600 | // // The total number of events | |
601 | // protected long fNbEvents; | |
602 | // | |
603 | // // The experiment time range | |
604 | // protected TmfTimeRange fTimeRange; | |
605 | // | |
606 | // // The experiment reference timestamp (default: ZERO) | |
607 | // protected ITmfTimestamp fEpoch; | |
608 | // | |
609 | // // The experiment index | |
610 | // protected Vector<TmfCheckpoint> fCheckpoints = new Vector<TmfCheckpoint>(); | |
611 | // | |
612 | // // The current experiment context | |
613 | // protected TmfExperimentContext fExperimentContext; | |
614 | // | |
615 | // // Flag to initialize only once | |
616 | // private boolean fInitialized = false; | |
617 | // | |
618 | // // The experiment bookmarks file | |
619 | // private IFile fBookmarksFile; | |
620 | // | |
621 | // // The properties resource | |
622 | // private IResource fResource; | |
623 | // | |
624 | // // ------------------------------------------------------------------------ | |
625 | // // Constructors | |
626 | // // ------------------------------------------------------------------------ | |
627 | // | |
628 | // @Override | |
629 | // public TmfExperiment<T> clone() throws CloneNotSupportedException { | |
630 | // throw new CloneNotSupportedException(); | |
631 | // } | |
632 | // | |
633 | // @Override | |
634 | // public boolean validate(final IProject project, final String path) { | |
635 | // return true; | |
636 | // } | |
637 | // | |
638 | // @Override | |
639 | // public void initTrace(final IResource resource, final String path, final Class<T> eventType) { | |
640 | // fResource = resource; | |
641 | // } | |
642 | // | |
643 | // /** | |
644 | // * @param type | |
645 | // * @param id | |
646 | // * @param traces | |
647 | // * @param epoch | |
648 | // * @param indexPageSize | |
649 | // */ | |
650 | // public TmfExperiment(final Class<T> type, final String id, final ITmfTrace<T>[] traces, final ITmfTimestamp epoch, | |
651 | // final int indexPageSize) { | |
652 | // this(type, id, traces, TmfTimestamp.ZERO, indexPageSize, false); | |
653 | // } | |
654 | // | |
655 | // public TmfExperiment(final Class<T> type, final String id, final ITmfTrace<T>[] traces, final ITmfTimestamp epoch, | |
656 | // final int indexPageSize, final boolean preIndexExperiment) { | |
657 | // super(id, type); | |
658 | // | |
659 | // fTraces = traces; | |
660 | // fEpoch = epoch; | |
661 | // fIndexPageSize = indexPageSize; | |
662 | // fTimeRange = TmfTimeRange.NULL_RANGE; | |
663 | // | |
664 | // if (preIndexExperiment) { | |
665 | // indexExperiment(true, 0, TmfTimeRange.ETERNITY); | |
666 | // updateTimeRange(); | |
667 | // } | |
668 | // } | |
669 | // | |
670 | // protected TmfExperiment(final String id, final Class<T> type) { | |
671 | // super(id, type); | |
672 | // } | |
673 | // | |
674 | // /** | |
675 | // * @param type | |
676 | // * @param id | |
677 | // * @param traces | |
678 | // */ | |
679 | // public TmfExperiment(final Class<T> type, final String id, final ITmfTrace<T>[] traces) { | |
680 | // this(type, id, traces, TmfTimestamp.ZERO, DEFAULT_INDEX_PAGE_SIZE); | |
681 | // } | |
682 | // | |
683 | // /** | |
684 | // * @param type | |
685 | // * @param id | |
686 | // * @param traces | |
687 | // * @param indexPageSize | |
688 | // */ | |
689 | // public TmfExperiment(final Class<T> type, final String id, final ITmfTrace<T>[] traces, final int indexPageSize) { | |
690 | // this(type, id, traces, TmfTimestamp.ZERO, indexPageSize); | |
691 | // } | |
692 | // | |
693 | // /** | |
694 | // * Clears the experiment | |
695 | // */ | |
696 | // @Override | |
697 | // @SuppressWarnings("rawtypes") | |
698 | // public synchronized void dispose() { | |
699 | // | |
700 | // final TmfExperimentDisposedSignal<T> signal = new TmfExperimentDisposedSignal<T>(this, this); | |
701 | // broadcast(signal); | |
702 | // if (fCurrentExperiment == this) | |
703 | // fCurrentExperiment = null; | |
704 | // | |
705 | // if (fTraces != null) { | |
706 | // for (final ITmfTrace trace : fTraces) | |
707 | // trace.dispose(); | |
708 | // fTraces = null; | |
709 | // } | |
710 | // if (fCheckpoints != null) | |
711 | // fCheckpoints.clear(); | |
712 | // super.dispose(); | |
713 | // } | |
714 | // | |
715 | // // ------------------------------------------------------------------------ | |
716 | // // ITmfTrace | |
717 | // // ------------------------------------------------------------------------ | |
718 | // | |
719 | // @Override | |
720 | // public Class<T> getEventType() { | |
721 | // return fType; | |
722 | // } | |
723 | // | |
724 | // @Override | |
725 | // public long getNbEvents() { | |
726 | // return fNbEvents; | |
727 | // } | |
728 | // | |
729 | // @Override | |
730 | // public int getCacheSize() { | |
731 | // return fIndexPageSize; | |
732 | // } | |
733 | // | |
734 | // @Override | |
735 | // public TmfTimeRange getTimeRange() { | |
736 | // return fTimeRange; | |
737 | // } | |
738 | // | |
739 | // @Override | |
740 | // public ITmfTimestamp getStartTime() { | |
741 | // return fTimeRange.getStartTime(); | |
742 | // } | |
743 | // | |
744 | // @Override | |
745 | // public ITmfTimestamp getEndTime() { | |
746 | // return fTimeRange.getEndTime(); | |
747 | // } | |
748 | // | |
749 | // public Vector<TmfCheckpoint> getCheckpoints() { | |
750 | // return fCheckpoints; | |
751 | // } | |
752 | // | |
753 | // // ------------------------------------------------------------------------ | |
754 | // // Accessors | |
755 | // // ------------------------------------------------------------------------ | |
756 | // | |
757 | // public static void setCurrentExperiment(final TmfExperiment<?> experiment) { | |
758 | // if (fCurrentExperiment != null && fCurrentExperiment != experiment) | |
759 | // fCurrentExperiment.dispose(); | |
760 | // fCurrentExperiment = experiment; | |
761 | // } | |
762 | // | |
763 | // public static TmfExperiment<?> getCurrentExperiment() { | |
764 | // return fCurrentExperiment; | |
765 | // } | |
766 | // | |
767 | // public ITmfTimestamp getEpoch() { | |
768 | // return fEpoch; | |
769 | // } | |
770 | // | |
771 | // public ITmfTrace<T>[] getTraces() { | |
772 | // return fTraces; | |
773 | // } | |
774 | // | |
775 | // /** | |
776 | // * Returns the timestamp of the event at the requested index. If none, | |
777 | // * returns null. | |
778 | // * | |
779 | // * @param index the event index (rank) | |
780 | // * @return the corresponding event timestamp | |
781 | // */ | |
782 | // public ITmfTimestamp getTimestamp(final int index) { | |
783 | // final TmfExperimentContext context = seekEvent(index); | |
784 | // final ITmfEvent event = readNextEvent(context); | |
785 | // return (event != null) ? event.getTimestamp() : null; | |
786 | // } | |
787 | // | |
788 | // // ------------------------------------------------------------------------ | |
789 | // // Operators | |
790 | // // ------------------------------------------------------------------------ | |
791 | // | |
792 | // /** | |
793 | // * Update the global time range | |
794 | // */ | |
795 | // protected void updateTimeRange() { | |
796 | // ITmfTimestamp startTime = fTimeRange != TmfTimeRange.NULL_RANGE ? fTimeRange.getStartTime() : TmfTimestamp.BIG_CRUNCH; | |
797 | // ITmfTimestamp endTime = fTimeRange != TmfTimeRange.NULL_RANGE ? fTimeRange.getEndTime() : TmfTimestamp.BIG_BANG; | |
798 | // | |
799 | // for (final ITmfTrace<T> trace : fTraces) { | |
800 | // final ITmfTimestamp traceStartTime = trace.getStartTime(); | |
801 | // if (traceStartTime.compareTo(startTime, true) < 0) | |
802 | // startTime = traceStartTime; | |
803 | // final ITmfTimestamp traceEndTime = trace.getEndTime(); | |
804 | // if (traceEndTime.compareTo(endTime, true) > 0) | |
805 | // endTime = traceEndTime; | |
806 | // } | |
807 | // fTimeRange = new TmfTimeRange(startTime, endTime); | |
808 | // } | |
809 | // | |
810 | // // ------------------------------------------------------------------------ | |
811 | // // TmfProvider | |
812 | // // ------------------------------------------------------------------------ | |
813 | // | |
814 | // @Override | |
815 | // public ITmfContext armRequest(final ITmfDataRequest<T> request) { | |
816 | // // Tracer.trace("Ctx: Arming request - start"); | |
817 | // ITmfTimestamp timestamp = (request instanceof ITmfEventRequest<?>) ? ((ITmfEventRequest<T>) request).getRange().getStartTime() : null; | |
818 | // if (TmfTimestamp.BIG_BANG.equals(timestamp) || request.getIndex() > 0) | |
819 | // timestamp = null; // use request index | |
820 | // TmfExperimentContext context = null; | |
821 | // if (timestamp != null) { | |
822 | // // seek by timestamp | |
823 | // context = seekEvent(timestamp); | |
824 | // ((ITmfEventRequest<T>) request).setStartIndex((int) context.getRank()); | |
825 | // } else // Seek by rank | |
826 | // if ((fExperimentContext != null) && fExperimentContext.getRank() == request.getIndex()) | |
827 | // // We are already at the right context -> no need to seek | |
828 | // context = fExperimentContext; | |
829 | // else | |
830 | // context = seekEvent(request.getIndex()); | |
831 | // // Tracer.trace("Ctx: Arming request - done"); | |
832 | // return context; | |
833 | // } | |
834 | // | |
835 | // @Override | |
836 | // @SuppressWarnings("unchecked") | |
837 | // public T getNext(final ITmfContext context) { | |
838 | // if (context instanceof TmfExperimentContext) | |
839 | // return (T) readNextEvent(context); | |
840 | // return null; | |
841 | // } | |
842 | // | |
843 | // // ------------------------------------------------------------------------ | |
844 | // // ITmfTrace trace positioning | |
845 | // // ------------------------------------------------------------------------ | |
846 | // | |
847 | // // Returns a brand new context based on the location provided | |
848 | // // and initializes the event queues | |
849 | // @Override | |
850 | // public synchronized TmfExperimentContext seekEvent(final ITmfLocation<?> location) { | |
851 | // // Validate the location | |
852 | // if (location != null && !(location instanceof TmfExperimentLocation)) | |
853 | // return null; // Throw an exception? | |
854 | // | |
855 | // if (fTraces == null) | |
856 | // return null; | |
857 | // | |
858 | // // Instantiate the location | |
859 | // final TmfExperimentLocation expLocation = (location == null) ? new TmfExperimentLocation(new TmfLocationArray( | |
860 | // new ITmfLocation<?>[fTraces.length]), new long[fTraces.length]) : (TmfExperimentLocation) location.clone(); | |
861 | // | |
862 | // // Create and populate the context's traces contexts | |
863 | // final TmfExperimentContext context = new TmfExperimentContext(fTraces, new ITmfContext[fTraces.length]); | |
864 | // // Tracer.trace("Ctx: SeekLocation - start"); | |
865 | // | |
866 | // long rank = 0; | |
867 | // for (int i = 0; i < fTraces.length; i++) { | |
868 | // // Get the relevant trace attributes | |
869 | // final ITmfLocation<?> traceLocation = expLocation.getLocation().locations[i]; | |
870 | // final long traceRank = expLocation.getRanks()[i]; | |
871 | // | |
872 | // // Set the corresponding sub-context | |
873 | // context.getContexts()[i] = fTraces[i].seekEvent(traceLocation); | |
874 | // context.getContexts()[i].setRank(traceRank); | |
875 | // rank += traceRank; | |
876 | // | |
877 | // // Set the trace location and read the corresponding event | |
878 | // /* | |
879 | // * The (TmfContext) cast should be safe since we created 'context' | |
880 | // * ourselves higher up. | |
881 | // */ | |
882 | // expLocation.getLocation().locations[i] = context.getContexts()[i].getLocation().clone(); | |
883 | // context.getEvents()[i] = fTraces[i].readNextEvent(context.getContexts()[i]); | |
884 | // } | |
885 | // | |
886 | // // Tracer.trace("Ctx: SeekLocation - done"); | |
887 | // | |
888 | // // Finalize context | |
889 | // context.setLocation(expLocation); | |
890 | // context.setLastTrace(TmfExperimentContext.NO_TRACE); | |
891 | // context.setRank(rank); | |
892 | // | |
893 | // fExperimentContext = context; | |
894 | // | |
895 | // return context; | |
896 | // } | |
897 | // | |
898 | // /* (non-Javadoc) | |
899 | // * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#seekEvent(org.eclipse.linuxtools .tmf.event.TmfTimestamp) | |
900 | // */ | |
901 | // @Override | |
902 | // public synchronized TmfExperimentContext seekEvent(ITmfTimestamp timestamp) { | |
903 | // | |
904 | // // Tracer.trace("Ctx: seekEvent(TS) - start"); | |
905 | // | |
906 | // if (timestamp == null) | |
907 | // timestamp = TmfTimestamp.BIG_BANG; | |
908 | // | |
909 | // // First, find the right checkpoint | |
910 | // int index = Collections.binarySearch(fCheckpoints, new TmfCheckpoint(timestamp, null)); | |
911 | // | |
912 | // // In the very likely case that the checkpoint was not found, bsearch | |
913 | // // returns its negated would-be location (not an offset...). From that | |
914 | // // index, we can then position the stream and get the event. | |
915 | // if (index < 0) | |
916 | // index = Math.max(0, -(index + 2)); | |
917 | // | |
918 | // // Position the experiment at the checkpoint | |
919 | // ITmfLocation<?> location; | |
920 | // synchronized (fCheckpoints) { | |
921 | // if (fCheckpoints.size() > 0) { | |
922 | // if (index >= fCheckpoints.size()) | |
923 | // index = fCheckpoints.size() - 1; | |
924 | // location = fCheckpoints.elementAt(index).getLocation(); | |
925 | // } else | |
926 | // location = null; | |
927 | // } | |
928 | // | |
929 | // final TmfExperimentContext context = seekEvent(location); | |
930 | // context.setRank((long) index * fIndexPageSize); | |
931 | // | |
932 | // // And locate the event | |
933 | // ITmfEvent event = parseEvent(context); | |
934 | // while ((event != null) && (event.getTimestamp().compareTo(timestamp, false) < 0)) { | |
935 | // readNextEvent(context); | |
936 | // event = parseEvent(context); | |
937 | // } | |
938 | // | |
939 | // if (event == null) { | |
940 | // context.setLocation(null); | |
941 | // context.setRank(ITmfContext.UNKNOWN_RANK); | |
942 | // } | |
943 | // | |
944 | // return context; | |
945 | // } | |
946 | // | |
947 | // /* (non-Javadoc) | |
948 | // * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#seekEvent(long) | |
949 | // */ | |
950 | // @Override | |
951 | // public synchronized TmfExperimentContext seekEvent(final long rank) { | |
952 | // | |
953 | // // Tracer.trace("Ctx: seekEvent(rank) - start"); | |
954 | // | |
955 | // // Position the stream at the previous checkpoint | |
956 | // int index = (int) rank / fIndexPageSize; | |
957 | // ITmfLocation<?> location; | |
958 | // synchronized (fCheckpoints) { | |
959 | // if (fCheckpoints.size() == 0) | |
960 | // location = null; | |
961 | // else { | |
962 | // if (index >= fCheckpoints.size()) | |
963 | // index = fCheckpoints.size() - 1; | |
964 | // location = fCheckpoints.elementAt(index).getLocation(); | |
965 | // } | |
966 | // } | |
967 | // | |
968 | // final TmfExperimentContext context = seekEvent(location); | |
969 | // context.setRank((long) index * fIndexPageSize); | |
970 | // | |
971 | // // And locate the event | |
972 | // ITmfEvent event = parseEvent(context); | |
973 | // long pos = context.getRank(); | |
974 | // while ((event != null) && (pos++ < rank)) { | |
975 | // readNextEvent(context); | |
976 | // event = parseEvent(context); | |
977 | // } | |
978 | // | |
979 | // if (event == null) { | |
980 | // context.setLocation(null); | |
981 | // context.setRank(ITmfContext.UNKNOWN_RANK); | |
982 | // } | |
983 | // | |
984 | // return context; | |
985 | // } | |
986 | // | |
987 | // @Override | |
988 | // public TmfContext seekEvent(final double ratio) { | |
989 | // final TmfContext context = seekEvent((long) (ratio * getNbEvents())); | |
990 | // return context; | |
991 | // } | |
992 | // | |
993 | // @Override | |
994 | // public double getLocationRatio(final ITmfLocation<?> location) { | |
995 | // if (location instanceof TmfExperimentLocation) | |
996 | // return (double) seekEvent(location).getRank() / getNbEvents(); | |
997 | // return 0; | |
998 | // } | |
999 | // | |
1000 | // @Override | |
1001 | // public ITmfLocation<?> getCurrentLocation() { | |
1002 | // if (fExperimentContext != null) | |
1003 | // return fExperimentContext.getLocation(); | |
1004 | // return null; | |
1005 | // } | |
1006 | // | |
1007 | // // private void dumpContext(TmfExperimentContext context, boolean isBefore) { | |
1008 | // // TmfContext context0 = context.getContexts()[0]; | |
1009 | // // TmfEvent event0 = context.getEvents()[0]; | |
1010 | // // TmfExperimentLocation location0 = (TmfExperimentLocation) context.getLocation(); | |
1011 | // // long rank0 = context.getRank(); | |
1012 | // // int trace = context.getLastTrace(); | |
1013 | // // | |
1014 | // // StringBuffer result = new StringBuffer("Ctx: " + (isBefore ? "B " : "A ")); | |
1015 | // // | |
1016 | // // result.append("[Ctx: fLoc= " + context0.getLocation().toString() + ", fRnk= " + context0.getRank() + "] "); | |
1017 | // // result.append("[Evt: " + event0.getTimestamp().toString() + "] "); | |
1018 | // // result.append("[Loc: fLoc= " + location0.getLocation()[0].toString() + ", fRnk= " + location0.getRanks()[0] + "] "); | |
1019 | // // result.append("[Rnk: " + rank0 + "], [Trc: " + trace + "]"); | |
1020 | // // Tracer.trace(result.toString()); | |
1021 | // // } | |
1022 | // | |
1023 | // /** | |
1024 | // * Scan the next events from all traces and return the next one in | |
1025 | // * chronological order. | |
1026 | // * | |
1027 | // * @param context the trace context | |
1028 | // * @return the next event | |
1029 | // */ | |
1030 | // @Override | |
1031 | // public synchronized ITmfEvent readNextEvent(final ITmfContext context) { | |
1032 | // | |
1033 | // // Validate the context | |
1034 | // if (!(context instanceof TmfExperimentContext)) | |
1035 | // return null; // Throw an exception? | |
1036 | // | |
1037 | // if (!context.equals(fExperimentContext)) | |
1038 | // // Tracer.trace("Ctx: Restoring context"); | |
1039 | // fExperimentContext = seekEvent(context.getLocation()); | |
1040 | // | |
1041 | // final TmfExperimentContext expContext = (TmfExperimentContext) context; | |
1042 | // | |
1043 | // // dumpContext(expContext, true); | |
1044 | // | |
1045 | // // If an event was consumed previously, get the next one from that trace | |
1046 | // final int lastTrace = expContext.getLastTrace(); | |
1047 | // if (lastTrace != TmfExperimentContext.NO_TRACE) { | |
1048 | // final ITmfContext traceContext = expContext.getContexts()[lastTrace]; | |
1049 | // expContext.getEvents()[lastTrace] = expContext.getTraces()[lastTrace].readNextEvent(traceContext); | |
1050 | // expContext.setLastTrace(TmfExperimentContext.NO_TRACE); | |
1051 | // } | |
1052 | // | |
1053 | // // Scan the candidate events and identify the "next" trace to read from | |
1054 | // final ITmfEvent eventArray[] = expContext.getEvents(); | |
1055 | // if (eventArray == null) | |
1056 | // return null; | |
1057 | // int trace = TmfExperimentContext.NO_TRACE; | |
1058 | // ITmfTimestamp timestamp = TmfTimestamp.BIG_CRUNCH; | |
1059 | // if (eventArray.length == 1) { | |
1060 | // if (eventArray[0] != null) { | |
1061 | // timestamp = eventArray[0].getTimestamp(); | |
1062 | // trace = 0; | |
1063 | // } | |
1064 | // } else | |
1065 | // for (int i = 0; i < eventArray.length; i++) { | |
1066 | // final ITmfEvent event = eventArray[i]; | |
1067 | // if (event != null && event.getTimestamp() != null) { | |
1068 | // final ITmfTimestamp otherTS = event.getTimestamp(); | |
1069 | // if (otherTS.compareTo(timestamp, true) < 0) { | |
1070 | // trace = i; | |
1071 | // timestamp = otherTS; | |
1072 | // } | |
1073 | // } | |
1074 | // } | |
1075 | // // Update the experiment context and set the "next" event | |
1076 | // ITmfEvent event = null; | |
1077 | // if (trace != TmfExperimentContext.NO_TRACE) { | |
1078 | // updateIndex(expContext, timestamp); | |
1079 | // | |
1080 | // final ITmfContext traceContext = expContext.getContexts()[trace]; | |
1081 | // final TmfExperimentLocation expLocation = (TmfExperimentLocation) expContext.getLocation(); | |
1082 | // // expLocation.getLocation()[trace] = traceContext.getLocation().clone(); | |
1083 | // expLocation.getLocation().locations[trace] = traceContext.getLocation().clone(); | |
1084 | // | |
1085 | // // updateIndex(expContext, timestamp); | |
1086 | // | |
1087 | // expLocation.getRanks()[trace] = traceContext.getRank(); | |
1088 | // expContext.setLastTrace(trace); | |
1089 | // expContext.increaseRank(); | |
1090 | // event = expContext.getEvents()[trace]; | |
1091 | // fExperimentContext = expContext; | |
1092 | // } | |
1093 | // | |
1094 | // // if (event != null) { | |
1095 | // // Tracer.trace("Exp: " + (expContext.getRank() - 1) + ": " + event.getTimestamp().toString()); | |
1096 | // // dumpContext(expContext, false); | |
1097 | // // Tracer.trace("Ctx: Event returned= " + event.getTimestamp().toString()); | |
1098 | // // } | |
1099 | // | |
1100 | // return event; | |
1101 | // } | |
1102 | // | |
1103 | // public synchronized void updateIndex(final ITmfContext context, final ITmfTimestamp timestamp) { | |
1104 | // // Build the index as we go along | |
1105 | // final long rank = context.getRank(); | |
1106 | // if (context.hasValidRank() && (rank % fIndexPageSize) == 0) { | |
1107 | // // Determine the table position | |
1108 | // final long position = rank / fIndexPageSize; | |
1109 | // // Add new entry at proper location (if empty) | |
1110 | // if (fCheckpoints.size() == position) { | |
1111 | // final ITmfLocation<?> location = context.getLocation().clone(); | |
1112 | // fCheckpoints.add(new TmfCheckpoint(timestamp.clone(), location)); | |
1113 | // // System.out.println(this + "[" + (fCheckpoints.size() - 1) + "] " + timestamp + ", " | |
1114 | // // + location.toString()); | |
1115 | // } | |
1116 | // } | |
1117 | // } | |
1118 | // | |
1119 | // /* (non-Javadoc) | |
1120 | // * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#parseEvent(org.eclipse.linuxtools .tmf.trace.TmfContext) | |
1121 | // */ | |
1122 | //// @Override | |
1123 | // public ITmfEvent parseEvent(final ITmfContext context) { | |
1124 | // | |
1125 | // // Validate the context | |
1126 | // if (!(context instanceof TmfExperimentContext)) | |
1127 | // return null; // Throw an exception? | |
1128 | // | |
1129 | // if (!context.equals(fExperimentContext)) | |
1130 | // // Tracer.trace("Ctx: Restoring context"); | |
1131 | // seekEvent(context.getLocation()); | |
1132 | // | |
1133 | // final TmfExperimentContext expContext = (TmfExperimentContext) context; | |
1134 | // | |
1135 | // // If an event was consumed previously, get the next one from that trace | |
1136 | // final int lastTrace = expContext.getLastTrace(); | |
1137 | // if (lastTrace != TmfExperimentContext.NO_TRACE) { | |
1138 | // final ITmfContext traceContext = expContext.getContexts()[lastTrace]; | |
1139 | // expContext.getEvents()[lastTrace] = expContext.getTraces()[lastTrace].readNextEvent(traceContext); | |
1140 | // expContext.setLastTrace(TmfExperimentContext.NO_TRACE); | |
1141 | // fExperimentContext = (TmfExperimentContext) context; | |
1142 | // } | |
1143 | // | |
1144 | // // Scan the candidate events and identify the "next" trace to read from | |
1145 | // int trace = TmfExperimentContext.NO_TRACE; | |
1146 | // ITmfTimestamp timestamp = TmfTimestamp.BIG_CRUNCH; | |
1147 | // for (int i = 0; i < expContext.getTraces().length; i++) { | |
1148 | // final ITmfEvent event = expContext.getEvents()[i]; | |
1149 | // if (event != null && event.getTimestamp() != null) { | |
1150 | // final ITmfTimestamp otherTS = event.getTimestamp(); | |
1151 | // if (otherTS.compareTo(timestamp, true) < 0) { | |
1152 | // trace = i; | |
1153 | // timestamp = otherTS; | |
1154 | // } | |
1155 | // } | |
1156 | // } | |
1157 | // | |
1158 | // ITmfEvent event = null; | |
1159 | // if (trace != TmfExperimentContext.NO_TRACE) | |
1160 | // event = expContext.getEvents()[trace]; | |
1161 | // | |
1162 | // return event; | |
1163 | // } | |
1164 | // | |
1165 | // /* (non-Javadoc) | |
1166 | // * @see java.lang.Object#toString() | |
1167 | // */ | |
1168 | // @Override | |
1169 | // @SuppressWarnings("nls") | |
1170 | // public String toString() { | |
1171 | // return "[TmfExperiment (" + getName() + ")]"; | |
1172 | // } | |
1173 | // | |
1174 | // // ------------------------------------------------------------------------ | |
1175 | // // Indexing | |
1176 | // // ------------------------------------------------------------------------ | |
1177 | // | |
1178 | // private synchronized void initializeStreamingMonitor() { | |
1179 | // if (fInitialized) | |
1180 | // return; | |
1181 | // fInitialized = true; | |
1182 | // | |
1183 | // if (getStreamingInterval() == 0) { | |
1184 | // final TmfContext context = seekEvent(0); | |
1185 | // final ITmfEvent event = getNext(context); | |
1186 | // if (event == null) | |
1187 | // return; | |
1188 | // final TmfTimeRange timeRange = new TmfTimeRange(event.getTimestamp().clone(), TmfTimestamp.BIG_CRUNCH); | |
1189 | // final TmfExperimentRangeUpdatedSignal signal = new TmfExperimentRangeUpdatedSignal(this, this, timeRange); | |
1190 | // | |
1191 | // // Broadcast in separate thread to prevent deadlock | |
1192 | // new Thread() { | |
1193 | // @Override | |
1194 | // public void run() { | |
1195 | // broadcast(signal); | |
1196 | // } | |
1197 | // }.start(); | |
1198 | // return; | |
1199 | // } | |
1200 | // | |
1201 | // final Thread thread = new Thread("Streaming Monitor for experiment " + getName()) { ////$NON-NLS-1$ | |
1202 | // private ITmfTimestamp safeTimestamp = null; | |
1203 | // private TmfTimeRange timeRange = null; | |
1204 | // | |
1205 | // @Override | |
1206 | // public void run() { | |
1207 | // while (!fExecutor.isShutdown()) { | |
1208 | // if (!isIndexingBusy()) { | |
1209 | // ITmfTimestamp startTimestamp = TmfTimestamp.BIG_CRUNCH; | |
1210 | // ITmfTimestamp endTimestamp = TmfTimestamp.BIG_BANG; | |
1211 | // for (final ITmfTrace<T> trace : fTraces) { | |
1212 | // if (trace.getStartTime().compareTo(startTimestamp) < 0) | |
1213 | // startTimestamp = trace.getStartTime(); | |
1214 | // if (trace.getStreamingInterval() != 0 && trace.getEndTime().compareTo(endTimestamp) > 0) | |
1215 | // endTimestamp = trace.getEndTime(); | |
1216 | // } | |
1217 | // if (safeTimestamp != null && safeTimestamp.compareTo(getTimeRange().getEndTime(), false) > 0) | |
1218 | // timeRange = new TmfTimeRange(startTimestamp, safeTimestamp); | |
1219 | // else | |
1220 | // timeRange = null; | |
1221 | // safeTimestamp = endTimestamp; | |
1222 | // if (timeRange != null) { | |
1223 | // final TmfExperimentRangeUpdatedSignal signal = | |
1224 | // new TmfExperimentRangeUpdatedSignal(TmfExperiment.this, TmfExperiment.this, timeRange); | |
1225 | // broadcast(signal); | |
1226 | // } | |
1227 | // } | |
1228 | // try { | |
1229 | // Thread.sleep(getStreamingInterval()); | |
1230 | // } catch (final InterruptedException e) { | |
1231 | // e.printStackTrace(); | |
1232 | // } | |
1233 | // } | |
1234 | // } | |
1235 | // }; | |
1236 | // thread.start(); | |
1237 | // } | |
1238 | // | |
1239 | // /* | |
1240 | // * (non-Javadoc) | |
1241 | // * | |
1242 | // * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#getStreamingInterval() | |
1243 | // */ | |
1244 | // @Override | |
1245 | // public long getStreamingInterval() { | |
1246 | // long interval = 0; | |
1247 | // for (final ITmfTrace<T> trace : fTraces) | |
1248 | // interval = Math.max(interval, trace.getStreamingInterval()); | |
1249 | // return interval; | |
1250 | // } | |
1251 | // | |
1252 | // /* | |
1253 | // * The experiment holds the globally ordered events of its set of traces. It | |
1254 | // * is expected to provide access to each individual event by index i.e. it | |
1255 | // * must be possible to request the Nth event of the experiment. | |
1256 | // * | |
1257 | // * The purpose of the index is to keep the information needed to rapidly | |
1258 | // * restore the traces contexts at regular intervals (every INDEX_PAGE_SIZE | |
1259 | // * event). | |
1260 | // */ | |
1261 | // | |
1262 | // // The index page size | |
1263 | // private static final int DEFAULT_INDEX_PAGE_SIZE = 5000; | |
1264 | // protected int fIndexPageSize; | |
1265 | // protected boolean fIndexing = false; | |
1266 | // protected TmfTimeRange fIndexingPendingRange = TmfTimeRange.NULL_RANGE; | |
1267 | // | |
1268 | // private Integer fEndSynchReference; | |
1269 | // | |
1270 | // // private static BufferedWriter fEventLog = null; | |
1271 | // // private static BufferedWriter openLogFile(String filename) { | |
1272 | // // BufferedWriter outfile = null; | |
1273 | // // try { | |
1274 | // // outfile = new BufferedWriter(new FileWriter(filename)); | |
1275 | // // } catch (IOException e) { | |
1276 | // // e.printStackTrace(); | |
1277 | // // } | |
1278 | // // return outfile; | |
1279 | // // } | |
1280 | // | |
1281 | // protected boolean isIndexingBusy() { | |
1282 | // synchronized (fCheckpoints) { | |
1283 | // return fIndexing; | |
1284 | // } | |
1285 | // } | |
1286 | // | |
1287 | // @SuppressWarnings("unchecked") | |
1288 | // private void indexExperiment(final boolean waitForCompletion, final int index, final TmfTimeRange timeRange) { | |
1289 | // | |
1290 | // synchronized (fCheckpoints) { | |
1291 | // if (fIndexing) | |
1292 | // return; | |
1293 | // fIndexing = true; | |
1294 | // } | |
1295 | // | |
1296 | // final Job job = new Job("Indexing " + getName() + "...") { //$NON-NLS-1$ //$NON-NLS-2$ | |
1297 | // | |
1298 | // @Override | |
1299 | // protected IStatus run(final IProgressMonitor monitor) { | |
1300 | // while (!monitor.isCanceled()) | |
1301 | // try { | |
1302 | // Thread.sleep(100); | |
1303 | // } catch (final InterruptedException e) { | |
1304 | // return Status.OK_STATUS; | |
1305 | // } | |
1306 | // monitor.done(); | |
1307 | // return Status.OK_STATUS; | |
1308 | // } | |
1309 | // }; | |
1310 | // job.schedule(); | |
1311 | // | |
1312 | // // fEventLog = openLogFile("TraceEvent.log"); | |
1313 | // // System.out.println(System.currentTimeMillis() + ": Experiment indexing started"); | |
1314 | // | |
1315 | // final ITmfEventRequest<ITmfEvent> request = new TmfEventRequest<ITmfEvent>(ITmfEvent.class, timeRange, index, | |
1316 | // TmfDataRequest.ALL_DATA, | |
1317 | // fIndexPageSize, ITmfDataRequest.ExecutionType.BACKGROUND) { // PATA | |
1318 | // // FOREGROUND | |
1319 | // | |
1320 | // // long indexingStart = System.nanoTime(); | |
1321 | // | |
1322 | // ITmfTimestamp startTime = (fTimeRange == TmfTimeRange.NULL_RANGE) ? null : fTimeRange.getStartTime(); | |
1323 | // ITmfTimestamp lastTime = (fTimeRange == TmfTimeRange.NULL_RANGE) ? null : fTimeRange.getEndTime(); | |
1324 | // long initialNbEvents = fNbEvents; | |
1325 | // | |
1326 | // @Override | |
1327 | // public void handleStarted() { | |
1328 | // super.handleStarted(); | |
1329 | // } | |
1330 | // | |
1331 | // @Override | |
1332 | // public void handleData(final ITmfEvent event) { | |
1333 | // super.handleData(event); | |
1334 | // if (event != null) { | |
1335 | // final ITmfTimestamp ts = event.getTimestamp(); | |
1336 | // if (startTime == null) | |
1337 | // startTime = ts.clone(); | |
1338 | // lastTime = ts.clone(); | |
1339 | // } | |
1340 | // if ((getNbRead() % fIndexPageSize) == 1 && getNbRead() != 1) | |
1341 | // updateExperiment(); | |
1342 | // } | |
1343 | // | |
1344 | // @Override | |
1345 | // public void handleSuccess() { | |
1346 | // // long indexingEnd = System.nanoTime(); | |
1347 | // | |
1348 | // // if the end time is a real value then it is the streaming safe | |
1349 | // // time stamp | |
1350 | // // set the last time to the safe time stamp to prevent | |
1351 | // // unnecessary indexing requests | |
1352 | // if (getRange().getEndTime() != TmfTimestamp.BIG_CRUNCH) | |
1353 | // lastTime = getRange().getEndTime(); | |
1354 | // updateExperiment(); | |
1355 | // // System.out.println(System.currentTimeMillis() + ": Experiment indexing completed"); | |
1356 | // | |
1357 | // // long average = (indexingEnd - indexingStart) / fNbEvents; | |
1358 | // // System.out.println(getName() + ": start=" + startTime + ", end=" + lastTime + ", elapsed=" | |
1359 | // // + (indexingEnd * 1.0 - indexingStart) / 1000000000); | |
1360 | // // System.out.println(getName() + ": nbEvents=" + fNbEvents + " (" + (average / 1000) + "." | |
1361 | // // + (average % 1000) + " us/evt)"); | |
1362 | // super.handleSuccess(); | |
1363 | // } | |
1364 | // | |
1365 | // @Override | |
1366 | // public void handleCompleted() { | |
1367 | // job.cancel(); | |
1368 | // super.handleCompleted(); | |
1369 | // synchronized (fCheckpoints) { | |
1370 | // fIndexing = false; | |
1371 | // if (fIndexingPendingRange != TmfTimeRange.NULL_RANGE) { | |
1372 | // indexExperiment(false, (int) fNbEvents, fIndexingPendingRange); | |
1373 | // fIndexingPendingRange = TmfTimeRange.NULL_RANGE; | |
1374 | // } | |
1375 | // } | |
1376 | // } | |
1377 | // | |
1378 | // private void updateExperiment() { | |
1379 | // final int nbRead = getNbRead(); | |
1380 | // if (startTime != null) | |
1381 | // fTimeRange = new TmfTimeRange(startTime, lastTime.clone()); | |
1382 | // if (nbRead != 0) { | |
1383 | // // updateTimeRange(); | |
1384 | // // updateNbEvents(); | |
1385 | // fNbEvents = initialNbEvents + nbRead; | |
1386 | // notifyListeners(); | |
1387 | // } | |
1388 | // } | |
1389 | // }; | |
1390 | // | |
1391 | // sendRequest((ITmfDataRequest<T>) request); | |
1392 | // if (waitForCompletion) | |
1393 | // try { | |
1394 | // request.waitForCompletion(); | |
1395 | // } catch (final InterruptedException e) { | |
1396 | // e.printStackTrace(); | |
1397 | // } | |
1398 | // } | |
1399 | // | |
1400 | // protected void notifyListeners() { | |
1401 | // broadcast(new TmfExperimentUpdatedSignal(this, this)); // , null)); | |
1402 | // // broadcast(new TmfExperimentRangeUpdatedSignal(this, this, | |
1403 | // // fTimeRange)); // , null)); | |
1404 | // } | |
1405 | // | |
1406 | // // ------------------------------------------------------------------------ | |
1407 | // // Signal handlers | |
1408 | // // ------------------------------------------------------------------------ | |
1409 | // | |
1410 | // @TmfSignalHandler | |
1411 | // public void experimentSelected(final TmfExperimentSelectedSignal<T> signal) { | |
1412 | // final TmfExperiment<?> experiment = signal.getExperiment(); | |
1413 | // if (experiment == this) { | |
1414 | // setCurrentExperiment(experiment); | |
1415 | // fEndSynchReference = Integer.valueOf(signal.getReference()); | |
1416 | // } | |
1417 | // } | |
1418 | // | |
1419 | // @TmfSignalHandler | |
1420 | // public void endSync(final TmfEndSynchSignal signal) { | |
1421 | // if (fEndSynchReference != null && fEndSynchReference.intValue() == signal.getReference()) { | |
1422 | // fEndSynchReference = null; | |
1423 | // initializeStreamingMonitor(); | |
1424 | // } | |
1425 | // } | |
1426 | // | |
1427 | // @TmfSignalHandler | |
1428 | // public void experimentUpdated(final TmfExperimentUpdatedSignal signal) { | |
1429 | // } | |
1430 | // | |
1431 | // @TmfSignalHandler | |
1432 | // public void experimentRangeUpdated(final TmfExperimentRangeUpdatedSignal signal) { | |
1433 | // if (signal.getExperiment() == this) | |
1434 | // indexExperiment(false, (int) fNbEvents, signal.getRange()); | |
1435 | // } | |
1436 | // | |
1437 | // @TmfSignalHandler | |
1438 | // public void traceUpdated(final TmfTraceUpdatedSignal signal) { | |
1439 | // for (final ITmfTrace<T> trace : fTraces) | |
1440 | // if (trace == signal.getTrace()) { | |
1441 | // synchronized (fCheckpoints) { | |
1442 | // if (fIndexing) { | |
1443 | // if (fIndexingPendingRange == TmfTimeRange.NULL_RANGE) | |
1444 | // fIndexingPendingRange = signal.getRange(); | |
1445 | // else { | |
1446 | // ITmfTimestamp startTime = fIndexingPendingRange.getStartTime(); | |
1447 | // ITmfTimestamp endTime = fIndexingPendingRange.getEndTime(); | |
1448 | // if (signal.getRange().getStartTime().compareTo(startTime) < 0) | |
1449 | // startTime = signal.getRange().getStartTime(); | |
1450 | // if (signal.getRange().getEndTime().compareTo(endTime) > 0) | |
1451 | // endTime = signal.getRange().getEndTime(); | |
1452 | // fIndexingPendingRange = new TmfTimeRange(startTime, endTime); | |
1453 | // } | |
1454 | // return; | |
1455 | // } | |
1456 | // } | |
1457 | // indexExperiment(false, (int) fNbEvents, signal.getRange()); | |
1458 | // return; | |
1459 | // } | |
1460 | // } | |
1461 | // | |
1462 | // @Override | |
1463 | // public String getPath() { | |
1464 | // // TODO Auto-generated method stub | |
1465 | // return null; | |
1466 | // } | |
1467 | // | |
1468 | // /** | |
1469 | // * Set the file to be used for bookmarks on this experiment | |
1470 | // * | |
1471 | // * @param file the bookmarks file | |
1472 | // */ | |
1473 | // public void setBookmarksFile(final IFile file) { | |
1474 | // fBookmarksFile = file; | |
1475 | // } | |
1476 | // | |
1477 | // /** | |
1478 | // * Get the file used for bookmarks on this experiment | |
1479 | // * | |
1480 | // * @return the bookmarks file or null if none is set | |
1481 | // */ | |
1482 | // public IFile getBookmarksFile() { | |
1483 | // return fBookmarksFile; | |
1484 | // } | |
1485 | // | |
1486 | // /* | |
1487 | // * (non-Javadoc) | |
1488 | // * | |
1489 | // * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getResource() | |
1490 | // */ | |
1491 | // @Override | |
1492 | // public IResource getResource() { | |
1493 | // return fResource; | |
1494 | // } | |
1495 | //} |