tmf : Add latency scatter graph view for the pattern analysis
authorJean-Christian Kouame <jean-christian.kouame@ericsson.com>
Fri, 4 Mar 2016 21:56:48 +0000 (16:56 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Thu, 17 Mar 2016 18:11:28 +0000 (14:11 -0400)
Change-Id: I44ccdf56c3b769e2f0d74dc26e7fe2f1eab568ea
Signed-off-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/67839
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/scatter.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/Messages.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/PatternScatterGraphView.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/PatternScatterGraphViewer.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/messages.properties [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/scatter.png b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/icons/eview16/scatter.png
new file mode 100644 (file)
index 0000000..c375602
Binary files /dev/null and b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/icons/eview16/scatter.png differ
index ee3996282b0ccf4e7120da15e8a2e2d986628771..16782e0faa3ebab5e3b0f5c481f0ae3221aa9b8f 100644 (file)
@@ -22,3 +22,4 @@ xmltimegraph.view.name = XML Time Graph View
 xmlxychart.view.name = XML XY Chart View
 
 latency.view.name = Latency Table
+latency.scatter.view.name = Latency vs Time
index 2db9e18303d652a0ffa73e32561c96c0dc4dfb1b..19a07b1a1ac316a7ed55761e2b2ffc1844d32521 100644 (file)
             name="%latency.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.PatternScatterGraphView"
+            icon="icons/eview16/scatter.png"
+            id="org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.scattergraph"
+            name="%latency.scatter.view.name"
+            restorable="true">
+      </view>
    </extension>
 </plugin>
index 732ab3120d52cad657aaa30766c511e0a57969c0..635308645d32f214a5f2485f1dadf1181c2766e0 100644 (file)
@@ -19,6 +19,8 @@ public class Messages extends NLS {
     private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.module.messages"; //$NON-NLS-1$
     /** Latency table */
     public static String TmfXmlAnalysisOutputSource_LatencyTable;
+    /** Scatter graph title */
+    public static String TmfXmlAnalysisOutputSource_ScatterGraphTitle;
 
     static {
         // initialize resource bundle
index cd026f47e32ae31fd9574f395a771313a4ef228e..87eb0be6012055cf4d1af4e5af41e94bd60b885e 100644 (file)
@@ -7,3 +7,4 @@
 # http://www.eclipse.org/legal/epl-v10.html
 ###############################################################################
 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/Messages.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/Messages.java
new file mode 100644 (file)
index 0000000..75a6dcd
--- /dev/null
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.osgi.util.NLS;
+
+/**
+ * Message for XML analysis latency views
+ *
+ * @author Jean-Christian Kouame
+ */
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency.messages"; //$NON-NLS-1$
+    /**
+     * Scatter graph title
+     */
+    public static String PatternLatencyViews_ScatterGraphTitle;
+    /**
+     * Scatter graph X label
+     */
+    public static String PatternLatencyViews_ScatterGraphXLabel;
+    /**
+     * Scatter graph Y label
+     */
+    public static String PatternLatencyViews_ScatterGraphYLabel;
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternScatterGraphView.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternScatterGraphView.java
new file mode 100644 (file)
index 0000000..413f057
--- /dev/null
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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 static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.XmlLatencyViewInfo;
+import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.TmfXYChartViewer;
+import org.eclipse.tracecompass.tmf.ui.views.TmfChartView;
+
+/**
+ * The scatter graph view for pattern latency
+ *
+ * @author Jean-Christian Kouame
+ */
+public class PatternScatterGraphView extends TmfChartView {
+
+    /** The view's ID */
+    public static final @NonNull String ID = "org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.scattergraph"; //$NON-NLS-1$
+
+    private final XmlLatencyViewInfo fViewInfo = new XmlLatencyViewInfo(ID);
+
+    private PatternScatterGraphViewer fViewer;
+
+    /**
+     * Constructor
+     */
+    public PatternScatterGraphView() {
+        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);
+                        loadLatencyView();
+                    }
+                }
+            }
+        });
+    }
+
+    private void loadLatencyView() {
+        if (fViewer != null) {
+            fViewer.updateViewer(fViewInfo.getViewAnalysisId());
+        }
+    }
+
+    @Override
+    protected TmfXYChartViewer createChartViewer(Composite parent) {
+        PatternScatterGraphViewer viewer = new PatternScatterGraphViewer(checkNotNull(parent), checkNotNull(Messages.PatternLatencyViews_ScatterGraphTitle), checkNotNull(Messages.PatternLatencyViews_ScatterGraphXLabel), checkNotNull(Messages.PatternLatencyViews_ScatterGraphYLabel));
+        fViewer = viewer;
+        loadLatencyView();
+        return viewer;
+    }
+}
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternScatterGraphViewer.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternScatterGraphViewer.java
new file mode 100644 (file)
index 0000000..087a267
--- /dev/null
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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.scatter.AbstractSegmentStoreScatterGraphViewer;
+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.TmfTraceUtils;
+
+/**
+ * Displays the latency analysis data in a scatter graph
+ *
+ * @author Jean-Christian Kouame
+ */
+public class PatternScatterGraphViewer extends AbstractSegmentStoreScatterGraphViewer {
+
+    private String fAnalysisId;
+
+    /**
+     * Constructor
+     *
+     * @param parent
+     *            The parent composite
+     * @param title
+     *            The view title
+     * @param xLabel
+     *            The x axis label
+     * @param yLabel
+     *            The y axis label
+     */
+    public PatternScatterGraphViewer(@NonNull Composite parent, @NonNull String title, @NonNull String xLabel, @NonNull String yLabel) {
+        super(parent, title, xLabel, yLabel);
+    }
+
+    @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;
+            initializeDataSource();
+        }
+    }
+}
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/messages.properties b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/messages.properties
new file mode 100644 (file)
index 0000000..45e5619
--- /dev/null
@@ -0,0 +1,11 @@
+###############################################################################
+# 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
+###############################################################################
+PatternLatencyViews_ScatterGraphTitle=Duration vs Time
+PatternLatencyViews_ScatterGraphXLabel=Time
+PatternLatencyViews_ScatterGraphYLabel=Duration
index d6a88f767253ba32e5906e9f8d63ef04e4f52678..5f38a07aaab4c0044c34f253f54cc6b1be81699c 100644 (file)
@@ -27,6 +27,7 @@ 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.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;
 import org.eclipse.tracecompass.tmf.analysis.xml.core.module.XmlUtils;
 import org.eclipse.tracecompass.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
