Search in sources :

Example 41 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfStatisticsViewer method timeSynchUpdated.

/**
 * Handles the time synch updated signal. It updates the time range
 * statistics.
 *
 * @param signal
 *            Contains the information about the new selected time range.
 * @since 1.0
 */
@TmfSignalHandler
public void timeSynchUpdated(TmfSelectionRangeUpdatedSignal signal) {
    if (fTrace == null) {
        return;
    }
    ITmfTimestamp begin = signal.getBeginTime();
    ITmfTimestamp end = signal.getEndTime();
    TmfTimeRange timeRange;
    if (begin.compareTo(end) <= 0) {
        timeRange = new TmfTimeRange(begin, end);
    } else {
        timeRange = new TmfTimeRange(end, begin);
    }
    requestTimeRangeData(fTrace, timeRange);
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 42 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoader method getPage.

/**
 * Gets page that contains timestamp
 *
 * @param time
 *            The timestamp
 * @return page that contains the time
 */
protected int getPage(ITmfTimestamp time) {
    int page;
    int size;
    fLock.lock();
    try {
        size = fCheckPoints.size();
        for (page = 0; page < size; page++) {
            TmfTimeRange timeRange = fCheckPoints.get(page);
            if (timeRange.getEndTime().compareTo(time) >= 0) {
                break;
            }
        }
        if (page >= size) {
            page = size - 1;
        }
        return page;
    } finally {
        fLock.unlock();
    }
}
Also used : TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)

Example 43 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfTimeViewer method traceRangeUpdated.

/**
 * Signal handler for handling of the trace range updated signal.
 *
 * @param signal
 *            The trace range signal {@link TmfTraceRangeUpdatedSignal}
 */
@TmfSignalHandler
public void traceRangeUpdated(@Nullable TmfTraceRangeUpdatedSignal signal) {
    if (signal == null || signal.getTrace() != fTrace) {
        return;
    }
    TmfTimeRange fullRange = signal.getRange();
    long traceStartTime = fullRange.getStartTime().toNanos();
    long traceEndTime = fullRange.getEndTime().toNanos();
    setStartTime(traceStartTime);
    setEndTime(traceEndTime);
}
Also used : TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 44 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfTimeViewer method traceUpdated.

/**
 * Signal handler for handling of the trace updated signal.
 *
 * @param signal
 *            The trace updated signal {@link TmfTraceUpdatedSignal}
 */
@TmfSignalHandler
public void traceUpdated(@Nullable TmfTraceUpdatedSignal signal) {
    if (signal == null || signal.getTrace() != fTrace) {
        return;
    }
    TmfTimeRange fullRange = signal.getTrace().getTimeRange();
    long traceStartTime = fullRange.getStartTime().toNanos();
    long traceEndTime = fullRange.getEndTime().toNanos();
    setStartTime(traceStartTime);
    setEndTime(traceEndTime);
}
Also used : TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 45 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfTimeViewer method loadTrace.

// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
/**
 * A Method to load a trace into the viewer.
 *
 * @param trace
 *            A trace to apply in the viewer
 */
public void loadTrace(ITmfTrace trace) {
    fTrace = trace;
    if (trace == null) {
        return;
    }
    TmfTraceContext ctx = TmfTraceManager.getInstance().getTraceContext(trace);
    long selectionStart = ctx.getSelectionRange().getStartTime().toNanos();
    long selectionEnd = ctx.getSelectionRange().getEndTime().toNanos();
    TmfTimeRange windowRange = ctx.getWindowRange();
    long windowStartTime = windowRange.getStartTime().toNanos();
    long windowEndTime = windowRange.getEndTime().toNanos();
    long startTime = fTrace.getStartTime().toNanos();
    long endTime = fTrace.getEndTime().toNanos();
    setSelectionRange(selectionStart, selectionEnd);
    setStartTime(startTime);
    setWindowRange(windowStartTime, windowEndTime);
    setEndTime(endTime);
}
Also used : TmfTraceContext(org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)

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