tmf : Update the histogram to handle lost events correctly
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / histogram / HistogramScaledData.java
index 52487a7b6aee6956a89f1835f365c948e2dc470b..491529ac6a3195303aac45318b6442ce04fc8af0 100644 (file)
@@ -11,6 +11,7 @@
  *   Bernd Hufmann - Added setter and getter and bar width support
  *   Francois Chouinard - Moved from LTTng to TMF
  *   Patrick Tasse - Support selection range
+ *   Jean-Christian Kouamé - Support to manage lost events
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.ui.views.histogram;
@@ -53,6 +54,12 @@ public class HistogramScaledData {
      * Array of scaled values
      */
     public int[] fData;
+    /**
+     * Array of scaled values combined including the lost events.
+     * This array contains the number of lost events for each bar in the histogram
+     * @since 2.1
+     */
+    public final int[] fLostEventsData;
     /**
      * The bucket duration of a scaled data bucket.
      */
@@ -61,6 +68,11 @@ public class HistogramScaledData {
      * The maximum number of events of all buckets.
      */
     public long fMaxValue;
+    /**
+     * the maximum of events of all buckets including the lost events
+     * @since 2.1
+     */
+    public long fMaxCombinedValue;
     /**
      * The index of the current bucket.
      */
@@ -84,6 +96,14 @@ public class HistogramScaledData {
      * The scaling factor used to fill the scaled data.
      */
     public double fScalingFactor;
+    /**
+     * The scaling factor used to fill the scaled data including the lost events.
+     * @since 2.1
+     */
+    public double fScalingFactorCombined;
+    /**
+     * The scaling factor used to fill the combining scaled data including lost events
+     */
     /**
      * Time of first bucket.
      */
@@ -92,7 +112,11 @@ public class HistogramScaledData {
      * The time of the first event.
      */
     public long fFirstEventTime;
-
+    /**
+     * show the lost events or not
+     * @since 2.1
+     */
+    public static volatile boolean hideLostEvents = false;
     // ------------------------------------------------------------------------
     // Constructor
     // ------------------------------------------------------------------------
@@ -107,14 +131,16 @@ public class HistogramScaledData {
         fWidth = width;
         fHeight = height;
         fBarWidth = barWidth;
-        fData = new int[width/fBarWidth];
-        Arrays.fill(fData, 0);
+        fData = new int[width / fBarWidth];
+        fLostEventsData = new int[width / fBarWidth];
         fBucketDuration = 1;
         fMaxValue = 0;
+        fMaxCombinedValue = 0;
         fSelectionBeginBucket = 0;
         fSelectionEndBucket = 0;
         fLastBucket = 0;
         fScalingFactor = 1;
+        fScalingFactorCombined = 1;
         fFirstBucketTime = 0;
     }
 
@@ -126,13 +152,16 @@ public class HistogramScaledData {
         fWidth = other.fWidth;
         fHeight = other.fHeight;
         fBarWidth = other.fBarWidth;
-        fData = Arrays.copyOf(other.fData, fWidth);
+        fData = Arrays.copyOf(other.fData, other.fData.length);
+        fLostEventsData  = Arrays.copyOf(other.fLostEventsData, other.fLostEventsData.length);
         fBucketDuration = other.fBucketDuration;
         fMaxValue = other.fMaxValue;
+        fMaxCombinedValue = other.fMaxCombinedValue;
         fSelectionBeginBucket = other.fSelectionBeginBucket;
         fSelectionEndBucket = other.fSelectionEndBucket;
         fLastBucket = other.fLastBucket;
         fScalingFactor = other.fScalingFactor;
+        fScalingFactorCombined = other.fScalingFactorCombined;
         fFirstBucketTime = other.fFirstBucketTime;
     }
 
@@ -181,4 +210,4 @@ public class HistogramScaledData {
     public long getBucketEndTime(int index) {
         return getBucketStartTime(index) + fBucketDuration;
     }
-}
\ No newline at end of file
+}
This page took 0.028532 seconds and 5 git commands to generate.