@@ -98,7 +99,12 @@ public class TmfXmlAnalysisOutputSource implements ITmfNewAnalysisModuleListener
         /**
          * Latency Table View type
          */
-        LATENCY_TABLE(PatternLatencyTableView.ID, Messages.TmfXmlAnalysisOutputSource_LatencyTable);
+        LATENCY_TABLE(PatternLatencyTableView.ID, Messages.TmfXmlAnalysisOutputSource_LatencyTable),
+
+        /**
+         * Latency Scatter View type
+         */
+        SCATTER_GRAPH(PatternScatterGraphView.ID, Messages.TmfXmlAnalysisOutputSource_ScatterGraphTitle);
 
         private @NonNull String fLatencyViewId;
         private String fLatencyViewLabel;
@@ -169,7 +175,7 @@ public class TmfXmlAnalysisOutputSource implements ITmfNewAnalysisModuleListener
                     }
                 }
 
-                //Add the latency views for pattern analysis
+                // Add the latency views for pattern analysis
                 if (module instanceof XmlPatternAnalysis) {
                     for (LatencyViewType viewType : LatencyViewType.values()) {
                         IAnalysisOutput output = new TmfXmlLatencyViewOutput(viewType.getViewId(), viewType.getLabel());
This page took 0.031345 seconds and 5 git commands to generate.