tmf : Add latency density view for the pattern analysis
authorJean-Christian Kouame <jean-christian.kouame@ericsson.com>
Fri, 4 Mar 2016 22:02:00 +0000 (17:02 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Thu, 17 Mar 2016 18:11:59 +0000 (14:11 -0400)
Change-Id: Iedc781b8d8d5ae6a22eb699270e540f4826be38b
Signed-off-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/67840
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/icons/eview16/density.png [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/plugin.properties
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/plugin.xml
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/module/Messages.java
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/module/messages.properties
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternDensityView.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternDensityViewer.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/module/TmfXmlAnalysisOutputSource.java

diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/icons/eview16/density.png b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/icons/eview16/density.png
new file mode 100644 (file)
index 0000000..e3c9e1b
Binary files /dev/null and b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/icons/eview16/density.png differ
index 16782e0faa3ebab5e3b0f5c481f0ae3221aa9b8f..be6d59631de976fd323fefcdff92835dfd10578e 100644 (file)
@@ -23,3 +23,4 @@ xmlxychart.view.name = XML XY Chart View
 
 latency.view.name = Latency Table
 latency.scatter.view.name = Latency vs Time
+latency.density.view.name = Latency vs Count
index 19a07b1a1ac316a7ed55761e2b2ffc1844d32521..b2dfa942e406914f9d262b4b601adfae903458c9 100644 (file)
             name="%latency.scatter.view.name"
             restorable="true">
       </view>
+      <view
+            allowMultiple="false"
+            category="org.eclipse.linuxtools.tmf.ui.views.category"
+            class="org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency.PatternDensityView"
+            icon="icons/eview16/density.png"
+            id="org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.density"
+            name="%latency.density.view.name"
+            restorable="true">
+      </view>
    </extension>
 </plugin>
index 635308645d32f214a5f2485f1dadf1181c2766e0..48963e57d87bfcb54f98390f56cb055f2b2dd889 100644 (file)
@@ -17,6 +17,8 @@ import org.eclipse.osgi.util.NLS;
  */
 public class Messages extends NLS {
     private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.module.messages"; //$NON-NLS-1$
+    /** Density chart title */
+    public static String TmfXmlAnalysisOutputSource_DensityChartTitle;
     /** Latency table */
     public static String TmfXmlAnalysisOutputSource_LatencyTable;
     /** Scatter graph title */
index 87eb0be6012055cf4d1af4e5af41e94bd60b885e..eccaf2331ec3e965731c3384fb7c9b1dd73b6ba8 100644 (file)
@@ -6,5 +6,6 @@
 # which accompanies this distribution, and is available at
 # http://www.eclipse.org/legal/epl-v10.html
 ###############################################################################
+TmfXmlAnalysisOutputSource_DensityChartTitle=Latency vs Count
 TmfXmlAnalysisOutputSource_LatencyTable=Latency Table
 TmfXmlAnalysisOutputSource_ScatterGraphTitle=Latency vs Time
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternDensityView.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternDensityView.java
new file mode 100644 (file)
index 0000000..d71c6b6
--- /dev/null
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ *******************************************************************************/
+package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density.AbstractSegmentStoreDensityView;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density.AbstractSegmentStoreDensityViewer;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableViewer;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.XmlLatencyViewInfo;
+
+/**
+ * Displays the latency density view for pattern analysis
+ *
+ * @author Jean-Christian Kouame
+ */
+public class PatternDensityView extends AbstractSegmentStoreDensityView {
+
+    /** The view's ID */
+    public static final @NonNull String ID = "org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.density"; //$NON-NLS-1$
+
+    private final XmlLatencyViewInfo fViewInfo = new XmlLatencyViewInfo(ID);
+
+    private PatternDensityViewer fDensityViewer;
+    private PatternLatencyTableViewer fTableViewer;
+
+    /**
+     * Constructor
+     */
+    public PatternDensityView() {
+        super(ID);
+        this.addPartPropertyListener(new IPropertyChangeListener() {
+            @Override
+            public void propertyChange(PropertyChangeEvent event) {
+                if (event.getProperty().equals(TmfXmlUiStrings.XML_LATENCY_OUTPUT_DATA)) {
+                    Object newValue = event.getNewValue();
+                    if (newValue instanceof String) {
+                        String data = (String) newValue;
+                        fViewInfo.setViewData(data);
+                        loadTableViewer();
+                        loadDensityViewer();
+                    }
+                }
+            }
+        });
+    }
+
+    private void loadTableViewer() {
+        if (fTableViewer != null) {
+            fTableViewer.updateViewer(fViewInfo.getViewAnalysisId());
+        }
+    }
+
+    private void loadDensityViewer() {
+        if (fDensityViewer != null) {
+            fDensityViewer.updateViewer(fViewInfo.getViewAnalysisId());
+        }
+    }
+
+    @Override
+    protected @NonNull AbstractSegmentStoreTableViewer createSegmentStoreTableViewer(@NonNull Composite parent) {
+        PatternLatencyTableViewer tableViewer = new PatternLatencyTableViewer(new TableViewer(parent, SWT.FULL_SELECTION | SWT.VIRTUAL)) {
+            @Override
+            protected void createProviderColumns() {
+                super.createProviderColumns();
+                Table t = (Table) getControl();
+                t.setColumnOrder(new int[] { 0, 1, 2, 3, 4});
+            }
+        };
+        fTableViewer = tableViewer;
+        loadTableViewer();
+        return tableViewer;
+    }
+
+    @Override
+    protected @NonNull AbstractSegmentStoreDensityViewer createSegmentStoreDensityViewer(@NonNull Composite parent) {
+        PatternDensityViewer densityViewer = new PatternDensityViewer(NonNullUtils.checkNotNull(parent));
+        fDensityViewer = densityViewer;
+        loadDensityViewer();
+        return densityViewer;
+    }
+}
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternDensityViewer.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternDensityViewer.java
new file mode 100644 (file)
index 0000000..51f9aa9
--- /dev/null
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ *******************************************************************************/
+package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency;
+
+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.ui.views.segmentstore.density.AbstractSegmentStoreDensityViewer;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider.XmlPatternAnalysis;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
+
+/**
+ * Displays the latency analysis data in a density chart
+ *
+ * @author Jean-Christian Kouame
+ */
+public class PatternDensityViewer extends AbstractSegmentStoreDensityViewer {
+
+    private String fAnalysisId;
+
+    /**
+     * Contructor
+     *
+     * @param parent
+     *            The parent composite
+     */
+    public PatternDensityViewer(@NonNull Composite parent) {
+        super(parent);
+    }
+
+    @Override
+    protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(@NonNull ITmfTrace trace) {
+        return fAnalysisId != null ? TmfTraceUtils.getAnalysisModuleOfClass(trace, XmlPatternAnalysis.class, fAnalysisId) : null;
+    }
+
+    /**
+     * Set the analysis ID and update the view
+     *
+     * @param analysisId
+     *            The analysis ID
+     */
+    public void updateViewer(String analysisId) {
+        if (analysisId != null) {
+            fAnalysisId = analysisId;
+            final ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
+            if (trace != null) {
+                loadTrace(trace);
+            }
+        }
+    }
+}
index 5f38a07aaab4c0044c34f253f54cc6b1be81699c..197718a66f5f7baf8836b5926dfca3e79e0d340b 100644 (file)
@@ -26,6 +26,7 @@ import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprov
 import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.Activator;
 import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
 import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.module.Messages;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency.PatternDensityView;
 import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency.PatternLatencyTableView;
 import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency.PatternScatterGraphView;
 import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.xychart.XmlXYView;
@@ -104,7 +105,12 @@ public class TmfXmlAnalysisOutputSource implements ITmfNewAnalysisModuleListener
         /**
          * Latency Scatter View type
          */
-        SCATTER_GRAPH(PatternScatterGraphView.ID, Messages.TmfXmlAnalysisOutputSource_ScatterGraphTitle);
+        SCATTER_GRAPH(PatternScatterGraphView.ID, Messages.TmfXmlAnalysisOutputSource_ScatterGraphTitle),
+
+        /**
+         * Latency Density View type
+         */
+        DENSITY_VIEW(PatternDensityView.ID, Messages.TmfXmlAnalysisOutputSource_DensityChartTitle);
 
         private @NonNull String fLatencyViewId;
         private String fLatencyViewLabel;
This page took 0.031762 seconds and 5 git commands to generate.