tmf.core/ui: Introduce CallStackAnalysis
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Wed, 20 Jul 2016 23:54:19 +0000 (19:54 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Fri, 22 Jul 2016 14:13:58 +0000 (10:13 -0400)
This class moves the core of the call stack to tmf.core. It
decouples core logic from UI.

Change-Id: I3d393a9663a4d79817d1867f4759bdb1df2ccfed
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/77643
Reviewed-by: Hudson CI
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/callstack/CallStackAnalysis.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/AbstractCallStackAnalysis.java

diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/callstack/CallStackAnalysis.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/callstack/CallStackAnalysis.java
new file mode 100644 (file)
index 0000000..923c4b9
--- /dev/null
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2013, 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
+ *******************************************************************************/
+package org.eclipse.tracecompass.tmf.core.callstack;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
+
+/**
+ * The base classes for analyses who want to populate the CallStack state
+ * system.
+ *
+ * @author Matthew Khouzam
+ * @since 2.1
+ */
+@NonNullByDefault
+public abstract class CallStackAnalysis extends TmfStateSystemAnalysisModule {
+
+    private static final String[] DEFAULT_PROCESSES_PATTERN = new String[] { CallStackStateProvider.PROCESSES, "*" }; //$NON-NLS-1$
+    private static final String[] DEFAULT_THREADS_PATTERN = new String[] { "*" }; //$NON-NLS-1$
+    private static final String[] DEFAULT_CALL_STACK_PATH = new String[] { CallStackStateProvider.CALL_STACK };
+
+    /**
+     * Abstract constructor (should only be called via the sub-classes'
+     * constructors.
+     */
+    protected CallStackAnalysis() {
+        super();
+    }
+
+    /**
+     * The quark pattern, relative to the root, to get the list of attributes
+     * representing the different processes of a trace.
+     * <p>
+     * If the trace does not define processes, an empty array can be returned.
+     * <p>
+     * The pattern is passed as-is to
+     * {@link org.eclipse.tracecompass.statesystem.core.ITmfStateSystem#getQuarks(String...)}.
+     * <p>
+     * Override this method if the state system attributes do not match the
+     * default pattern defined by {@link CallStackStateProvider}.
+     *
+     * @return The quark pattern to find the process attributes
+     */
+    public String[] getProcessesPattern() {
+        return DEFAULT_PROCESSES_PATTERN;
+    }
+
+    /**
+     * The quark pattern, relative to an attribute found by
+     * {@link #getProcessesPattern()}, to get the list of attributes
+     * representing the threads of a process, or the threads a trace if the
+     * process pattern was empty.
+     * <p>
+     * If the trace does not define threads, an empty array can be returned.
+     * <p>
+     * This will be passed as-is to
+     * {@link org.eclipse.tracecompass.statesystem.core.ITmfStateSystem#getQuarks(int, String...)}.
+     * <p>
+     * Override this method if the state system attributes do not match the
+     * default pattern defined by {@link CallStackStateProvider}.
+     *
+     * @return The quark pattern to find the thread attributes
+     */
+    public String[] getThreadsPattern() {
+        return DEFAULT_THREADS_PATTERN;
+    }
+
+    /**
+     * Get the call stack attribute path, relative to an attribute found by the
+     * combination of {@link #getProcessesPattern()} and
+     * {@link #getThreadsPattern()}.
+     * <p>
+     * Override this method if the state system attributes do not match the
+     * default pattern defined by {@link CallStackStateProvider}.
+     *
+     * @return the relative path of the call stack attribute
+     */
+    public String[] getCallStackPath() {
+        return DEFAULT_CALL_STACK_PATH;
+    }
+
+}
\ No newline at end of file
index c8417878b8dc680a8648d3a8642ce476fb421f6f..6c39a1f438a32355b880095247fe241b396002b9 100644 (file)
@@ -14,8 +14,7 @@
 package org.eclipse.tracecompass.tmf.ui.views.callstack;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.tracecompass.tmf.core.callstack.CallStackStateProvider;
-import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
+import org.eclipse.tracecompass.tmf.core.callstack.CallStackAnalysis;
 import org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput;
 
 /**
@@ -23,17 +22,12 @@ import org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput;
  *
  * @author Alexandre Montplaisir
  */
+/*
+ * FIXME: deprecate at next release when we can move the callstack view to an
+ * extension point
+ */
 @NonNullByDefault
-public abstract class AbstractCallStackAnalysis extends TmfStateSystemAnalysisModule {
-
-    private static final String[] DEFAULT_PROCESSES_PATTERN =
-            new String[] { CallStackStateProvider.PROCESSES, "*" }; //$NON-NLS-1$
-
-    private static final String[] DEFAULT_THREADS_PATTERN =
-            new String[] { "*" }; //$NON-NLS-1$
-
-    private static final String[] DEFAULT_CALL_STACK_PATH =
-            new String[] { CallStackStateProvider.CALL_STACK };
+public abstract class AbstractCallStackAnalysis extends CallStackAnalysis {
 
     /**
      * Abstract constructor (should only be called via the sub-classes'
@@ -43,57 +37,4 @@ public abstract class AbstractCallStackAnalysis extends TmfStateSystemAnalysisMo
         super();
         registerOutput(new TmfAnalysisViewOutput(CallStackView.ID));
     }
-
-    /**
-     * The quark pattern, relative to the root, to get the list of attributes
-     * representing the different processes of a trace.
-     * <p>
-     * If the trace does not define processes, an empty array can be returned.
-     * <p>
-     * The pattern is passed as-is to
-     * {@link org.eclipse.tracecompass.statesystem.core.ITmfStateSystem#getQuarks(String...)}.
-     * <p>
-     * Override this method if the state system attributes do not match the
-     * default pattern defined by {@link CallStackStateProvider}.
-     *
-     * @return The quark pattern to find the process attributes
-     * @since 2.0
-     */
-    public String[] getProcessesPattern() {
-        return DEFAULT_PROCESSES_PATTERN;
-    }
-
-    /**
-     * The quark pattern, relative to an attribute found by
-     * {@link #getProcessesPattern()}, to get the list of attributes
-     * representing the threads of a process, or the threads a trace if the
-     * process pattern was empty.
-     * <p>
-     * If the trace does not define threads, an empty array can be returned.
-     * <p>
-     * This will be passed as-is to
-     * {@link org.eclipse.tracecompass.statesystem.core.ITmfStateSystem#getQuarks(int, String...)}.
-     * <p>
-     * Override this method if the state system attributes do not match the
-     * default pattern defined by {@link CallStackStateProvider}.
-     *
-     * @return The quark pattern to find the thread attributes
-     */
-    public String[] getThreadsPattern() {
-        return DEFAULT_THREADS_PATTERN;
-    }
-
-    /**
-     * Get the call stack attribute path, relative to an attribute found by the
-     * combination of {@link #getProcessesPattern()} and
-     * {@link #getThreadsPattern()}.
-     * <p>
-     * Override this method if the state system attributes do not match the
-     * default pattern defined by {@link CallStackStateProvider}.
-     *
-     * @return the relative path of the call stack attribute
-     */
-    public String[] getCallStackPath() {
-        return DEFAULT_CALL_STACK_PATH;
-    }
 }
This page took 0.028088 seconds and 5 git commands to generate.