+++ /dev/null
-/*******************************************************************************
- * 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++;
- }
-}
--- /dev/null
+/*******************************************************************************
+ * 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++;
+ }
+}
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;
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() {
}
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()) {
}
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()) {
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);
*
* @return the total statistics
*/
- public @Nullable LatencyStatistics getTotalStats() {
+ public @Nullable SegmentStoreStatistics getTotalStats() {
return fTotalStats;
}
*
* @return the per syscall statistics
*/
- public @Nullable Map<String, LatencyStatistics> getPerSyscallStats() {
+ public @Nullable Map<String, SegmentStoreStatistics> getPerSyscallStats() {
return fPerSyscallStats;
}
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;
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
*
@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)
};
/**
*/
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) {
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()));
}
return 0;
}
- LatencyTreeViewerEntry n1 = (LatencyTreeViewerEntry) e1;
- LatencyTreeViewerEntry n2 = (LatencyTreeViewerEntry) e2;
+ SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
+ SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
return n1.getName().compareTo(n2.getName());
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());
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());
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());
/**
* 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
* 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;
}
*
* @return statistics object
*/
- public LatencyStatistics getEntry() {
+ public SegmentStoreStatistics getEntry() {
return checkNotNull(fEntry);
}
/**
* 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
*
* the name of the level
*/
public HiddenTreeViewerEntry(String name) {
- super(name, new LatencyStatistics());
+ super(name, new SegmentStoreStatistics());
}
}
/** 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;
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;
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;
# 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