analysis: Add totals to latency statistics view
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.timing.ui / src / org / eclipse / tracecompass / analysis / timing / ui / views / segmentstore / statistics / AbstractSegmentStoreStatisticsViewer.java
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;
This page took 0.026254 seconds and 5 git commands to generate.