/*******************************************************************************
- * 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
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.request.ITmfDataRequest.ExecutionType;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
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;
gridData.verticalAlignment = SWT.CENTER;
fCurrentEventTimeControl = new HistogramCurrentTimeControl(this, controlsComposite, currentEventLabel, 0L);
fCurrentEventTimeControl.setLayoutData(gridData);
- fCurrentEventTimeControl.setValue(0L);
+ fCurrentEventTimeControl.setValue(Long.MIN_VALUE);
// Window span time control
gridData = new GridData();
gridData.verticalAlignment = SWT.CENTER;
fTimeSpanControl = new HistogramTimeRangeControl(this, controlsComposite, windowSpanLabel, 0L);
fTimeSpanControl.setLayoutData(gridData);
- fTimeSpanControl.setValue(0L);
+ fTimeSpanControl.setValue(Long.MIN_VALUE);
// --------------------------------------------------------------------
// Time range histogram
* 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(
}
private void setNewRange(long startTime, long duration) {
- if (startTime < fTraceStartTime) {
- startTime = fTraceStartTime;
+ long realStart = startTime;
+
+ if (realStart < fTraceStartTime) {
+ realStart = fTraceStartTime;
}
- long endTime = startTime + duration;
+ long endTime = realStart + duration;
if (endTime > fTraceEndTime) {
endTime = fTraceEndTime;
if ((endTime - duration) > fTraceStartTime) {
- startTime = endTime - duration;
+ realStart = endTime - duration;
} else {
- startTime = fTraceStartTime;
+ realStart = fTraceStartTime;
}
}
- updateTimeRange(startTime, endTime);
+ updateTimeRange(realStart, endTime);
}
// ------------------------------------------------------------------------
// Clear the UI widgets
fFullTraceHistogram.clear();
fTimeRangeHistogram.clear();
- fCurrentEventTimeControl.setValue(0L);
+ fCurrentEventTimeControl.setValue(Long.MIN_VALUE);
- fTimeSpanControl.setValue(0);
+ fTimeSpanControl.setValue(Long.MIN_VALUE);
}
/**
return;
}
- boolean drawTimeRangeHistogram = fTraceStartTime == 0;
TmfTimeRange fullRange = signal.getRange();
fTraceStartTime = fullRange.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
fFullTraceHistogram.setFullRange(fTraceStartTime, fTraceEndTime);
fTimeRangeHistogram.setFullRange(fTraceStartTime, fTraceEndTime);
- if (drawTimeRangeHistogram) {
- long startTime = fTrace.getCurrentRange().getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- long duration = fTrace.getCurrentRange().getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue() - startTime;
- fCurrentTimestamp = fTrace.getCurrentTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- fCurrentEventTimeControl.setValue(fCurrentTimestamp);
- fTimeSpanControl.setValue(duration);
- fFullTraceHistogram.setTimeRange(startTime, duration);
- fTimeRangeHistogram.setTimeRange(startTime, duration);
- sendTimeRangeRequest(startTime, startTime + duration);
- }
-
sendFullRangeRequest(fullRange);
}
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);
TmfTimeRange timeRange = new TmfTimeRange(startTS, endTS);
fTimeRangeHistogram.clear();
+ fTimeRangeHistogram.setFullRange(fTraceStartTime, fTraceEndTime);
fTimeRangeHistogram.setTimeRange(startTime, endTime - startTime);
int cacheSize = fTrace.getCacheSize();