/*******************************************************************************
- * Copyright (c) 2009, 2010, 2011, 2012 Ericsson
- *
+ * Copyright (c) 2009, 2013 Ericsson
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* William Bourque - Initial API and implementation
* Yuriy Vashchuk - GUI reorganisation, simplification and some related code improvements.
- * Yuriy Vashchuk - Histograms optimisation.
+ * Yuriy Vashchuk - Histograms optimisation.
* Yuriy Vashchuk - Histogram Canvas Heritage correction
* Francois Chouinard - Cleanup and refactoring
* Francois Chouinard - Moved from LTTng to TMF
package org.eclipse.linuxtools.tmf.ui.views.histogram;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.experiment.TmfExperiment;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
-import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentSelectedSignal;
+import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceRangeUpdatedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ui.editors.ITmfTraceEditor;
import org.eclipse.linuxtools.tmf.ui.views.TmfView;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
/**
- * <b><u>HistogramView</u></b>
- * <p>
- * The purpose of this view is to provide graphical time distribution statistics about the experiment/trace events.
+ * The purpose of this view is to provide graphical time distribution statistics about the trace events.
* <p>
* The view is composed of two histograms and two controls:
* <ul>
- * <li>an event distribution histogram for the whole experiment;
+ * <li>an event distribution histogram for the whole trace;
* <li>an event distribution histogram for current time window (window span);
* <li>the timestamp of the currently selected event;
* <li>the window span (size of the time window of the smaller histogram).
* </ul>
* The histograms x-axis show their respective time range.
+ *
+ * @version 2.0
+ * @author Francois Chouinard
*/
public class HistogramView extends TmfView {
// Constants
// ------------------------------------------------------------------------
- // The view ID as defined in plugin.xml
+ /**
+ * The view ID as defined in plugin.xml
+ */
public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.histogram"; //$NON-NLS-1$
- // The initial window span (in nanoseconds)
- public static final long INITIAL_WINDOW_SPAN = (1L * 100 * 1000 * 1000); // .1sec
-
- // Time scale
- private final byte TIME_SCALE = Histogram.TIME_SCALE;
-
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
// Parent widget
private Composite fParent;
- // The current experiment
- private TmfExperiment<ITmfEvent> fCurrentExperiment;
+ // The current trace
+ private ITmfTrace fTrace;
- // Current timestamp/time window
- private long fExperimentStartTime;
- private long fExperimentEndTime;
+ // Current timestamp/time window - everything in the TIME_SCALE
+ private long fTraceStartTime;
+ private long fTraceEndTime;
private long fWindowStartTime;
private long fWindowEndTime;
- private long fWindowSpan = INITIAL_WINDOW_SPAN;
+ private long fWindowSpan;
private long fCurrentTimestamp;
// Time controls
// Constructor
// ------------------------------------------------------------------------
+ /**
+ * Default constructor
+ */
public HistogramView() {
super(ID);
}
@Override
public void dispose() {
- if (fTimeRangeRequest != null && !fTimeRangeRequest.isCompleted()) {
+ if ((fTimeRangeRequest != null) && !fTimeRangeRequest.isCompleted()) {
fTimeRangeRequest.cancel();
}
- if (fFullTraceRequest != null && !fFullTraceRequest.isCompleted()) {
+ if ((fFullTraceRequest != null) && !fFullTraceRequest.isCompleted()) {
fFullTraceRequest.cancel();
}
fFullTraceHistogram.dispose();
fTimeRangeHistogram.dispose();
+ fCurrentEventTimeControl.dispose();
+ fTimeSpanControl.dispose();
super.dispose();
}
// ------------------------------------------------------------------------
@Override
- @SuppressWarnings("unchecked")
public void createPartControl(Composite parent) {
fParent = parent;
gridLayout.marginWidth = 0;
gridLayout.horizontalSpacing = 5;
gridLayout.verticalSpacing = 0;
- gridLayout.makeColumnsEqualWidth = true;
+ gridLayout.makeColumnsEqualWidth = false;
gridLayout.marginLeft = 5;
gridLayout.marginRight = 5;
controlsComposite.setLayout(gridLayout);
gridData = new GridData();
gridData.horizontalAlignment = SWT.CENTER;
gridData.verticalAlignment = SWT.CENTER;
- fCurrentEventTimeControl = new HistogramCurrentTimeControl(this, controlsComposite, SWT.BORDER, SWT.NONE,
- currentEventLabel, HistogramUtils.nanosecondsToString(0L));
+ fCurrentEventTimeControl = new HistogramCurrentTimeControl(this, controlsComposite, currentEventLabel, 0L);
fCurrentEventTimeControl.setLayoutData(gridData);
+ fCurrentEventTimeControl.setValue(Long.MIN_VALUE);
// Window span time control
gridData = new GridData();
gridData.horizontalAlignment = SWT.CENTER;
gridData.verticalAlignment = SWT.CENTER;
- fTimeSpanControl = new HistogramTimeRangeControl(this, controlsComposite, SWT.BORDER, SWT.NONE,
- windowSpanLabel, HistogramUtils.nanosecondsToString(0L));
+ fTimeSpanControl = new HistogramTimeRangeControl(this, controlsComposite, windowSpanLabel, 0L);
fTimeSpanControl.setLayoutData(gridData);
+ fTimeSpanControl.setValue(Long.MIN_VALUE);
// --------------------------------------------------------------------
// Time range histogram
// Histogram
fFullTraceHistogram = new FullTraceHistogram(this, fullRangeComposite);
- // Load the experiment if present
- fCurrentExperiment = (TmfExperiment<ITmfEvent>) TmfExperiment.getCurrentExperiment();
- if (fCurrentExperiment != null)
- loadExperiment();
+ IEditorPart editor = getSite().getPage().getActiveEditor();
+ if (editor instanceof ITmfTraceEditor) {
+ ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace();
+ if (trace != null) {
+ traceSelected(new TmfTraceSelectedSignal(this, trace));
+ }
+ }
}
@Override
- @SuppressWarnings("unchecked")
public void setFocus() {
- TmfExperiment<ITmfEvent> experiment = (TmfExperiment<ITmfEvent>) TmfExperiment.getCurrentExperiment();
- if ((experiment != null) && (experiment != fCurrentExperiment)) {
- fCurrentExperiment = experiment;
- initializeHistograms();
- }
- fParent.redraw();
+ fFullTraceHistogram.fCanvas.setFocus();
+ }
+
+ void refresh() {
+ fParent.layout(true);
}
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
+ /**
+ * Returns the current trace handled by the view
+ *
+ * @return the current trace
+ * @since 2.0
+ */
+ public ITmfTrace getTrace() {
+ return fTrace;
+ }
+
+ /**
+ * Returns the time range of the current selected window (base on default time scale).
+ *
+ * @return the time range of current selected window.
+ * @since 2.0
+ */
public TmfTimeRange getTimeRange() {
- return new TmfTimeRange(new TmfTimestamp(fWindowStartTime, TIME_SCALE), new TmfTimestamp(fWindowEndTime,
- TIME_SCALE));
+ return new TmfTimeRange(
+ new TmfTimestamp(fWindowStartTime, ITmfTimestamp.NANOSECOND_SCALE),
+ new TmfTimestamp(fWindowEndTime, ITmfTimestamp.NANOSECOND_SCALE));
}
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
- public void updateCurrentEventTime(long newTime) {
- if (fCurrentExperiment != null) {
- TmfTimeRange timeRange = new TmfTimeRange(new TmfTimestamp(newTime, TIME_SCALE), TmfTimestamp.BigCrunch);
- HistogramRequest request = new HistogramRequest(fTimeRangeHistogram.getDataModel(), timeRange, 0, 1, ExecutionType.FOREGROUND) {
+ /**
+ * Broadcast TmfSignal about new current time value.
+ * @param newTime the new current time.
+ */
+ void updateCurrentEventTime(long newTime) {
+ if (fTrace != null) {
+ TmfTimeRange timeRange = new TmfTimeRange(new TmfTimestamp(newTime, ITmfTimestamp.NANOSECOND_SCALE), TmfTimestamp.BIG_CRUNCH);
+ HistogramRequest request = new HistogramRequest(fTimeRangeHistogram.getDataModel(), timeRange, 0, 1, 0, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
if (event != null) {
}
}
};
- fCurrentExperiment.sendRequest(request);
+ fTrace.sendRequest(request);
}
}
- public void updateTimeRange(long startTime, long endTime) {
- if (fCurrentExperiment != null) {
+ /**
+ * Broadcast TmfSignal about new selected time range.
+ * @param startTime the new start time
+ * @param endTime the new end time
+ */
+ void updateTimeRange(long startTime, long endTime) {
+ if (fTrace != null) {
// Build the new time range; keep the current time
- TmfTimeRange timeRange = new TmfTimeRange(new TmfTimestamp(startTime, TIME_SCALE), new TmfTimestamp(
- endTime, TIME_SCALE));
- TmfTimestamp currentTime = new TmfTimestamp(fCurrentTimestamp, TIME_SCALE);
-
+ TmfTimeRange timeRange = new TmfTimeRange(
+ new TmfTimestamp(startTime, ITmfTimestamp.NANOSECOND_SCALE),
+ new TmfTimestamp(endTime, ITmfTimestamp.NANOSECOND_SCALE));
+ ITmfTimestamp currentTime = new TmfTimestamp(fCurrentTimestamp, ITmfTimestamp.NANOSECOND_SCALE);
fTimeSpanControl.setValue(endTime - startTime);
// Send the FW signal
}
}
+ /**
+ * Broadcast TmfSignal about new selected time range.
+ * @param newDuration new duration (relative to current start time)
+ */
public synchronized void updateTimeRange(long newDuration) {
- if (fCurrentExperiment != null) {
+ if (fTrace != null) {
long delta = newDuration - fWindowSpan;
- long newStartTime = fWindowStartTime + delta / 2;
+ long newStartTime = fWindowStartTime - (delta / 2);
setNewRange(newStartTime, newDuration);
}
}
private void setNewRange(long startTime, long duration) {
- if (startTime < fExperimentStartTime)
- startTime = fExperimentStartTime;
-
- long endTime = startTime + duration;
- if (endTime > fExperimentEndTime) {
- endTime = fExperimentEndTime;
- if (endTime - duration > fExperimentStartTime)
- startTime = endTime - duration;
- else {
- startTime = fExperimentStartTime;
+ long realStart = startTime;
+
+ if (realStart < fTraceStartTime) {
+ realStart = fTraceStartTime;
+ }
+
+ long endTime = realStart + duration;
+ if (endTime > fTraceEndTime) {
+ endTime = fTraceEndTime;
+ if ((endTime - duration) > fTraceStartTime) {
+ realStart = endTime - duration;
+ } else {
+ realStart = fTraceStartTime;
}
}
- updateTimeRange(startTime, endTime);
+ updateTimeRange(realStart, endTime);
}
// ------------------------------------------------------------------------
// Signal handlers
// ------------------------------------------------------------------------
+ /**
+ * Handles trace opened signal. Loads histogram if new trace time range is not
+ * equal <code>TmfTimeRange.NULL_RANGE</code>
+ * @param signal the trace selected signal
+ * @since 2.0
+ */
@TmfSignalHandler
- @SuppressWarnings("unchecked")
- public void experimentSelected(TmfExperimentSelectedSignal<ITmfEvent> signal) {
+ public void traceOpened(TmfTraceOpenedSignal signal) {
assert (signal != null);
- fCurrentExperiment = (TmfExperiment<ITmfEvent>) signal.getExperiment();
- loadExperiment();
+ fTrace = signal.getTrace();
+ loadTrace();
}
- private void loadExperiment() {
+ /**
+ * Handles trace selected signal. Loads histogram if new trace time range is not
+ * equal <code>TmfTimeRange.NULL_RANGE</code>
+ * @param signal the trace selected signal
+ * @since 2.0
+ */
+ @TmfSignalHandler
+ public void traceSelected(TmfTraceSelectedSignal signal) {
+ assert (signal != null);
+ if (fTrace != signal.getTrace()) {
+ fTrace = signal.getTrace();
+ loadTrace();
+ }
+ }
+
+ private void loadTrace() {
initializeHistograms();
fParent.redraw();
}
+ /**
+ * Handles trace closed signal. Clears the view and data model and cancels requests.
+ * @param signal the trace closed signal
+ * @since 2.0
+ */
@TmfSignalHandler
- public void experimentRangeUpdated(TmfExperimentRangeUpdatedSignal signal) {
+ public void traceClosed(TmfTraceClosedSignal signal) {
- if (signal.getExperiment() != fCurrentExperiment) {
+ if (signal.getTrace() != fTrace) {
return;
}
- boolean drawTimeRangeHistogram = fExperimentStartTime == 0;
- TmfTimeRange fullRange = signal.getRange();
+ // Kill any running request
+ if ((fTimeRangeRequest != null) && !fTimeRangeRequest.isCompleted()) {
+ fTimeRangeRequest.cancel();
+ }
+ if ((fFullTraceRequest != null) && !fFullTraceRequest.isCompleted()) {
+ fFullTraceRequest.cancel();
+ }
- fExperimentStartTime = fullRange.getStartTime().getValue();
- fExperimentEndTime = fullRange.getEndTime().getValue();
+ // Initialize the internal data
+ fTrace = null;
+ fTraceStartTime = 0L;
+ fTraceEndTime = 0L;
+ fWindowStartTime = 0L;
+ fWindowEndTime = 0L;
+ fWindowSpan = 0L;
+ fCurrentTimestamp = 0L;
- fFullTraceHistogram.setFullRange(fExperimentStartTime, fExperimentEndTime);
- fTimeRangeHistogram.setFullRange(fExperimentStartTime, fExperimentEndTime);
+ // Clear the UI widgets
+ fFullTraceHistogram.clear();
+ fTimeRangeHistogram.clear();
+ fCurrentEventTimeControl.setValue(Long.MIN_VALUE);
+
+ fTimeSpanControl.setValue(Long.MIN_VALUE);
+ }
- if (drawTimeRangeHistogram) {
- fCurrentTimestamp = fExperimentStartTime;
- fCurrentEventTimeControl.setValue(fCurrentTimestamp);
- fFullTraceHistogram.setTimeRange(fExperimentStartTime, INITIAL_WINDOW_SPAN);
- fTimeRangeHistogram.setTimeRange(fExperimentStartTime, INITIAL_WINDOW_SPAN);
- sendTimeRangeRequest(fExperimentStartTime, fExperimentStartTime + INITIAL_WINDOW_SPAN);
+ /**
+ * Handles trace range updated signal. Extends histogram according to the new time range. If a
+ * HistogramRequest is already ongoing, it will be cancelled and a new request with the new range
+ * will be issued.
+ *
+ * @param signal the trace range updated signal
+ * @since 2.0
+ */
+ @TmfSignalHandler
+ public void traceRangeUpdated(TmfTraceRangeUpdatedSignal signal) {
+
+ if (signal.getTrace() != fTrace) {
+ return;
}
+ TmfTimeRange fullRange = signal.getRange();
+
+ fTraceStartTime = fullRange.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ fTraceEndTime = fullRange.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+
+ fFullTraceHistogram.setFullRange(fTraceStartTime, fTraceEndTime);
+ fTimeRangeHistogram.setFullRange(fTraceStartTime, fTraceEndTime);
+
sendFullRangeRequest(fullRange);
}
+ /**
+ * Handles the trace updated signal. Used to update time limits (start and end time)
+ * @param signal the trace updated signal
+ * @since 2.0
+ */
+ @TmfSignalHandler
+ public void traceUpdated(TmfTraceUpdatedSignal signal) {
+ if (signal.getTrace() != fTrace) {
+ return;
+ }
+ TmfTimeRange fullRange = signal.getTrace().getTimeRange();
+ fTraceStartTime = fullRange.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ fTraceEndTime = fullRange.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+
+ fFullTraceHistogram.setFullRange(fTraceStartTime, fTraceEndTime);
+ fTimeRangeHistogram.setFullRange(fTraceStartTime, fTraceEndTime);
+
+ fFullTraceHistogram.setTimeRange(fTimeRangeHistogram.getStartTime(), fWindowSpan);
+ fTimeRangeHistogram.setTimeRange(fTimeRangeHistogram.getStartTime(), fWindowSpan);
+
+ if ((fFullTraceRequest != null) && fFullTraceRequest.getRange().getEndTime().compareTo(signal.getRange().getEndTime()) < 0) {
+ sendFullRangeRequest(fullRange);
+ }
+}
+
+ /**
+ * Handles the current time updated signal. Sets the current time in the time range
+ * histogram as well as the full histogram.
+ *
+ * @param signal the signal to process
+ */
@TmfSignalHandler
public void currentTimeUpdated(TmfTimeSynchSignal signal) {
// Because this can't happen :-)
assert (signal != null);
// Update the selected event time
- ITmfTimestamp currentTime = signal.getCurrentTime();
+ ITmfTimestamp currentTime = signal.getCurrentTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE);
fCurrentTimestamp = currentTime.getValue();
// Notify the relevant widgets
fCurrentEventTimeControl.setValue(fCurrentTimestamp);
}
+ /**
+ * Updates the current time range in the time range histogram and full range histogram.
+ * @param signal the signal to process
+ */
@TmfSignalHandler
public void timeRangeUpdated(TmfRangeSynchSignal signal) {
// Because this can't happen :-)
assert (signal != null);
- if (fCurrentExperiment != null) {
+ if (fTrace != null) {
+ // Validate the time range
+ TmfTimeRange range = signal.getCurrentRange().getIntersection(fTrace.getTimeRange());
+ if (range == null) {
+ return;
+ }
+
// Update the time range
- fWindowStartTime = signal.getCurrentRange().getStartTime().getValue();
- fWindowEndTime = signal.getCurrentRange().getEndTime().getValue();
+ fWindowStartTime = range.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ fWindowEndTime = range.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
fWindowSpan = fWindowEndTime - fWindowStartTime;
// Notify the relevant widgets
sendTimeRangeRequest(fWindowStartTime, fWindowEndTime);
fFullTraceHistogram.setTimeRange(fWindowStartTime, fWindowSpan);
+
fTimeSpanControl.setValue(fWindowSpan);
}
}
// ------------------------------------------------------------------------
private void initializeHistograms() {
- TmfTimeRange fullRange = updateExperimentTimeRange(fCurrentExperiment);
+ TmfTimeRange fullRange = updateTraceTimeRange();
+ long timestamp = fTrace.getCurrentTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ long startTime = fTrace.getCurrentRange().getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ long duration = fTrace.getCurrentRange().getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue() - startTime;
+ if ((fTimeRangeRequest != null) && !fTimeRangeRequest.isCompleted()) {
+ fTimeRangeRequest.cancel();
+ }
fTimeRangeHistogram.clear();
- fTimeRangeHistogram.setFullRange(fExperimentStartTime, fExperimentEndTime);
- fTimeRangeHistogram.setTimeRange(fExperimentStartTime, INITIAL_WINDOW_SPAN);
- fTimeRangeHistogram.setCurrentEvent(fExperimentStartTime);
+ fTimeRangeHistogram.setFullRange(fTraceStartTime, fTraceEndTime);
+ fTimeRangeHistogram.setTimeRange(startTime, duration);
+ fTimeRangeHistogram.setCurrentEvent(timestamp);
+ if ((fFullTraceRequest != null) && !fFullTraceRequest.isCompleted()) {
+ fFullTraceRequest.cancel();
+ }
fFullTraceHistogram.clear();
- fFullTraceHistogram.setFullRange(fExperimentStartTime, fExperimentEndTime);
- fFullTraceHistogram.setTimeRange(fExperimentStartTime, INITIAL_WINDOW_SPAN);
- fFullTraceHistogram.setCurrentEvent(fExperimentStartTime);
+ fFullTraceHistogram.setFullRange(fTraceStartTime, fTraceEndTime);
+ fFullTraceHistogram.setTimeRange(startTime, duration);
+ fFullTraceHistogram.setCurrentEvent(timestamp);
- fWindowStartTime = fExperimentStartTime;
- fWindowSpan = INITIAL_WINDOW_SPAN;
- fWindowEndTime = fWindowStartTime + fWindowSpan;
+ fWindowStartTime = startTime;
+ fWindowSpan = duration;
+ fWindowEndTime = startTime + duration;
- fCurrentEventTimeControl.setValue(fExperimentStartTime);
- fTimeSpanControl.setValue(fWindowSpan);
+ fCurrentTimestamp = timestamp;
+ fCurrentEventTimeControl.setValue(fCurrentTimestamp);
- sendTimeRangeRequest(fExperimentStartTime, fExperimentStartTime + fWindowSpan);
- sendFullRangeRequest(fullRange);
+ fTimeSpanControl.setValue(duration);
+
+ if (!fullRange.equals(TmfTimeRange.NULL_RANGE)) {
+ sendTimeRangeRequest(startTime, startTime + duration);
+ sendFullRangeRequest(fullRange);
+ }
}
- private TmfTimeRange updateExperimentTimeRange(TmfExperiment<ITmfEvent> experiment) {
- fExperimentStartTime = 0;
- fExperimentEndTime = 0;
- fCurrentTimestamp = 0;
+ private TmfTimeRange updateTraceTimeRange() {
+ fTraceStartTime = 0L;
+ fTraceEndTime = 0L;
- TmfTimeRange timeRange = fCurrentExperiment.getTimeRange();
- if (timeRange != TmfTimeRange.Null) {
- fExperimentStartTime = timeRange.getStartTime().getValue();
- fExperimentEndTime = timeRange.getEndTime().getValue();
- fCurrentTimestamp = fExperimentStartTime;
+ TmfTimeRange timeRange = fTrace.getTimeRange();
+ if (!timeRange.equals(TmfTimeRange.NULL_RANGE)) {
+ fTraceStartTime = timeRange.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ fTraceEndTime = timeRange.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
}
return timeRange;
}
private void sendTimeRangeRequest(long startTime, long endTime) {
- if (fTimeRangeRequest != null && !fTimeRangeRequest.isCompleted()) {
+ if ((fTimeRangeRequest != null) && !fTimeRangeRequest.isCompleted()) {
fTimeRangeRequest.cancel();
}
- TmfTimestamp startTS = new TmfTimestamp(startTime, TIME_SCALE);
- TmfTimestamp endTS = new TmfTimestamp(endTime, TIME_SCALE);
+ TmfTimestamp startTS = new TmfTimestamp(startTime, ITmfTimestamp.NANOSECOND_SCALE);
+ TmfTimestamp endTS = new TmfTimestamp(endTime, ITmfTimestamp.NANOSECOND_SCALE);
TmfTimeRange timeRange = new TmfTimeRange(startTS, endTS);
fTimeRangeHistogram.clear();
+ fTimeRangeHistogram.setFullRange(fTraceStartTime, fTraceEndTime);
fTimeRangeHistogram.setTimeRange(startTime, endTime - startTime);
- fTimeRangeRequest = new HistogramRequest(fTimeRangeHistogram.getDataModel(), timeRange, ExecutionType.FOREGROUND);
- fCurrentExperiment.sendRequest(fTimeRangeRequest);
+
+ int cacheSize = fTrace.getCacheSize();
+ fTimeRangeRequest = new HistogramRequest(fTimeRangeHistogram.getDataModel(), timeRange, 0, TmfDataRequest.ALL_DATA, cacheSize, ExecutionType.FOREGROUND);
+ fTrace.sendRequest(fTimeRangeRequest);
}
private void sendFullRangeRequest(TmfTimeRange fullRange) {
- if (fFullTraceRequest != null && !fFullTraceRequest.isCompleted()) {
+ if ((fFullTraceRequest != null) && !fFullTraceRequest.isCompleted()) {
fFullTraceRequest.cancel();
}
+ int cacheSize = fTrace.getCacheSize();
fFullTraceRequest = new HistogramRequest(fFullTraceHistogram.getDataModel(), fullRange, (int) fFullTraceHistogram.fDataModel.getNbEvents(),
- ExecutionType.BACKGROUND);
- fCurrentExperiment.sendRequest(fFullTraceRequest);
+ TmfDataRequest.ALL_DATA, cacheSize, ExecutionType.BACKGROUND);
+ fTrace.sendRequest(fFullTraceRequest);
}
}