Fix for bug 381411: Implement ranked location in experiment.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / trace / TmfExperiment.java
CommitLineData
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
9e0640dc 14package org.eclipse.linuxtools.tmf.core.trace;
8c8bf09f 15
a1091415 16import org.eclipse.core.resources.IFile;
12c155f5 17import org.eclipse.core.resources.IProject;
828e5592 18import org.eclipse.core.resources.IResource;
9e0640dc
FC
19import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentContext;
20import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentLocation;
21import org.eclipse.linuxtools.internal.tmf.core.trace.TmfLocationArray;
9a7f542f 22import org.eclipse.linuxtools.internal.tmf.core.trace.TmfRankedLocation;
72f1e62a 23import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
4df4581d 24import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
6c13869b
FC
25import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
26import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
0316808c 27import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
49e2f79a
FC
28import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
29import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
1b70b6dc 30import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal;
6c13869b
FC
31import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentDisposedSignal;
32import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal;
33import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentSelectedSignal;
34import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentUpdatedSignal;
35import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
c32744d6 36import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
8c8bf09f
ASL
37
38/**
9e0640dc 39 * TmfExperiment presents a time-ordered, unified view of a set of ITmfTrace:s
cbdacf03 40 * that are part of a tracing experiment.
4b7b3670
FC
41 *
42 * @version 1.0
43 * @author Francois Chouinard
8c8bf09f 44 */
0316808c 45public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements ITmfEventParser<T> {
8c8bf09f 46
c32744d6
FC
47 // ------------------------------------------------------------------------
48 // Constants
49 // ------------------------------------------------------------------------
50
9e0640dc
FC
51 /**
52 * The default index page size
53 */
54 public static final int DEFAULT_INDEX_PAGE_SIZE = 5000;
c32744d6 55
8c8bf09f
ASL
56 // ------------------------------------------------------------------------
57 // Attributes
58 // ------------------------------------------------------------------------
59
9e0640dc
FC
60 /**
61 * The currently selected experiment (null if none)
62 */
c32744d6 63 protected static TmfExperiment<?> fCurrentExperiment = null;
e31e01e8 64
9e0640dc
FC
65 /**
66 * The set of traces that constitute the experiment
67 */
c32744d6 68 protected ITmfTrace<T>[] fTraces;
8c8bf09f 69
9e0640dc
FC
70 /**
71 * The set of traces that constitute the experiment
72 */
73 private boolean fInitialized = false;
a1091415 74
9e0640dc
FC
75 /**
76 * The experiment bookmarks file
77 */
78 private IFile fBookmarksFile;
828e5592 79
49e2f79a
FC
80
81 // Saved experiment context (optimization)
82 private TmfExperimentContext fExperimentContext;
83
8c8bf09f 84 // ------------------------------------------------------------------------
9e0640dc 85 // Construction
8c8bf09f
ASL
86 // ------------------------------------------------------------------------
87
9e0640dc
FC
88 /**
89 * @param type
90 * @param id
91 * @param traces
92 * @throws TmfTraceException
93 */
94 public TmfExperiment(final Class<T> type, final String id, final ITmfTrace<T>[] traces) {
95 this(type, id, traces, DEFAULT_INDEX_PAGE_SIZE);
96c6806f
PT
96 }
97
8c8bf09f
ASL
98 /**
99 * @param type
100 * @param id
101 * @param traces
8c8bf09f 102 * @param indexPageSize
0316808c 103 * @throws TmfTraceException
8c8bf09f 104 */
0316808c 105 @SuppressWarnings({ "unchecked", "rawtypes" })
9e0640dc 106 public TmfExperiment(final Class<T> type, final String path, final ITmfTrace<T>[] traces, final int indexPageSize) {
0316808c
FC
107 setCacheSize(indexPageSize);
108 setStreamingInterval(0);
07671572 109 setIndexer(new TmfCheckpointIndexer(this, indexPageSize));
0316808c
FC
110 setParser(this);
111 try {
112 super.initialize(null, path, type);
113 } catch (TmfTraceException e) {
114 e.printStackTrace();
115 }
8c8bf09f 116
a79913eb 117 fTraces = traces;
a87cc4ef 118 setTimeRange(TmfTimeRange.NULL_RANGE);
8c8bf09f 119 }
a79913eb 120
8c8bf09f 121 /**
ff4ed569 122 * Clears the experiment
8c8bf09f
ASL
123 */
124 @Override
12c155f5 125 @SuppressWarnings("rawtypes")
a79913eb
FC
126 public synchronized void dispose() {
127
cbdacf03 128 final TmfExperimentDisposedSignal<T> signal = new TmfExperimentDisposedSignal<T>(this, this);
a79913eb 129 broadcast(signal);
9e0640dc
FC
130
131 if (fCurrentExperiment == this) {
09d11238 132 fCurrentExperiment = null;
9e0640dc 133 }
a79913eb 134
77551cc2
FC
135 // Clean up the index if applicable
136 if (getIndexer() != null) {
137 getIndexer().dispose();
138 }
b5ee6881 139
a79913eb 140 if (fTraces != null) {
cbdacf03 141 for (final ITmfTrace trace : fTraces)
a79913eb 142 trace.dispose();
a79913eb
FC
143 fTraces = null;
144 }
2fb2eb37 145 super.dispose();
8c8bf09f
ASL
146 }
147
9e0640dc
FC
148 // ------------------------------------------------------------------------
149 // ITmfTrace - Initializers
150 // ------------------------------------------------------------------------
151
152 /* (non-Javadoc)
153 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)
154 */
155 @Override
156 public boolean validate(final IProject project, final String path) {
157 return true;
158 }
159
160 /* (non-Javadoc)
161 * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#initTrace(org.eclipse.core.resources.IResource, java.lang.String, java.lang.Class)
162 */
163 @Override
164 public void initTrace(final IResource resource, final String path, final Class<T> type) {
165 }
166
8c8bf09f 167 // ------------------------------------------------------------------------
e31e01e8 168 // Accessors
8c8bf09f
ASL
169 // ------------------------------------------------------------------------
170
9e0640dc
FC
171 /**
172 * Selects the current, framework-wide, experiment
173 *
174 * @param experiment das experiment
175 */
cbdacf03 176 public static void setCurrentExperiment(final TmfExperiment<?> experiment) {
9e0640dc 177 if (fCurrentExperiment != null && fCurrentExperiment != experiment) {
09d11238 178 fCurrentExperiment.dispose();
9e0640dc 179 }
a79913eb 180 fCurrentExperiment = experiment;
f6b14ce2
FC
181 }
182
9e0640dc
FC
183 /**
184 * @return das experiment
185 */
e31e01e8 186 public static TmfExperiment<?> getCurrentExperiment() {
a79913eb 187 return fCurrentExperiment;
8c8bf09f
ASL
188 }
189
9e0640dc
FC
190 /**
191 * Get the list of traces. Handle with care...
192 *
193 * @return the experiment traces
194 */
12c155f5 195 public ITmfTrace<T>[] getTraces() {
a79913eb 196 return fTraces;
8c8bf09f
ASL
197 }
198
8c8bf09f 199 /**
cbdacf03
FC
200 * Returns the timestamp of the event at the requested index. If none,
201 * returns null.
a79913eb 202 *
0d9a6d76
FC
203 * @param index the event index (rank)
204 * @return the corresponding event timestamp
8c8bf09f 205 */
cbdacf03 206 public ITmfTimestamp getTimestamp(final int index) {
0316808c 207 final ITmfContext context = seekEvent(index);
c32744d6 208 final ITmfEvent event = getNext(context);
a79913eb 209 return (event != null) ? event.getTimestamp() : null;
8c8bf09f
ASL
210 }
211
9e0640dc
FC
212 /**
213 * Set the file to be used for bookmarks on this experiment
214 *
215 * @param file the bookmarks file
216 */
217 public void setBookmarksFile(final IFile file) {
218 fBookmarksFile = file;
219 }
07671572 220
9e0640dc
FC
221 /**
222 * Get the file used for bookmarks on this experiment
223 *
224 * @return the bookmarks file or null if none is set
225 */
226 public IFile getBookmarksFile() {
227 return fBookmarksFile;
a79913eb
FC
228 }
229
49e2f79a
FC
230 // ------------------------------------------------------------------------
231 // Request management
232 // ------------------------------------------------------------------------
233
3bd44ac8
FC
234 /* (non-Javadoc)
235 * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#armRequest(org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest)
236 */
49e2f79a 237 @Override
408e65d2 238 protected synchronized ITmfContext armRequest(final ITmfDataRequest<T> request) {
6a953367
BH
239
240 // Make sure we have something to read from
241 if (fTraces == null) {
242 return null;
243 }
244
49e2f79a
FC
245 if (request instanceof ITmfEventRequest<?>
246 && !TmfTimestamp.BIG_BANG.equals(((ITmfEventRequest<T>) request).getRange().getStartTime())
247 && request.getIndex() == 0)
248 {
249 final ITmfContext context = seekEvent(((ITmfEventRequest<T>) request).getRange().getStartTime());
250 ((ITmfEventRequest<T>) request).setStartIndex((int) context.getRank());
251 return context;
252
253 }
254
255 // Check if we are already at the right index
256 if ((fExperimentContext != null) && fExperimentContext.getRank() == request.getIndex()) {
257 return fExperimentContext;
258 }
259
260 return seekEvent(request.getIndex());
261 }
262
a79913eb 263 // ------------------------------------------------------------------------
9f584e4c
FC
264 // ITmfTrace trace positioning
265 // ------------------------------------------------------------------------
266
9e0640dc
FC
267 /* (non-Javadoc)
268 *
269 * Returns a brand new context based on the location provided and
270 * initializes the event queues
271 *
272 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfLocation)
273 */
a79913eb 274 @Override
9e0640dc 275 public synchronized ITmfContext seekEvent(final ITmfLocation<?> location) {
a79913eb 276 // Validate the location
9e0640dc 277 if (location != null && !(location instanceof TmfExperimentLocation)) {
a79913eb 278 return null; // Throw an exception?
9e0640dc
FC
279 }
280 // Make sure we have something to read from
281 if (fTraces == null) {
a79913eb 282 return null;
9e0640dc 283 }
8f50c396 284
a79913eb 285 // Instantiate the location
9e0640dc 286 final TmfExperimentLocation expLocation = (location == null)
9a7f542f 287 ? new TmfExperimentLocation(new TmfLocationArray(new TmfRankedLocation[fTraces.length]))
9e0640dc 288 : (TmfExperimentLocation) location.clone();
8f50c396 289
a79913eb 290 // Create and populate the context's traces contexts
0316808c 291 final TmfExperimentContext context = new TmfExperimentContext(new ITmfContext[fTraces.length]);
9b635e61 292
9a7f542f 293 long rank = 0;
a79913eb
FC
294 for (int i = 0; i < fTraces.length; i++) {
295 // Get the relevant trace attributes
9a7f542f
PT
296 final TmfRankedLocation rankedLocation = expLocation.getLocation().getLocations()[i];
297 final ITmfLocation<?> traceLocation = (rankedLocation == null) ? null : rankedLocation.getLocation();
298 final long traceRank = (rankedLocation == null) ? 0 : rankedLocation.getRank();
299 context.getContexts()[i] = fTraces[i].seekEvent(traceLocation);
300 context.getContexts()[i].setRank(traceRank);
301 expLocation.getLocation().getLocations()[i] = new TmfRankedLocation(context.getContexts()[i]);
c32744d6 302 context.getEvents()[i] = fTraces[i].getNext(context.getContexts()[i]);
9a7f542f 303 rank += traceRank;
a79913eb 304 }
8f50c396 305
a79913eb
FC
306 // Finalize context
307 context.setLocation(expLocation);
308 context.setLastTrace(TmfExperimentContext.NO_TRACE);
9a7f542f 309 context.setRank(rank);
49e2f79a
FC
310
311 fExperimentContext = context;
9e0640dc 312 return (ITmfContext) context;
a79913eb 313 }
9f584e4c 314
3bd44ac8
FC
315 // ------------------------------------------------------------------------
316 // ITmfTrace - SeekEvent operations (returning a trace context)
317 // ------------------------------------------------------------------------
318
9e0640dc
FC
319 /* (non-Javadoc)
320 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(double)
321 */
c76c54bb 322 @Override
0316808c
FC
323 public ITmfContext seekEvent(final double ratio) {
324 final ITmfContext context = seekEvent((long) (ratio * getNbEvents()));
c76c54bb
FC
325 return context;
326 }
327
9e0640dc
FC
328 /* (non-Javadoc)
329 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getLocationRatio(org.eclipse.linuxtools.tmf.core.trace.ITmfLocation)
330 */
a79913eb 331 @Override
cbdacf03 332 public double getLocationRatio(final ITmfLocation<?> location) {
9e0640dc 333 if (location instanceof TmfExperimentLocation) {
9a7f542f
PT
334 long rank = 0;
335 for (TmfRankedLocation rankedLocation : ((TmfExperimentLocation) location).getLocation().getLocations()) {
336 rank += rankedLocation.getRank();
337 }
338 return (double) rank / getNbEvents();
9e0640dc
FC
339 }
340 return 0.0;
c76c54bb
FC
341 }
342
9e0640dc
FC
343 /* (non-Javadoc)
344 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentLocation()
345 */
a79913eb
FC
346 @Override
347 public ITmfLocation<?> getCurrentLocation() {
9a7f542f 348 TmfRankedLocation[] locations = new TmfRankedLocation[fTraces.length];
a87cc4ef 349 for (int i = 0; i < fTraces.length; i++) {
9a7f542f 350 locations[i] = new TmfRankedLocation(new TmfContext(fTraces[i].getCurrentLocation(), ITmfContext.UNKNOWN_RANK));
a87cc4ef
FC
351 }
352 return new TmfExperimentLocation(new TmfLocationArray(locations));
a79913eb 353 }
c76c54bb 354
9e0640dc
FC
355 // ------------------------------------------------------------------------
356 // ITmfTrace trace positioning
357 // ------------------------------------------------------------------------
358
07671572 359 /* (non-Javadoc)
408e65d2 360 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser#parseEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfContext)
07671572
FC
361 */
362 @Override
408e65d2
FC
363 public synchronized T parseEvent(final ITmfContext context) {
364 final ITmfContext savedContext = context.clone();
365 final T event = getNext(savedContext);
07671572
FC
366 return event;
367 }
a79913eb 368
ce2388e0 369 /* (non-Javadoc)
408e65d2 370 * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#getNext(org.eclipse.linuxtools.tmf.core.trace.ITmfContext)
a79913eb 371 */
0316808c 372 @Override
3bd44ac8 373 @SuppressWarnings("unchecked")
408e65d2 374 public synchronized T getNext(ITmfContext context) {
a79913eb
FC
375
376 // Validate the context
9e0640dc 377 if (!(context instanceof TmfExperimentContext)) {
a79913eb 378 return null; // Throw an exception?
9e0640dc 379 }
0e8c76f8
BH
380
381 // Make sure that we have something to read from
382 if (fTraces == null) {
383 return null;
384 }
385
a87cc4ef 386 TmfExperimentContext expContext = (TmfExperimentContext) context;
a79913eb 387
a87cc4ef 388 // If an event was consumed previously, first get the next one from that trace
cbdacf03 389 final int lastTrace = expContext.getLastTrace();
a79913eb 390 if (lastTrace != TmfExperimentContext.NO_TRACE) {
cbdacf03 391 final ITmfContext traceContext = expContext.getContexts()[lastTrace];
c32744d6 392 expContext.getEvents()[lastTrace] = fTraces[lastTrace].getNext(traceContext);
a79913eb 393 expContext.setLastTrace(TmfExperimentContext.NO_TRACE);
a79913eb
FC
394 }
395
396 // Scan the candidate events and identify the "next" trace to read from
397 int trace = TmfExperimentContext.NO_TRACE;
a4115405 398 ITmfTimestamp timestamp = TmfTimestamp.BIG_CRUNCH;
0316808c 399 for (int i = 0; i < fTraces.length; i++) {
cbdacf03 400 final ITmfEvent event = expContext.getEvents()[i];
a79913eb 401 if (event != null && event.getTimestamp() != null) {
cbdacf03 402 final ITmfTimestamp otherTS = event.getTimestamp();
a79913eb
FC
403 if (otherTS.compareTo(timestamp, true) < 0) {
404 trace = i;
405 timestamp = otherTS;
406 }
407 }
408 }
a87cc4ef
FC
409
410 T event = null;
07671572 411 if (trace != TmfExperimentContext.NO_TRACE) {
a87cc4ef 412 event = (T) expContext.getEvents()[trace];
408e65d2
FC
413 if (event != null) {
414 updateAttributes(expContext, event.getTimestamp());
408e65d2
FC
415 expContext.increaseRank();
416 expContext.setLastTrace(trace);
9a7f542f 417 final TmfExperimentLocation expLocation = (TmfExperimentLocation) expContext.getLocation();
1744ff0e 418 final ITmfContext traceContext = expContext.getContexts()[trace];
9a7f542f 419 expLocation.getLocation().getLocations()[trace] = new TmfRankedLocation(traceContext);
408e65d2
FC
420 fExperimentContext = expContext;
421 processEvent(event);
422 }
07671572 423 }
a87cc4ef 424
a87cc4ef 425 return event;
a79913eb
FC
426 }
427
bcbea6a6 428 /* (non-Javadoc)
a79913eb
FC
429 * @see java.lang.Object#toString()
430 */
431 @Override
3b38ea61 432 @SuppressWarnings("nls")
a79913eb
FC
433 public String toString() {
434 return "[TmfExperiment (" + getName() + ")]";
435 }
8c8bf09f
ASL
436
437 // ------------------------------------------------------------------------
9e0640dc 438 // Streaming support
8c8bf09f
ASL
439 // ------------------------------------------------------------------------
440
1b70b6dc 441 private synchronized void initializeStreamingMonitor() {
9e0640dc
FC
442
443 if (fInitialized) {
828e5592 444 return;
9e0640dc 445 }
828e5592
PT
446 fInitialized = true;
447
1b70b6dc 448 if (getStreamingInterval() == 0) {
0316808c 449 final ITmfContext context = seekEvent(0);
cbdacf03
FC
450 final ITmfEvent event = getNext(context);
451 if (event == null)
1b70b6dc 452 return;
cbdacf03 453 final TmfTimeRange timeRange = new TmfTimeRange(event.getTimestamp().clone(), TmfTimestamp.BIG_CRUNCH);
828e5592
PT
454 final TmfExperimentRangeUpdatedSignal signal = new TmfExperimentRangeUpdatedSignal(this, this, timeRange);
455
456 // Broadcast in separate thread to prevent deadlock
457 new Thread() {
458 @Override
459 public void run() {
460 broadcast(signal);
461 }
462 }.start();
1b70b6dc
PT
463 return;
464 }
465
9e0640dc 466 final Thread thread = new Thread("Streaming Monitor for experiment " + getName()) { //$NON-NLS-1$
bcbea6a6
FC
467 private ITmfTimestamp safeTimestamp = null;
468 private TmfTimeRange timeRange = null;
1b70b6dc
PT
469
470 @Override
471 public void run() {
472 while (!fExecutor.isShutdown()) {
9e0640dc 473 if (!getIndexer().isIndexing()) {
a4115405
FC
474 ITmfTimestamp startTimestamp = TmfTimestamp.BIG_CRUNCH;
475 ITmfTimestamp endTimestamp = TmfTimestamp.BIG_BANG;
cbdacf03
FC
476 for (final ITmfTrace<T> trace : fTraces) {
477 if (trace.getStartTime().compareTo(startTimestamp) < 0)
1b70b6dc 478 startTimestamp = trace.getStartTime();
cbdacf03 479 if (trace.getStreamingInterval() != 0 && trace.getEndTime().compareTo(endTimestamp) > 0)
1b70b6dc 480 endTimestamp = trace.getEndTime();
1b70b6dc 481 }
cbdacf03 482 if (safeTimestamp != null && safeTimestamp.compareTo(getTimeRange().getEndTime(), false) > 0)
1b70b6dc 483 timeRange = new TmfTimeRange(startTimestamp, safeTimestamp);
cbdacf03 484 else
1b70b6dc 485 timeRange = null;
1b70b6dc
PT
486 safeTimestamp = endTimestamp;
487 if (timeRange != null) {
cbdacf03 488 final TmfExperimentRangeUpdatedSignal signal =
1b70b6dc
PT
489 new TmfExperimentRangeUpdatedSignal(TmfExperiment.this, TmfExperiment.this, timeRange);
490 broadcast(signal);
491 }
492 }
493 try {
494 Thread.sleep(getStreamingInterval());
cbdacf03 495 } catch (final InterruptedException e) {
1b70b6dc
PT
496 e.printStackTrace();
497 }
498 }
499 }
500 };
501 thread.start();
502 }
503
9e0640dc 504 /* (non-Javadoc)
1b70b6dc
PT
505 * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#getStreamingInterval()
506 */
507 @Override
508 public long getStreamingInterval() {
509 long interval = 0;
cbdacf03 510 for (final ITmfTrace<T> trace : fTraces)
1b70b6dc 511 interval = Math.max(interval, trace.getStreamingInterval());
1b70b6dc
PT
512 return interval;
513 }
514
8c8bf09f
ASL
515 // ------------------------------------------------------------------------
516 // Signal handlers
517 // ------------------------------------------------------------------------
518
9e0640dc 519 private Integer fEndSynchReference;
c32744d6 520
9e0640dc
FC
521 /**
522 * Signal handler for the TmfExperimentSelectedSignal signal
523 *
524 * @param signal
525 */
8c8bf09f 526 @TmfSignalHandler
cbdacf03
FC
527 public void experimentSelected(final TmfExperimentSelectedSignal<T> signal) {
528 final TmfExperiment<?> experiment = signal.getExperiment();
a79913eb
FC
529 if (experiment == this) {
530 setCurrentExperiment(experiment);
6e85c58d 531 fEndSynchReference = Integer.valueOf(signal.getReference());
a79913eb 532 }
8c8bf09f
ASL
533 }
534
9e0640dc
FC
535 /**
536 * Signal handler for the TmfEndSynchSignal signal
537 *
538 * @param signal
539 */
1b70b6dc 540 @TmfSignalHandler
cbdacf03 541 public void endSync(final TmfEndSynchSignal signal) {
1b70b6dc
PT
542 if (fEndSynchReference != null && fEndSynchReference.intValue() == signal.getReference()) {
543 fEndSynchReference = null;
544 initializeStreamingMonitor();
545 }
1b70b6dc
PT
546 }
547
828e5592 548 /**
9e0640dc 549 * Signal handler for the TmfTraceUpdatedSignal signal
cbdacf03 550 *
9e0640dc 551 * @param signal
828e5592 552 */
9e0640dc
FC
553 @TmfSignalHandler
554 public void traceUpdated(final TmfTraceUpdatedSignal signal) {
555 if (signal.getTrace() == this) {
556 broadcast(new TmfExperimentUpdatedSignal(this, this));
557 }
a1091415
PT
558 }
559
560 /**
9e0640dc 561 * Signal handler for the TmfExperimentRangeUpdatedSignal signal
cbdacf03 562 *
9e0640dc 563 * @param signal
a1091415 564 */
9e0640dc
FC
565 @TmfSignalHandler
566 public void experimentRangeUpdated(final TmfExperimentRangeUpdatedSignal signal) {
567 if (signal.getExperiment() == this) {
568 getIndexer().buildIndex(getNbEvents(), signal.getRange(), false);
569 }
a1091415
PT
570 }
571
4dc47e28 572}
This page took 0.081953 seconds and 5 git commands to generate.