Search in sources :

Example 51 with TmfTimeRange

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;
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 52 with TmfTimeRange

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());
}
Also used : TmfTraceContext(org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)

Example 53 with TmfTimeRange

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);
            }
        }
    });
}
Also used : TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)

Example 54 with TmfTimeRange

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));
}
Also used : TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) BeforeClass(org.junit.BeforeClass)

Example 55 with TmfTimeRange

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());
}
Also used : TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Aggregations

TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)168 Test (org.junit.Test)98 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)53 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)29 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)24 TmfEventRequest (org.eclipse.tracecompass.tmf.core.request.TmfEventRequest)24 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)21 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)20 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)19 ITmfEventRequest (org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)16 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)16 Vector (java.util.Vector)13 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)12 TmfTraceManager (org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager)10 ITmfEventProvider (org.eclipse.tracecompass.tmf.core.component.ITmfEventProvider)9 AbstractTimeGraphView (org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView)9 TmfTraceContext (org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext)8 TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)8 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)8 Point (org.eclipse.swt.graphics.Point)7