analysis: Add totals to latency statistics view
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Thu, 26 May 2016 22:02:59 +0000 (18:02 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tue, 12 Jul 2016 21:04:21 +0000 (17:04 -0400)
Having the total is useful to know how much time was spent in a given
segment type.

For example, I have a Maven output analysis that computes the beginning
and end of each goal. By having the total, I can quickly see which type
of goal took the longest and then I can drill down to single instances.

Change-Id: Id59a81191726ad926821f7a250d56f4fbc622f7a
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/73770
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
analysis/org.eclipse.tracecompass.analysis.timing.core/META-INF/MANIFEST.MF
analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/analysis/timing/core/segmentstore/statistics/SegmentStoreStatistics.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/META-INF/MANIFEST.MF
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/AbstractSegmentStoreStatisticsViewer.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/statistics/Messages.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/statistics/messages.properties

index 9a5489390fcd223d755f96fd3cc7eefe1318b973..27b344b922ab82c9d2ee0c518af38aeb4199517d 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.1.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.tracecompass.analysis.timing.core;singleton:=true
 Bundle-Activator: org.eclipse.tracecompass.internal.analysis.timing.core.Activator
index 7adbe7255ed4cec61c22a343e0e7eb0b2bad91ae..f71c65198469148ac37c7d1ae8959b13362b6d9f 100644 (file)
@@ -25,6 +25,7 @@ public class SegmentStoreStatistics {
     private long fNbSegments;
     private double fAverage;
     private double fVariance;
+    private double fTotal;
 
     /**
      * Constructor
@@ -35,6 +36,7 @@ public class SegmentStoreStatistics {
         fNbSegments = 0;
         fAverage = 0.0;
         fVariance = 0.0;
+        fTotal = 0.0;
     }
 
     /**
@@ -129,5 +131,16 @@ public class SegmentStoreStatistics {
         double delta = value - fAverage;
         fAverage += delta / fNbSegments;
         fVariance += delta * (value - fAverage);
+        fTotal += value;
+    }
+
+    /**
+     * Get total value
+     *
+     * @return total value
+     * @since 1.1
+     */
+    public double getTotal() {
+        return fTotal;
     }
 }
index 2cbb6c15d57b9f96a43ae8a51e6bb0abb58c793a..448c533a67459879304c9a0c2fda0b1345fa26cc 100644 (file)
@@ -2,7 +2,7 @@ lttManifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.1.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.tracecompass.analysis.timing.ui;singleton:=true
 Bundle-Activator: org.eclipse.tracecompass.internal.analysis.timing.ui.Activator
index ad5f7d88bc0d0df2e8dd5d6e968b493a86e41005..e6472353ce0b4f5194ba51ae84fee3729d1a39dd 100644 (file)
@@ -65,7 +65,8 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
             checkNotNull(Messages.SegmentStoreStatistics_MaxLabel),
             checkNotNull(Messages.SegmentStoreStatistics_AverageLabel),
             checkNotNull(Messages.SegmentStoreStatisticsViewer_StandardDeviation),
-            checkNotNull(Messages.SegmentStoreStatisticsViewer_Count)
+            checkNotNull(Messages.SegmentStoreStatisticsViewer_Count),
+            checkNotNull(Messages.SegmentStoreStatisticsViewer_Total)
     };
 
     /**
@@ -119,6 +120,8 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
                         value = String.valueOf(toFormattedString(entry.getEntry().getStdDev()));
                     } else if (columnIndex == 5) {
                         value = String.valueOf(entry.getEntry().getNbSegments());
+                    } else if (columnIndex == 6) {
+                        value = String.valueOf(toFormattedString(entry.getEntry().getTotal()));
                     }
                 }
             }
@@ -254,6 +257,23 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
                     }
                 });
                 columns.add(column);
+                column = new TmfTreeColumnData(COLUMN_NAMES[6]);
+                column.setAlignment(SWT.RIGHT);
+                column.setComparator(new ViewerComparator() {
+                    @Override
+                    public int compare(@Nullable Viewer viewer, @Nullable Object e1, @Nullable Object e2) {
+                        if ((e1 == null) || (e2 == null)) {
+                            return 0;
+                        }
+
+                        SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
+                        SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
+
+                        return Double.compare(n1.getEntry().getTotal(), n2.getEntry().getTotal());
+
+                    }
+                });
+                columns.add(column);
                 column = new TmfTreeColumnData(""); //$NON-NLS-1$
                 columns.add(column);
                 return columns;
index 3086c1af09feaf839eadb518fe87aeed58924291..cadeaa8f41bb8907f996f15f4df6613e251b6190 100644 (file)
@@ -32,6 +32,12 @@ public class Messages extends NLS {
     public static String SegmentStoreStatistics_AverageLabel;
     /** Name of count column */
     public static String SegmentStoreStatisticsViewer_Count;
+    /**
+     * Name of count column
+     *
+     * @since 1.1
+     */
+    public static String SegmentStoreStatisticsViewer_Total;
     /** Name of average column */
     public static String SegmentStoreStatisticsViewer_StandardDeviation;
     /** Menu item for go to minimum duration */
index bbc11cdbe36988505fff294689e52b1f69f97cb0..beb2de0fc6ef7401821c77b4725226e002c6ff60 100644 (file)
@@ -14,6 +14,7 @@ SegmentStoreStatistics_Statistics_MinLabel=Minimum
 SegmentStoreStatistics_MaxLabel=Maximum
 SegmentStoreStatistics_AverageLabel=Average
 SegmentStoreStatisticsViewer_Count=Count
+SegmentStoreStatisticsViewer_Total=Total
 SegmentStoreStatisticsViewer_StandardDeviation=Standard Deviation
 SegmentStoreStatisticsViewer_GotoMinAction=Go to minimum
 SegmentStoreStatisticsViewer_GotoMaxAction=Go to maximum
\ No newline at end of file
This page took 0.027504 seconds and 5 git commands to generate.