1 /*******************************************************************************
2 * Copyright (c) 2013, 2015 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Alexandre Montplaisir - Initial API and implementation
11 * Patrick Tasse - Support selection range
12 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.tmf
.ctf
.core
.tests
.temp
.tracemanager
;
16 import static org
.junit
.Assert
.assertEquals
;
17 import static org
.junit
.Assert
.assertNotNull
;
18 import static org
.junit
.Assert
.assertSame
;
20 import java
.util
.Collection
;
21 import java
.util
.Collections
;
22 import java
.util
.concurrent
.TimeUnit
;
24 import org
.eclipse
.jdt
.annotation
.NonNull
;
25 import org
.eclipse
.tracecompass
.testtraces
.ctf
.CtfTestTrace
;
26 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
27 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfSelectionRangeUpdatedSignal
;
28 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfSignalManager
;
29 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfTraceClosedSignal
;
30 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfTraceOpenedSignal
;
31 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfTraceSelectedSignal
;
32 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfWindowRangeUpdatedSignal
;
33 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.ITmfTimestamp
;
34 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.TmfTimeRange
;
35 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.TmfTimestamp
;
36 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
37 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceContext
;
38 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceManager
;
39 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.experiment
.TmfExperiment
;
40 import org
.eclipse
.tracecompass
.tmf
.ctf
.core
.tests
.shared
.CtfTmfTestTraceUtils
;
41 import org
.junit
.After
;
42 import org
.junit
.AfterClass
;
43 import org
.junit
.Before
;
44 import org
.junit
.BeforeClass
;
45 import org
.junit
.Rule
;
46 import org
.junit
.Test
;
47 import org
.junit
.rules
.TestRule
;
48 import org
.junit
.rules
.Timeout
;
50 import com
.google
.common
.collect
.ImmutableSet
;
53 * Test suite for the {@link TmfTraceManager}.
55 * @author Alexandre Montplaisir
57 public class TmfTraceManagerTest
{
59 /** Time-out tests after 1 minute. */
61 public TestRule globalTimeout
= new Timeout(1, TimeUnit
.MINUTES
);
63 private static ITmfTrace trace1
;
64 private static final long t1start
= 1331668247314038062L;
65 private static final long t1end
= 1331668259054285979L;
67 private static ITmfTrace trace2
;
68 private static final long t2start
= 1332170682440133097L;
69 private static final long t2end
= 1332170692664579801L;
71 private static final long ONE_SECOND
= 1000000000L;
73 private TmfTraceManager tm
;
76 * Test class initialization
79 public static void setUpClass() {
80 trace1
= CtfTmfTestTraceUtils
.getTrace(CtfTestTrace
.TRACE2
);
81 trace2
= CtfTmfTestTraceUtils
.getTrace(CtfTestTrace
.KERNEL
);
83 trace1
.indexTrace(true);
84 trace2
.indexTrace(true);
86 // Deregister traces from signal manager so that they don't
87 // interfere with the TmfTraceManager tests
88 TmfSignalManager
.deregister(trace1
);
89 TmfSignalManager
.deregister(trace2
);
97 tm
= TmfTraceManager
.getInstance();
104 public void tearDown() {
105 while (tm
.getActiveTrace() != null) {
106 closeTrace(tm
.getActiveTrace());
111 * Test class clean-up
114 public static void tearDownClass() {
115 CtfTmfTestTraceUtils
.dispose(CtfTestTrace
.TRACE2
);
116 CtfTmfTestTraceUtils
.dispose(CtfTestTrace
.KERNEL
);
119 // ------------------------------------------------------------------------
120 // Dummy actions (fake signals)
121 // ------------------------------------------------------------------------
123 private void openTrace(ITmfTrace trace
) {
125 throw new IllegalArgumentException();
127 TmfSignalManager
.dispatchSignal(new TmfTraceOpenedSignal(this, trace
, null));
131 private void closeTrace(ITmfTrace trace
) {
133 throw new IllegalArgumentException();
135 TmfSignalManager
.dispatchSignal(new TmfTraceClosedSignal(this, trace
));
137 * In TMF, the next tab would now be selected (if there are some), which
138 * would select another trace automatically.
140 if (tm
.getOpenedTraces().size() > 0) {
141 selectTrace(tm
.getOpenedTraces().toArray(new ITmfTrace
[0])[0]);
145 private void selectTrace(ITmfTrace trace
) {
146 TmfSignalManager
.dispatchSignal(new TmfTraceSelectedSignal(this, trace
));
149 private void selectTimestamp(@NonNull ITmfTimestamp ts
) {
150 TmfSignalManager
.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, ts
));
153 private void selectWindowRange(TmfTimeRange tr
) {
154 TmfSignalManager
.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, tr
));
157 // ------------------------------------------------------------------------
159 // ------------------------------------------------------------------------
162 * Test that the manager is correctly initialized
165 public void testInitialize() {
166 TmfTraceManager mgr
= TmfTraceManager
.getInstance();
172 * Test the contents of a trace set with one trace.
175 public void testTraceSet() {
180 Collection
<ITmfTrace
> expected
= Collections
.singleton(trace2
);
181 Collection
<ITmfTrace
> actual
= tm
.getActiveTraceSet();
183 assertEquals(1, actual
.size());
184 assertEquals(expected
, actual
);
188 * Test the contents of a trace set with an experiment.
191 public void testTraceSetExperiment() {
192 final ITmfTrace localTrace1
= trace1
;
193 final ITmfTrace localTrace2
= trace2
;
194 assertNotNull(localTrace1
);
195 assertNotNull(localTrace2
);
196 TmfExperiment exp
= createExperiment(localTrace1
, localTrace2
);
197 openTrace(localTrace1
);
200 Collection
<ITmfTrace
> expected
= ImmutableSet
.of(localTrace1
, localTrace2
);
201 Collection
<ITmfTrace
> actual
= tm
.getActiveTraceSet();
203 assertEquals(2, actual
.size());
204 assertEquals(expected
, actual
);
208 * Test the contents of the complete trace set.
211 public void testTraceSetWithExperiment() {
212 final ITmfTrace localTrace1
= trace1
;
213 final ITmfTrace localTrace2
= trace2
;
214 assertNotNull(localTrace1
);
215 assertNotNull(localTrace2
);
216 /* Test with a trace */
217 Collection
<ITmfTrace
> expected
= Collections
.singleton(localTrace1
);
218 Collection
<ITmfTrace
> actual
= TmfTraceManager
.getTraceSetWithExperiment(localTrace1
);
219 assertEquals(1, actual
.size());
220 assertEquals(expected
, actual
);
222 /* Test with an experiment */
223 TmfExperiment exp
= createExperiment(localTrace1
, localTrace2
);
225 expected
= ImmutableSet
.of(localTrace1
, localTrace2
, exp
);
226 actual
= TmfTraceManager
.getTraceSetWithExperiment(exp
);
227 assertEquals(3, actual
.size());
228 assertEquals(expected
, actual
);
231 // ------------------------------------------------------------------------
232 // Test a single trace
233 // ------------------------------------------------------------------------
236 * Test the initial range of a single trace.
239 public void testTraceInitialRange() {
241 final TmfTimeRange expectedRange
= new TmfTimeRange(
242 trace2
.getStartTime(),
243 calculateOffset(trace2
.getStartTime(), trace2
.getInitialRangeOffset()));
244 TmfTimeRange actualRange
= tm
.getCurrentTraceContext().getWindowRange();
245 assertEquals(expectedRange
, actualRange
);
249 * Try selecting a timestamp contained inside the trace's range. The trace's
250 * current time should get updated correctly.
253 public void testNewTimestamp() {
255 ITmfTimestamp ts
= TmfTimestamp
.fromNanos(t2start
+ ONE_SECOND
);
258 TmfTimeRange selection
= tm
.getCurrentTraceContext().getSelectionRange();
259 assertEquals(ts
, selection
.getStartTime());
260 assertEquals(ts
, selection
.getEndTime());
264 * Try selecting a timestamp happening before the trace's start. The change
268 public void testTimestampBefore() {
270 TmfTimeRange beforeTr
= tm
.getCurrentTraceContext().getSelectionRange();
271 ITmfTimestamp ts
= TmfTimestamp
.fromNanos(t2start
- ONE_SECOND
);
274 TmfTimeRange selection
= tm
.getCurrentTraceContext().getSelectionRange();
275 assertEquals(beforeTr
, selection
);
279 * Try selecting a timestamp happening after the trace's end. The change
283 public void testTimestampAfter() {
285 TmfTimeRange beforeTr
= tm
.getCurrentTraceContext().getSelectionRange();
286 ITmfTimestamp ts
= TmfTimestamp
.fromNanos(t2end
+ ONE_SECOND
);
289 TmfTimeRange selection
= tm
.getCurrentTraceContext().getSelectionRange();
290 assertEquals(beforeTr
, selection
);
294 * Test selecting a normal sub-range of a single trace.
297 public void testTraceNewTimeRange() {
299 TmfTimeRange range
= new TmfTimeRange(
300 TmfTimestamp
.fromNanos(t2start
+ ONE_SECOND
),
301 TmfTimestamp
.fromNanos(t2end
- ONE_SECOND
));
302 selectWindowRange(range
);
304 TmfTimeRange curRange
= tm
.getCurrentTraceContext().getWindowRange();
305 assertEquals(range
, curRange
);
309 * Test selecting a range whose start time is before the trace's start time.
310 * The selected range should get clamped to the trace's range.
313 public void testTraceTimeRangeClampingStart() {
315 TmfTimeRange range
= new TmfTimeRange(
316 TmfTimestamp
.fromNanos(t2start
- ONE_SECOND
), // minus here
317 TmfTimestamp
.fromNanos(t2end
- ONE_SECOND
));
318 selectWindowRange(range
);
320 TmfTimeRange curRange
= tm
.getCurrentTraceContext().getWindowRange();
321 assertEquals(t2start
, curRange
.getStartTime().getValue());
322 assertEquals(range
.getEndTime(), curRange
.getEndTime());
326 * Test selecting a range whose end time is after the trace's end time. The
327 * selected range should get clamped to the trace's range.
330 public void testTraceTimeRangeClampingEnd() {
332 TmfTimeRange range
= new TmfTimeRange(
333 TmfTimestamp
.fromNanos(t2start
+ ONE_SECOND
),
334 TmfTimestamp
.fromNanos(t2end
+ ONE_SECOND
)); // plus here
335 selectWindowRange(range
);
337 TmfTimeRange curRange
= tm
.getCurrentTraceContext().getWindowRange();
338 assertEquals(range
.getStartTime(), curRange
.getStartTime());
339 assertEquals(t2end
, curRange
.getEndTime().getValue());
343 * Test selecting a range whose both start and end times are outside of the
344 * trace's range. The selected range should get clamped to the trace's
348 public void testTraceTimeRangeClampingBoth() {
350 TmfTimeRange range
= new TmfTimeRange(
351 TmfTimestamp
.fromNanos(t2start
- ONE_SECOND
), // minus here
352 TmfTimestamp
.fromNanos(t2end
+ ONE_SECOND
)); // plus here
353 selectWindowRange(range
);
355 TmfTimeRange curRange
= tm
.getCurrentTraceContext().getWindowRange();
356 assertEquals(t2start
, curRange
.getStartTime().getValue());
357 assertEquals(t2end
, curRange
.getEndTime().getValue());
360 // ------------------------------------------------------------------------
361 // Test multiple, non-overlapping traces in parallel
362 // ------------------------------------------------------------------------
365 * Test, with two traces in parallel, when we select a timestamp that is
366 * part of the first trace.
368 * The first trace's timestamp should be updated, but the second trace's one
372 public void testTwoTracesTimestampValid() {
376 ITmfTimestamp ts
= TmfTimestamp
.fromNanos(t1start
+ ONE_SECOND
);
379 /* Timestamp of trace1 should have been updated */
380 TmfTraceContext ctx
= tm
.getCurrentTraceContext();
381 assertEquals(ts
, ctx
.getSelectionRange().getStartTime());
382 assertEquals(ts
, ctx
.getSelectionRange().getEndTime());
384 /* Timestamp of trace2 should not have changed */
386 ctx
= tm
.getCurrentTraceContext();
387 assertEquals(trace2
.getStartTime(), ctx
.getSelectionRange().getStartTime());
388 assertEquals(trace2
.getStartTime(), ctx
.getSelectionRange().getEndTime());
392 * Test, with two traces in parallel, when we select a timestamp that is
393 * between two traces.
395 * None of the trace's timestamps should be updated (we are not in an
399 public void testTwoTracesTimestampInBetween() {
403 ITmfTimestamp ts
= TmfTimestamp
.fromNanos(t1end
+ ONE_SECOND
);
406 /* Timestamp of trace1 should not have changed */
407 TmfTimeRange selection
= tm
.getCurrentTraceContext().getSelectionRange();
408 assertEquals(trace1
.getStartTime(), selection
.getStartTime());
409 assertEquals(trace1
.getStartTime(), selection
.getEndTime());
411 /* Timestamp of trace2 should not have changed */
413 selection
= tm
.getCurrentTraceContext().getSelectionRange();
414 assertEquals(trace2
.getStartTime(), selection
.getStartTime());
415 assertEquals(trace2
.getStartTime(), selection
.getEndTime());
419 * Test, with two traces in parallel, when we select a timestamp that is
420 * completely out of the trace's range.
422 * None of the trace's timestamps should be updated.
425 public void testTwoTracesTimestampInvalid() {
429 ITmfTimestamp ts
= TmfTimestamp
.fromNanos(t2end
+ ONE_SECOND
);
432 /* Timestamp of trace1 should not have changed */
433 TmfTimeRange selection
= tm
.getCurrentTraceContext().getSelectionRange();
434 assertEquals(trace1
.getStartTime(), selection
.getStartTime());
435 assertEquals(trace1
.getStartTime(), selection
.getEndTime());
437 /* Timestamp of trace2 should not have changed */
439 selection
= tm
.getCurrentTraceContext().getSelectionRange();
440 assertEquals(trace2
.getStartTime(), selection
.getStartTime());
441 assertEquals(trace2
.getStartTime(), selection
.getEndTime());
445 * Test, with two traces opened in parallel (not in an experiment), if we
446 * select a time range valid in one of them. That trace's time range should
447 * be updated, but not the other one.
450 public void testTwoTracesTimeRangeAllInOne() {
454 TmfTimeRange range
= new TmfTimeRange(
455 TmfTimestamp
.fromNanos(t1start
+ ONE_SECOND
),
456 TmfTimestamp
.fromNanos(t1end
- ONE_SECOND
));
457 selectWindowRange(range
);
459 /* Range of trace1 should be equal to the requested one */
460 assertEquals(range
, tm
.getCurrentTraceContext().getWindowRange());
462 /* The range of trace 2 should not have changed */
464 assertEquals(getInitialRange(trace2
), tm
.getCurrentTraceContext().getWindowRange());
468 * Test, with two traces in parallel, when we select a time range that is
469 * only partially valid for one of the traces.
471 * The first trace's time range should be clamped to a valid range, and the
472 * second one's should not change.
475 public void testTwoTracesTimeRangePartiallyInOne() {
479 TmfTimeRange range
= new TmfTimeRange(
480 TmfTimestamp
.fromNanos(t1start
+ ONE_SECOND
),
481 TmfTimestamp
.fromNanos(t1end
+ ONE_SECOND
));
482 selectWindowRange(range
);
484 /* Range of trace1 should get clamped to its end time */
485 TmfTimeRange expectedRange
= new TmfTimeRange(
486 TmfTimestamp
.fromNanos(t1start
+ ONE_SECOND
),
487 TmfTimestamp
.fromNanos(t1end
));
488 assertEquals(expectedRange
, tm
.getCurrentTraceContext().getWindowRange());
490 /* Range of trace2 should not have changed */
492 assertEquals(getInitialRange(trace2
), tm
.getCurrentTraceContext().getWindowRange());
496 * Test, with two traces in parallel, when we select a time range that is
497 * only partially valid for both traces.
499 * Each trace's time range should get clamped to respectively valid ranges.
502 public void testTwoTracesTimeRangeInBoth() {
506 TmfTimeRange range
= new TmfTimeRange(
507 TmfTimestamp
.fromNanos(t1end
- ONE_SECOND
),
508 TmfTimestamp
.fromNanos(t2start
+ ONE_SECOND
));
509 selectWindowRange(range
);
511 /* Range of trace1 should be clamped to its end time */
512 TmfTimeRange expectedRange
= new TmfTimeRange(
513 TmfTimestamp
.fromNanos(t1end
- ONE_SECOND
),
514 TmfTimestamp
.fromNanos(t1end
));
515 assertEquals(expectedRange
, tm
.getCurrentTraceContext().getWindowRange());
517 /* Range of trace2 should be clamped to its start time */
519 expectedRange
= new TmfTimeRange(
520 TmfTimestamp
.fromNanos(t2start
),
521 TmfTimestamp
.fromNanos(t2start
+ ONE_SECOND
));
522 assertEquals(expectedRange
, tm
.getCurrentTraceContext().getWindowRange());
526 * Test, with two traces in parallel, when we select a time range that is
527 * not valid for any trace.
529 * Each trace's time range should not be modified.
532 public void testTwoTracesTimeRangeInBetween() {
536 TmfTimeRange range
= new TmfTimeRange(
537 TmfTimestamp
.fromNanos(t1end
+ ONE_SECOND
),
538 TmfTimestamp
.fromNanos(t1end
- ONE_SECOND
));
539 selectWindowRange(range
);
541 /* Range of trace1 should not have changed */
542 TmfTimeRange expectedRange
= getInitialRange(trace1
);
543 TmfTimeRange curRange
= tm
.getCurrentTraceContext().getWindowRange();
544 assertEquals(expectedRange
.getStartTime(), curRange
.getStartTime());
545 assertEquals(expectedRange
.getEndTime(), curRange
.getEndTime());
547 /* Range of trace2 should not have changed */
549 expectedRange
= getInitialRange(trace2
);
550 curRange
= tm
.getCurrentTraceContext().getWindowRange();
551 assertEquals(expectedRange
.getStartTime(), curRange
.getStartTime());
552 assertEquals(expectedRange
.getEndTime(), curRange
.getEndTime());
555 // ------------------------------------------------------------------------
556 // Test an experiment
557 // ------------------------------------------------------------------------
560 * Test in an experiment when we select a timestamp that is part of one of
561 * the experiment's traces.
563 * The experiment's current time should be correctly updated.
566 public void testExperimentTimestampInTrace() {
567 TmfExperiment exp
= createExperiment(trace1
, trace2
);
569 ITmfTimestamp ts
= TmfTimestamp
.fromNanos(t1start
+ ONE_SECOND
);
572 /* The experiment's current time should be updated. */
573 TmfTimeRange selection
= tm
.getCurrentTraceContext().getSelectionRange();
574 assertEquals(ts
, selection
.getStartTime());
575 assertEquals(ts
, selection
.getEndTime());
579 * Test in an experiment when we select a timestamp that is between two
580 * traces in the experiment.
582 * The experiment's current time should still be updated, since the
583 * timestamp is valid in the experiment itself.
586 public void testExperimentTimestampInBetween() {
587 TmfExperiment exp
= createExperiment(trace1
, trace2
);
589 ITmfTimestamp ts
= TmfTimestamp
.fromNanos(t1end
+ ONE_SECOND
);
592 /* The experiment's current time should be updated. */
593 TmfTimeRange selection
= tm
.getCurrentTraceContext().getSelectionRange();
594 assertEquals(ts
, selection
.getStartTime());
595 assertEquals(ts
, selection
.getEndTime());
599 * Test in an experiment when we select a timestamp that is outside of the
600 * total range of the experiment.
602 * The experiment's current time should not be updated.
605 public void testExperimentTimestampInvalid() {
606 TmfExperiment exp
= createExperiment(trace1
, trace2
);
608 ITmfTimestamp ts
= TmfTimestamp
.fromNanos(t2end
+ ONE_SECOND
);
611 /* The experiment's current time should NOT be updated. */
612 TmfTimeRange selection
= tm
.getCurrentTraceContext().getSelectionRange();
613 assertEquals(trace1
.getStartTime(), selection
.getStartTime());
614 assertEquals(trace1
.getStartTime(), selection
.getEndTime());
618 * Test the initial range of an experiment.
621 public void testExperimentInitialRange() {
622 TmfExperiment exp
= createExperiment(trace1
, trace2
);
625 * The initial range should be == to the initial range of the earliest
626 * trace (here trace1).
628 final TmfTimeRange actualRange
= tm
.getCurrentTraceContext().getWindowRange();
630 assertEquals(getInitialRange(trace1
), actualRange
);
631 assertEquals(getInitialRange(exp
), actualRange
);
635 * Test the range clamping with the start time of the range outside of the
636 * earliest trace's range. Only that start time should get clamped.
639 public void testExperimentRangeClampingOne() {
640 TmfExperiment exp
= createExperiment(trace1
, trace2
);
643 final TmfTimeRange range
= new TmfTimeRange(
644 TmfTimestamp
.fromNanos(t1start
- ONE_SECOND
),
645 TmfTimestamp
.fromNanos(t1end
- ONE_SECOND
));
646 selectWindowRange(range
);
648 TmfTimeRange actualRange
= tm
.getCurrentTraceContext().getWindowRange();
649 assertEquals(t1start
, actualRange
.getStartTime().getValue());
650 assertEquals(t1end
- ONE_SECOND
, actualRange
.getEndTime().getValue());
654 * Test the range clamping when both the start and end times of the signal's
655 * range are outside of the trace's range. The range should clamp to the
656 * experiment's range.
659 public void testExperimentRangeClampingBoth() {
660 TmfExperiment exp
= createExperiment(trace1
, trace2
);
663 final TmfTimeRange range
= new TmfTimeRange(
664 TmfTimestamp
.fromNanos(t1start
- ONE_SECOND
),
665 TmfTimestamp
.fromNanos(t2end
+ ONE_SECOND
));
666 selectWindowRange(range
);
668 TmfTimeRange actualRange
= tm
.getCurrentTraceContext().getWindowRange();
669 assertEquals(t1start
, actualRange
.getStartTime().getValue());
670 assertEquals(t2end
, actualRange
.getEndTime().getValue());
674 * Test selecting a range in-between two disjoint traces in an experiment.
675 * The range should still get correctly selected, even if no trace has any
676 * events in that range.
679 public void testExperimentRangeInBetween() {
680 TmfExperiment exp
= createExperiment(trace1
, trace2
);
683 final TmfTimeRange range
= new TmfTimeRange(
684 TmfTimestamp
.fromNanos(t1end
+ ONE_SECOND
),
685 TmfTimestamp
.fromNanos(t2start
- ONE_SECOND
));
686 selectWindowRange(range
);
688 TmfTimeRange actualRange
= tm
.getCurrentTraceContext().getWindowRange();
689 assertEquals(range
, actualRange
);
692 // ------------------------------------------------------------------------
694 // ------------------------------------------------------------------------
696 private static TmfExperiment
createExperiment(ITmfTrace t1
, ITmfTrace t2
) {
697 ITmfTrace
[] traces
= new ITmfTrace
[] { t1
, t2
};
698 TmfExperiment exp
= new TmfExperiment(ITmfEvent
.class, "test-exp", traces
,
699 TmfExperiment
.DEFAULT_INDEX_PAGE_SIZE
, null);
700 exp
.indexTrace(true);
701 // Deregister experiment from signal manager so that it doesn't
702 // interfere with the TmfTraceManager tests
703 TmfSignalManager
.deregister(exp
);
707 private static TmfTimeRange
getInitialRange(ITmfTrace trace
) {
708 return new TmfTimeRange(
709 trace
.getStartTime(),
710 calculateOffset(trace
.getStartTime(), trace
.getInitialRangeOffset()));
714 * Basically a "initial + offset" operation, but for ITmfTimetamp objects.
716 private static @NonNull ITmfTimestamp
calculateOffset(ITmfTimestamp initialTs
, ITmfTimestamp offsetTs
) {
717 long start
= initialTs
.toNanos();
718 long offset
= offsetTs
.toNanos();
719 return TmfTimestamp
.fromNanos(start
+ offset
);