aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Hufmann2012-11-30 16:18:02 (EST)
committerBernd Hufmann2012-12-03 07:48:25 (EST)
commit0fb96a23de4007f2a37f70b9d87df0d281d44881 (patch)
tree1232745ca73f3b9a48636c99bff1fd0cd7c17a7d
parent6ccf56714250f70c83d1f12078d2c5eb2648475a (diff)
downloadorg.eclipse.linuxtools-0fb96a23de4007f2a37f70b9d87df0d281d44881.zip
org.eclipse.linuxtools-0fb96a23de4007f2a37f70b9d87df0d281d44881.tar.gz
org.eclipse.linuxtools-0fb96a23de4007f2a37f70b9d87df0d281d44881.tar.bz2
Fix time scaling problem in Histogram Viewrefs/changes/85/8985/2
If scale of TmfTimestamps of a trace is not nano-seconds the start and end time of a trace have to be scaled when comparing with entered time values. Additionally, a NPE was fixed that was happening when clearing the histogram while executing asyncExec() to update the display Change-Id: I39dd3ed3e375ee520678f1de9cb45ee5fccf77d5 Reviewed-on: https://git.eclipse.org/r/8985 Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> IP-Clean: Patrick Tasse <patrick.tasse@gmail.com> Tested-by: Hudson CI
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java6
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java5
2 files changed, 6 insertions, 5 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
index 2ab2b1b..d80b90a 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
@@ -326,7 +326,9 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
*/
public void clear() {
fDataModel.clear();
- fScaledData = null;
+ synchronized (fDataModel) {
+ fScaledData = null;
+ }
}
/**
@@ -459,7 +461,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
}
fDataModel.setCurrentEvent(fCurrentEventTime);
fScaledData = fDataModel.scaleTo(canvasWidth, canvasHeight, 1);
- synchronized(fScaledData) {
+ synchronized(fDataModel) {
if (fScaledData != null) {
fCanvas.redraw();
// Display histogram and update X-,Y-axis labels
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java
index f43d968..678110e 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java
@@ -81,14 +81,13 @@ public class HistogramCurrentTimeControl extends HistogramTextControl {
value = TmfTimestampFormat.getDefaulTimeFormat().parseValue(string, fTraceStartTime);
} catch (ParseException e) {
}
-
if (getValue() != value) {
// Make sure that the new time is within range
ITmfTrace trace = fParentView.getTrace();
if (trace != null) {
TmfTimeRange range = trace.getTimeRange();
- long startTime = range.getStartTime().getValue();
- long endTime = range.getEndTime().getValue();
+ long startTime = range.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ long endTime = range.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
if (value < startTime) {
value = startTime;
} else if (value > endTime) {