analysis: rename latency to segment store for statistics
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Wed, 28 Oct 2015 15:39:39 +0000 (11:39 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Fri, 30 Oct 2015 21:17:56 +0000 (17:17 -0400)
Change-Id: I1bd00e238843e9256d0ffcab38c1752ac0f35180
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/59134
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Hudson CI
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/statistics/LatencyStatistics.java [deleted file]
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/statistics/SegmentStoreStatistics.java [new file with mode: 0644]
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/statistics/SystemCallLatencyStatisticsAnalysisModule.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/latency/statistics/AbstractSegmentStoreStatisticsViewer.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/latency/statistics/Messages.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/latency/statistics/SystemCallLatencyStatisticsViewer.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/latency/statistics/messages.properties

diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/statistics/LatencyStatistics.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/statistics/LatencyStatistics.java
deleted file mode 100644 (file)
index a705a44..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.statistics;
-
-import org.eclipse.tracecompass.segmentstore.core.ISegment;
-
-/**
- * Class to calculate simple latency statistics (min, max, average)
- *
- * @author Bernd Hufmann
- */
-public class LatencyStatistics {
-    private long fMin;
-    private long fMax;
-    private long fSum;
-    private long fNbSegments;
-
-    /**
-     * Constructor
-     */
-    public LatencyStatistics() {
-        this.fMin = Long.MAX_VALUE;
-        this.fMax = Long.MIN_VALUE;
-        this.fSum = 0;
-        this.fNbSegments = 0;
-    }
-
-    /**
-     * Get minimum value
-     *
-     * @return minimum value
-     */
-    public long getMin() {
-        return fMin;
-    }
-
-    /**
-     * Get maximum value
-     *
-     * @return maximum value
-     */
-    public long getMax() {
-        return fMax;
-    }
-
-    /**
-     * Get number of segments analyzed
-     *
-     * @return number of segments analyzed
-     */
-    public long getNbSegments() {
-        return fNbSegments;
-    }
-
-    /**
-     * Gets the arithmetic average
-     *
-     * @return arithmetic average
-     */
-    public double getAverage() {
-        return ((double) fSum) / fNbSegments;
-    }
-
-    /**
-     * Update the statistics based on a given segment
-     *
-     * @param segment
-     *            the segment used for the update
-     */
-    public void update (ISegment segment) {
-        long value = segment.getLength();
-        fMin = Math.min(fMin, value);
-        fMax = Math.max(fMax, value);
-        fSum += value;
-        fNbSegments++;
-    }
-}
diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/statistics/SegmentStoreStatistics.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/statistics/SegmentStoreStatistics.java
new file mode 100644 (file)
index 0000000..c70c3f6
--- /dev/null
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.statistics;
+
+import org.eclipse.tracecompass.segmentstore.core.ISegment;
+
+/**
+ * Class to calculate simple segment store statistics (min, max, average)
+ *
+ * @author Bernd Hufmann
+ */
+public class SegmentStoreStatistics {
+    private long fMin;
+    private long fMax;
+    private long fSum;
+    private long fNbSegments;
+
+    /**
+     * Constructor
+     */
+    public SegmentStoreStatistics() {
+        this.fMin = Long.MAX_VALUE;
+        this.fMax = Long.MIN_VALUE;
+        this.fSum = 0;
+        this.fNbSegments = 0;
+    }
+
+    /**
+     * Get minimum value
+     *
+     * @return minimum value
+     */
+    public long getMin() {
+        return fMin;
+    }
+
+    /**
+     * Get maximum value
+     *
+     * @return maximum value
+     */
+    public long getMax() {
+        return fMax;
+    }
+
+    /**
+     * Get number of segments analyzed
+     *
+     * @return number of segments analyzed
+     */
+    public long getNbSegments() {
+        return fNbSegments;
+    }
+
+    /**
+     * Gets the arithmetic average
+     *
+     * @return arithmetic average
+     */
+    public double getAverage() {
+        return ((double) fSum) / fNbSegments;
+    }
+
+    /**
+     * Update the statistics based on a given segment
+     *
+     * @param segment
+     *            the segment used for the update
+     */
+    public void update (ISegment segment) {
+        long value = segment.getLength();
+        fMin = Math.min(fMin, value);
+        fMax = Math.max(fMax, value);
+        fSum += value;
+        fNbSegments++;
+    }
+}
index 1d39a5cb23544ba2ccb01cdab03a6ba5eafb106a..fd1026d5c86b111eca8b03bb4b7f06bcec391c2d 100644 (file)
@@ -19,8 +19,8 @@ import java.util.Map;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.latency.SystemCallLatencyAnalysis;
 import org.eclipse.tracecompass.analysis.os.linux.core.latency.SystemCall;
+import org.eclipse.tracecompass.analysis.os.linux.core.latency.SystemCallLatencyAnalysis;
 import org.eclipse.tracecompass.segmentstore.core.ISegment;
 import org.eclipse.tracecompass.segmentstore.core.ISegmentStore;
 import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
@@ -43,9 +43,9 @@ public class SystemCallLatencyStatisticsAnalysisModule extends TmfAbstractAnalys
 
     private @Nullable SystemCallLatencyAnalysis fLatencyModule;
 
-    private @Nullable LatencyStatistics fTotalStats;
+    private @Nullable SegmentStoreStatistics fTotalStats;
 
-    private @Nullable Map<String, LatencyStatistics> fPerSyscallStats;
+    private @Nullable Map<String, SegmentStoreStatistics> fPerSyscallStats;
 
     @Override
     protected Iterable<IAnalysisModule> getDependentAnalyses() {
@@ -88,7 +88,7 @@ public class SystemCallLatencyStatisticsAnalysisModule extends TmfAbstractAnalys
     }
 
     private boolean calculateTotalManual(ISegmentStore<ISegment> store, IProgressMonitor monitor) {
-        LatencyStatistics total = new LatencyStatistics();
+        SegmentStoreStatistics total = new SegmentStoreStatistics();
         Iterator<ISegment> iter = store.iterator();
         while (iter.hasNext()) {
             if (monitor.isCanceled()) {
@@ -102,7 +102,7 @@ public class SystemCallLatencyStatisticsAnalysisModule extends TmfAbstractAnalys
     }
 
     private boolean calculateTotalPerSyscall(ISegmentStore<ISegment> store, IProgressMonitor monitor) {
-        Map<String, LatencyStatistics> perSyscallStats = new HashMap<>();
+        Map<String, SegmentStoreStatistics> perSyscallStats = new HashMap<>();
 
         Iterator<ISegment> iter = store.iterator();
         while (iter.hasNext()) {
@@ -112,9 +112,9 @@ public class SystemCallLatencyStatisticsAnalysisModule extends TmfAbstractAnalys
             ISegment segment = iter.next();
             if (segment instanceof SystemCall) {
                 SystemCall syscall = (SystemCall) segment;
-                LatencyStatistics values = perSyscallStats.get(syscall.getName());
+                SegmentStoreStatistics values = perSyscallStats.get(syscall.getName());
                 if (values == null) {
-                    values = new LatencyStatistics();
+                    values = new SegmentStoreStatistics();
                 }
                 values.update(segment);
                 perSyscallStats.put(syscall.getName(), values);
@@ -133,7 +133,7 @@ public class SystemCallLatencyStatisticsAnalysisModule extends TmfAbstractAnalys
      *
      * @return the total statistics
      */
-    public @Nullable LatencyStatistics getTotalStats() {
+    public @Nullable SegmentStoreStatistics getTotalStats() {
         return fTotalStats;
     }
 
@@ -142,7 +142,7 @@ public class SystemCallLatencyStatisticsAnalysisModule extends TmfAbstractAnalys
      *
      * @return the per syscall statistics
      */
-    public @Nullable Map<String, LatencyStatistics> getPerSyscallStats() {
+    public @Nullable Map<String, SegmentStoreStatistics> getPerSyscallStats() {
         return fPerSyscallStats;
     }
 
index 128bb8878c3662fe40ae9e168126bf1da6625075..3abec762e77895adf8011833cd767d05d8abbc45 100644 (file)
@@ -22,7 +22,7 @@ import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerComparator;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.statistics.LatencyStatistics;
+import org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.statistics.SegmentStoreStatistics;
 import org.eclipse.tracecompass.internal.analysis.os.linux.ui.Activator;
 import org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule;
 import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
@@ -33,7 +33,7 @@ import org.eclipse.tracecompass.tmf.ui.viewers.tree.TmfTreeColumnData;
 import org.eclipse.tracecompass.tmf.ui.viewers.tree.TmfTreeViewerEntry;
 
 /**
- * An abstract tree viewer implementation for displaying latency statistics
+ * An abstract tree viewer implementation for displaying segment store statistics
  *
  * @author Bernd Hufmann
  *
@@ -45,10 +45,10 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
     @Nullable private TmfAbstractAnalysisModule fModule;
 
     private static final String[] COLUMN_NAMES = new String[] {
-            checkNotNull(Messages.LatencyStatistics_LevelLabel),
-            checkNotNull(Messages.LatencyStatistics_MinLabel),
-            checkNotNull(Messages.LatencyStatistics_MaxLabel),
-            checkNotNull(Messages.LatencyStatistics_AverageLabel)
+            checkNotNull(Messages.SegmentStoreStatistics_LevelLabel),
+            checkNotNull(Messages.SegmentStoreStatistics_Statistics_MinLabel),
+            checkNotNull(Messages.SegmentStoreStatistics_MaxLabel),
+            checkNotNull(Messages.SegmentStoreStatistics_AverageLabel)
     };
 
     /**
@@ -59,11 +59,11 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
      */
     public AbstractSegmentStoreStatisticsViewer(Composite parent) {
         super(parent, false);
-        setLabelProvider(new LatencyLabelProvider());
+        setLabelProvider(new SegmentStoreStatisticsLabelProvider());
     }
 
-    /** Provides label for the Latency tree viewer cells */
-    protected static class LatencyLabelProvider extends TreeLabelProvider {
+    /** Provides label for the Segment Store tree viewer cells */
+    protected static class SegmentStoreStatisticsLabelProvider extends TreeLabelProvider {
 
         @Override
         public String getColumnText(@Nullable Object element, int columnIndex) {
@@ -72,8 +72,8 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
                 if (columnIndex == 0) {
                     value = ((HiddenTreeViewerEntry) element).getName();
                 }
-            } else if (element instanceof LatencyTreeViewerEntry) {
-                LatencyTreeViewerEntry entry = (LatencyTreeViewerEntry) element;
+            } else if (element instanceof SegmentStoreStatisticsEntry) {
+                SegmentStoreStatisticsEntry entry = (SegmentStoreStatisticsEntry) element;
                 if (columnIndex == 0) {
                     return checkNotNull(String.valueOf(entry.getName()));
                 }
@@ -122,8 +122,8 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
                             return 0;
                         }
 
-                        LatencyTreeViewerEntry n1 = (LatencyTreeViewerEntry) e1;
-                        LatencyTreeViewerEntry n2 = (LatencyTreeViewerEntry) e2;
+                        SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
+                        SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
 
                         return n1.getName().compareTo(n2.getName());
 
@@ -138,8 +138,8 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
                             return 0;
                         }
 
-                        LatencyTreeViewerEntry n1 = (LatencyTreeViewerEntry) e1;
-                        LatencyTreeViewerEntry n2 = (LatencyTreeViewerEntry) e2;
+                        SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
+                        SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
 
                         return Long.compare(n1.getEntry().getMin(), n2.getEntry().getMin());
 
@@ -154,8 +154,8 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
                             return 0;
                         }
 
-                        LatencyTreeViewerEntry n1 = (LatencyTreeViewerEntry) e1;
-                        LatencyTreeViewerEntry n2 = (LatencyTreeViewerEntry) e2;
+                        SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
+                        SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
 
                         return Long.compare(n1.getEntry().getMax(), n2.getEntry().getMax());
 
@@ -170,8 +170,8 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
                             return 0;
                         }
 
-                        LatencyTreeViewerEntry n1 = (LatencyTreeViewerEntry) e1;
-                        LatencyTreeViewerEntry n2 = (LatencyTreeViewerEntry) e2;
+                        SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
+                        SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
 
                         return Double.compare(n1.getEntry().getAverage(), n2.getEntry().getAverage());
 
@@ -219,9 +219,9 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
     /**
      * Class for defining an entry in the statistics tree.
      */
-    protected class LatencyTreeViewerEntry extends TmfTreeViewerEntry {
+    protected class SegmentStoreStatisticsEntry extends TmfTreeViewerEntry {
 
-        private LatencyStatistics fEntry;
+        private SegmentStoreStatistics fEntry;
 
         /**
          * Constructor
@@ -230,9 +230,9 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
          *            name of entry
          *
          * @param entry
-         *            latency statistics object
+         *            segment store statistics object
          */
-        public LatencyTreeViewerEntry(String name, LatencyStatistics entry) {
+        public SegmentStoreStatisticsEntry(String name, SegmentStoreStatistics entry) {
             super(name);
             fEntry = entry;
         }
@@ -242,7 +242,7 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
          *
          * @return statistics object
          */
-        public LatencyStatistics getEntry() {
+        public SegmentStoreStatistics getEntry() {
             return checkNotNull(fEntry);
         }
 
@@ -251,7 +251,7 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
     /**
      * Class to define a level in the tree that doesn't have any values.
      */
-    protected class HiddenTreeViewerEntry extends LatencyTreeViewerEntry {
+    protected class HiddenTreeViewerEntry extends SegmentStoreStatisticsEntry {
         /**
          * Constructor
          *
@@ -259,7 +259,7 @@ public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTr
          *            the name of the level
          */
         public HiddenTreeViewerEntry(String name) {
-            super(name, new LatencyStatistics());
+            super(name, new SegmentStoreStatistics());
         }
     }
 
index 0b430f3e4ebe1d94956d10d295b1cbac1c4a2b3e..bc284941eb1860ee0b92d408ef3c78274a1500df 100644 (file)
@@ -27,13 +27,13 @@ public class Messages extends NLS {
     /** Name of the system call level in statistics tree */
     public static String LatencyStatistics_SyscallLevelName;
     /** Name of level column */
-    public static String LatencyStatistics_LevelLabel;
+    public static String SegmentStoreStatistics_LevelLabel;
     /** Name of the minimum column */
-    public static String LatencyStatistics_MinLabel;
+    public static String SegmentStoreStatistics_Statistics_MinLabel;
     /** Name of maximum column */
-    public static String LatencyStatistics_MaxLabel;
+    public static String SegmentStoreStatistics_MaxLabel;
     /** Name of average column */
-    public static String LatencyStatistics_AverageLabel;
+    public static String SegmentStoreStatistics_AverageLabel;
     /** Name of Total statistics */
     public static String LatencyStatistics_TotalLabel;
 
index 5d640fde53a7dc3c28271b0adedac349c8acde03..8150672c5beabb6d3784d9b4c4c339af43dcaac5 100644 (file)
@@ -20,7 +20,7 @@ import java.util.Map.Entry;
 
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.statistics.LatencyStatistics;
+import org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.statistics.SegmentStoreStatistics;
 import org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.statistics.SystemCallLatencyStatisticsAnalysisModule;
 import org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule;
 import org.eclipse.tracecompass.tmf.ui.viewers.tree.ITmfTreeViewerEntry;
@@ -73,23 +73,23 @@ public class SystemCallLatencyStatisticsViewer extends AbstractSegmentStoreStati
 
         module.waitForCompletion();
 
-        LatencyStatistics entry = module.getTotalStats();
+        SegmentStoreStatistics entry = module.getTotalStats();
 
         TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); //$NON-NLS-1$
         List<ITmfTreeViewerEntry> entryList = root.getChildren();
 
-        TmfTreeViewerEntry child = new LatencyTreeViewerEntry(checkNotNull(Messages.LatencyStatistics_TotalLabel), checkNotNull(entry));
+        TmfTreeViewerEntry child = new SegmentStoreStatisticsEntry(checkNotNull(Messages.LatencyStatistics_TotalLabel), checkNotNull(entry));
         entryList.add(child);
 
         HiddenTreeViewerEntry syscalls = new HiddenTreeViewerEntry(checkNotNull(SYSCALL_LEVEL));
         child.addChild(syscalls);
 
-        Map<String, LatencyStatistics> perSyscallStats = module.getPerSyscallStats();
+        Map<String, SegmentStoreStatistics> perSyscallStats = module.getPerSyscallStats();
         if (perSyscallStats != null) {
-            Iterator<Entry<String, LatencyStatistics>> stats = perSyscallStats.entrySet().iterator();
+            Iterator<Entry<String, SegmentStoreStatistics>> stats = perSyscallStats.entrySet().iterator();
             while (stats.hasNext()) {
-                Entry<String, LatencyStatistics> statsEntry = stats.next();
-                syscalls.addChild(new LatencyTreeViewerEntry(checkNotNull(statsEntry.getKey()), checkNotNull(statsEntry.getValue())));
+                Entry<String, SegmentStoreStatistics> statsEntry = stats.next();
+                syscalls.addChild(new SegmentStoreStatisticsEntry(checkNotNull(statsEntry.getKey()), checkNotNull(statsEntry.getValue())));
             }
         }
         return root;
index 8444942cc04eb710aae2d5a003dc8ac7c3bef358..04e43ba6cfbbf1afd630a088537fd179475d26d4 100644 (file)
@@ -10,9 +10,9 @@
 #     Bernd Hufmann - Initial API and implementation
 ###############################################################################
 LatencyStatistics_SyscallLevelName=System Calls
-LatencyStatistics_LevelLabel=Level
-LatencyStatistics_MinLabel=Minimum
-LatencyStatistics_MaxLabel=Maximum
-LatencyStatistics_AverageLabel=Average
+SegmentStoreStatistics_LevelLabel=Level
+SegmentStoreStatistics_Statistics_MinLabel=Minimum
+SegmentStoreStatistics_MaxLabel=Maximum
+SegmentStoreStatistics_AverageLabel=Average
 LatencyStatistics_TotalLabel=Total
  
\ No newline at end of file
This page took 0.047403 seconds and 5 git commands to generate.