analysis: Add count column 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 30cfda37f7d6e127efec405c40e11187d3419c14..775fd3f3691405de3870459a12c8c1dc1fc77413 100644 (file)
@@ -52,7 +52,8 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
             checkNotNull(Messages.SegmentStoreStatistics_Statistics_MinLabel),
             checkNotNull(Messages.SegmentStoreStatistics_MaxLabel),
             checkNotNull(Messages.SegmentStoreStatistics_AverageLabel),
-            checkNotNull(Messages.SegmentStoreStatisticsViewer_StandardDeviation)
+            checkNotNull(Messages.SegmentStoreStatisticsViewer_StandardDeviation),
+            checkNotNull(Messages.SegmentStoreStatisticsViewer_Count)
     };
 
     /**
@@ -90,6 +91,8 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
                         value = String.valueOf(toFormattedString(entry.getEntry().getAverage()));
                     } else if (columnIndex == 4) {
                         value = String.valueOf(toFormattedString(entry.getEntry().getStdDev()));
+                    } else if (columnIndex == 5) {
+                        value = String.valueOf(entry.getEntry().getNbSegments());
                     }
                 }
             }
@@ -208,6 +211,23 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
                     }
                 });
                 columns.add(column);
+                column = new TmfTreeColumnData(COLUMN_NAMES[5]);
+                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 Long.compare(n1.getEntry().getNbSegments(), n2.getEntry().getNbSegments());
+
+                    }
+                });
+                columns.add(column);
                 column = new TmfTreeColumnData(""); //$NON-NLS-1$
                 columns.add(column);
                 return columns;
This page took 0.026422 seconds and 5 git commands to generate.