timing: Add a generic statistics table view
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Thu, 22 Sep 2016 20:59:37 +0000 (16:59 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Tue, 25 Apr 2017 15:34:30 +0000 (11:34 -0400)
Change-Id: Ia199415d1b292fdf2175827ad687f1d41d7b7ff5
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/82285
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
analysis/org.eclipse.tracecompass.analysis.timing.ui/META-INF/MANIFEST.MF
analysis/org.eclipse.tracecompass.analysis.timing.ui/icons/eview16/statistics_view.gif [new file with mode: 0755]
analysis/org.eclipse.tracecompass.analysis.timing.ui/plugin.properties
analysis/org.eclipse.tracecompass.analysis.timing.ui/plugin.xml
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/SegmentStoreStatisticsView.java [new file with mode: 0644]
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/SegmentStoreStatisticsViewer.java [new file with mode: 0644]

index 5fed50a44e3970e16fbb698f003ad7dfd974d680..bbf04ecb9184b1ed70dc66de86620601811c2d90 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.3.0.qualifier
+Bundle-Version: 1.4.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.tracecompass.analysis.timing.ui;singleton:=true
 Bundle-Activator: org.eclipse.tracecompass.internal.analysis.timing.ui.Activator
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/icons/eview16/statistics_view.gif b/analysis/org.eclipse.tracecompass.analysis.timing.ui/icons/eview16/statistics_view.gif
new file mode 100755 (executable)
index 0000000..d11c996
Binary files /dev/null and b/analysis/org.eclipse.tracecompass.analysis.timing.ui/icons/eview16/statistics_view.gif differ
index 23104f45087774ca0e0c5e5b3a899a1acffbce19..b7f17323b472eaffaaf1fd39f8f8b57697e6836b 100644 (file)
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2015 École Polytechnique de montréal
+# Copyright (c) 2015-2017 École Polytechnique de montréal
 #
 # All rights reserved. This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License v1.0
@@ -15,3 +15,4 @@ view.execgraph = Execution Graph View
 view.callgraphDensity= Function Durations Distribution
 view.flameGraph= Flame Graph
 view.segstore.table = Segment Store Table
+view.segstore.statistics = Descriptive Statistics
index af92392f667998ba12751a7a309323bbbc0f027a..3f84827d09d55b2fa233e3496e22c1c8d80ac992 100644 (file)
             name="%view.segstore.table"
             restorable="true">
       </view>
+      <view
+            category="org.eclipse.linuxtools.tmf.ui.views.category"
+            class="org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics.SegmentStoreStatisticsView"
+            icon="icons/eview16/statistics_view.gif"
+            id="org.eclipse.tracecompass.analysis.timing.ui.segstore.statistics"
+            name="%view.segstore.statistics"
+            restorable="true">
+      </view>
    </extension>
 </plugin>
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/SegmentStoreStatisticsView.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/SegmentStoreStatisticsView.java
new file mode 100644 (file)
index 0000000..66aa1c7
--- /dev/null
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2016 École Polytechnique de Montréal
+ *
+ * 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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.IViewDescriptor;
+
+/**
+ * Generic view for showing segment store statistics analysis data
+ *
+ * @since 1.4
+ */
+public class SegmentStoreStatisticsView extends AbstractSegmentsStatisticsView {
+
+    /**
+     * ID of this view
+     */
+    public static final String ID = "org.eclipse.tracecompass.analysis.timing.ui.segstore.statistics"; //$NON-NLS-1$
+
+    @Override
+    public void createPartControl(@Nullable Composite parent) {
+        super.createPartControl(parent);
+        // Set the title of the view from the actual view ID
+        IViewDescriptor desc = PlatformUI.getWorkbench().getViewRegistry().find(getViewId());
+        if (desc != null) {
+            setPartName(desc.getLabel());
+        }
+    }
+
+    @Override
+    protected @NonNull AbstractSegmentsStatisticsViewer createSegmentStoreStatisticsViewer(@NonNull Composite parent) {
+        // The analysis ID is the secondary ID of the view
+        String analysisId = NonNullUtils.nullToEmptyString(getViewSite().getSecondaryId());
+        return new SegmentStoreStatisticsViewer(parent, analysisId);
+    }
+
+}
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/SegmentStoreStatisticsViewer.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/SegmentStoreStatisticsViewer.java
new file mode 100644 (file)
index 0000000..a5daa80
--- /dev/null
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2016 École Polytechnique de Montréal
+ *
+ * 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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider;
+import org.eclipse.tracecompass.analysis.timing.core.segmentstore.statistics.AbstractSegmentStatisticsAnalysis;
+import org.eclipse.tracecompass.segmentstore.core.ISegment;
+import org.eclipse.tracecompass.segmentstore.core.segment.interfaces.INamedSegment;
+import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
+import org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+
+/**
+ * Generic viewer to show segment store statistics analysis data.
+ *
+ * @since 1.4
+ */
+public class SegmentStoreStatisticsViewer extends AbstractSegmentsStatisticsViewer {
+
+    private final String fAnalysisId;
+
+    /**
+     * Constructor
+     *
+     * @param parent
+     *            The parent composite
+     * @param analysisId
+     *            The ID of the segment store provider to do statistics on
+     */
+    public SegmentStoreStatisticsViewer(Composite parent, String analysisId) {
+        super(parent);
+        fAnalysisId = analysisId;
+    }
+
+    @Override
+    protected @Nullable TmfAbstractAnalysisModule createStatisticsAnalysiModule() {
+        AbstractSegmentStatisticsAnalysis module = new AbstractSegmentStatisticsAnalysis() {
+
+            @Override
+            protected @Nullable String getSegmentType(@NonNull ISegment segment) {
+                if (segment instanceof INamedSegment) {
+                    return ((INamedSegment) segment).getName();
+                }
+                return null;
+            }
+
+            @Override
+            protected @Nullable ISegmentStoreProvider getSegmentProviderAnalysis(@NonNull ITmfTrace trace) {
+                IAnalysisModule m = trace.getAnalysisModule(fAnalysisId);
+                if (!(m instanceof ISegmentStoreProvider)) {
+                    return null;
+                }
+                return (ISegmentStoreProvider) m;
+            }
+
+        };
+        return module;
+    }
+
+}
This page took 0.028333 seconds and 5 git commands to generate.