import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.statistics.SegmentStoreStatistics;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics.AbstractSegmentsStatisticsViewer;
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;
-import org.eclipse.tracecompass.tmf.ui.viewers.tree.TmfTreeViewerEntry;
/**
* A tree viewer implementation for displaying latency statistics
* @author Bernd Hufmann
*
*/
-public class SystemCallLatencyStatisticsViewer extends AbstractSegmentStoreStatisticsViewer {
+public class SystemCallLatencyStatisticsViewer extends AbstractSegmentsStatisticsViewer {
private static final String SYSCALL_LEVEL = checkNotNull(Messages.LatencyStatistics_SyscallLevelName);
* @return the statistics analysis module
*/
@Override
- @Nullable protected TmfAbstractAnalysisModule createStatisticsAnalysiModule() {
+ protected @Nullable TmfAbstractAnalysisModule createStatisticsAnalysiModule() {
SystemCallLatencyStatisticsAnalysisModule module = new SystemCallLatencyStatisticsAnalysisModule();
return module;
}
@Override
- @Nullable protected ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) {
- if (isSelection || (start == end)) {
- return null;
- }
-
- TmfAbstractAnalysisModule analysisModule = getStatisticsAnalysisModule();
-
- if (getTrace() == null || !(analysisModule instanceof SystemCallLatencyStatisticsAnalysisModule)) {
- return null;
- }
-
- SystemCallLatencyStatisticsAnalysisModule module = (SystemCallLatencyStatisticsAnalysisModule) analysisModule;
-
- module.waitForCompletion();
-
- SegmentStoreStatistics entry = module.getTotalStats();
-
- TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); //$NON-NLS-1$
- List<ITmfTreeViewerEntry> entryList = root.getChildren();
+ protected @NonNull final String getTotalLabel() {
+ return checkNotNull(Messages.LatencyStatistics_TotalLabel);
+ }
- TmfTreeViewerEntry child = new SegmentStoreStatisticsEntry(checkNotNull(Messages.LatencyStatistics_TotalLabel), checkNotNull(entry));
- entryList.add(child);
+ @Override
+ protected @NonNull final String getTypeLabel() {
+ return SYSCALL_LEVEL;
+ }
- HiddenTreeViewerEntry syscalls = new HiddenTreeViewerEntry(checkNotNull(SYSCALL_LEVEL));
- child.addChild(syscalls);
- Map<String, SegmentStoreStatistics> perSyscallStats = module.getPerSyscallStats();
- if (perSyscallStats != null) {
- Iterator<Entry<String, SegmentStoreStatistics>> stats = perSyscallStats.entrySet().iterator();
- while (stats.hasNext()) {
- Entry<String, SegmentStoreStatistics> statsEntry = stats.next();
- syscalls.addChild(new SegmentStoreStatisticsEntry(statsEntry.getKey(), statsEntry.getValue()));
- }
- }
- return root;
- }
}