use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.
the class ActiveThreadsFilter method computeData.
/**
* Compute the filter internal data
*
* @param beginTS
* start timestamp to update the filter for
* @param endTS
* end timestamp to update the filter for
* @return map of filter data per trace, or null
*/
@Nullable
public Map<ITmfTrace, Set<Long>> computeData(long beginTS, long endTS) {
TmfTimeRange timeRange = new TmfTimeRange(TmfTimestamp.fromNanos(beginTS), TmfTimestamp.fromNanos(endTS));
ITmfTrace parentTrace = fTrace;
if (parentTrace == null || !fEnabled || (fCachedTimeRange != null && fCachedTimeRange.equals(timeRange))) {
return null;
}
Map<ITmfTrace, Set<Long>> data = new HashMap<>();
for (ITmfTrace trace : TmfTraceManager.getTraceSet(parentTrace)) {
if (fCpuRangesBasedFiltering) {
Set<Long> onCpusThreadForTimeRange = getOnCpuThreads(fCpuRanges, timeRange, trace);
data.put(trace, onCpusThreadForTimeRange);
} else {
Set<Long> activeThreadForTimeRange = getActiveThreads(timeRange, trace);
data.put(trace, activeThreadForTimeRange);
}
}
return data;
}
use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.
the class AbstractSegmentStoreDensityViewer method loadTrace.
/**
* A Method to load a trace into the viewer.
*
* @param trace
* A trace to apply in the viewer
*/
protected void loadTrace(@Nullable ITmfTrace trace) {
clearContent();
TmfTraceContext ctx = TmfTraceManager.getInstance().getCurrentTraceContext();
TmfTimeRange windowRange = ctx.getWindowRange();
innerLoadTrace(trace);
updateWindowRange(windowRange, true);
fTrace = trace;
fCurrentTimeRange = windowRange;
zoom(getDefaultRange());
}
use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.
the class AbstractSegmentStoreDensityViewer method zoom.
/**
* Zoom to a range of latency durations in the viewer.
*
* @param durationRange
* a range of latency durations
*/
public void zoom(final AxisRange durationRange) {
fCurrentDurationRange = durationRange;
final TmfTimeRange timeRange = fCurrentTimeRange;
computeDataAsync(timeRange, durationRange).thenAccept(data -> {
synchronized (fListeners) {
if (fCurrentTimeRange.equals(timeRange) && fCurrentDurationRange.equals(durationRange)) {
applyData(data);
}
}
});
}
use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.
the class TmfSchedulerTest method setUp.
/**
* Perform pre-test initialization.
*/
@BeforeClass
public static void setUp() {
fixture = CtfTmfTestTraceUtils.getTrace(testTrace);
fixture.indexTrace(true);
fStartTime = fixture.getStartTime().toNanos();
fEndTime = fixture.getEndTime().toNanos();
long foregroundStartTime = fStartTime + ((fEndTime - fStartTime) / 4);
long foregroundEndTime = fStartTime + ((fEndTime - fStartTime) / 2);
fForegroundTimeRange = new TmfTimeRange(TmfTimestamp.fromNanos(foregroundStartTime), TmfTimestamp.fromNanos(foregroundEndTime));
}
use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.
the class TmfTraceManagerTest method testTwoTracesTimeRangePartiallyInOne.
/**
* Test, with two traces in parallel, when we select a time range that is
* only partially valid for one of the traces.
*
* The first trace's time range should be clamped to a valid range, and the
* second one's should not change.
*/
@Test
public void testTwoTracesTimeRangePartiallyInOne() {
openTrace(trace1);
openTrace(trace2);
selectTrace(trace1);
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(t1start + ONE_SECOND), TmfTimestamp.fromNanos(t1end + ONE_SECOND));
selectWindowRange(range);
/* Range of trace1 should get clamped to its end time */
TmfTimeRange expectedRange = new TmfTimeRange(TmfTimestamp.fromNanos(t1start + ONE_SECOND), TmfTimestamp.fromNanos(t1end));
assertEquals(expectedRange, tm.getCurrentTraceContext().getWindowRange());
/* Range of trace2 should not have changed */
selectTrace(trace2);
assertEquals(getInitialRange(trace2), tm.getCurrentTraceContext().getWindowRange());
}
Aggregations