tmf/ust: deprecate AbstractCallStackAnalysis and move the UST module to core
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Fri, 22 Jul 2016 13:58:13 +0000 (09:58 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Thu, 8 Sep 2016 21:53:00 +0000 (17:53 -0400)
The only reason the CallStackAnalysisModule were in the UI was to register the
view output to it. A listener now does that part so the class in the tmf.ui
plugin can be deprecated and LttngUstCallStackAnalysis can also be moved to
the .core plugin and be made internal while at it.

Change-Id: I80b4c34ff35855b5261a1270e67d10df865d6e0d
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/77781
Reviewed-by: Hudson CI
20 files changed:
lttng/org.eclipse.tracecompass.lttng2.ust.core.tests/src/org/eclipse/tracecompass/lttng2/ust/core/tests/callstack/LTTngUstCallStackAnalysisRequirementTest.java [new file with mode: 0644]
lttng/org.eclipse.tracecompass.lttng2.ust.core/plugin.properties
lttng/org.eclipse.tracecompass.lttng2.ust.core/plugin.xml
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/LttngUstCallStackAnalysis.java [new file with mode: 0644]
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/LttngUstCallStackAnalysisRequirement.java [new file with mode: 0644]
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/Messages.java [new file with mode: 0644]
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/messages.properties [new file with mode: 0644]
lttng/org.eclipse.tracecompass.lttng2.ust.ui.tests/META-INF/MANIFEST.MF
lttng/org.eclipse.tracecompass.lttng2.ust.ui.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/tests/analysis/callstack/LTTngUstCallStackAnalysisRequirementTest.java [deleted file]
lttng/org.eclipse.tracecompass.lttng2.ust.ui/META-INF/MANIFEST.MF
lttng/org.eclipse.tracecompass.lttng2.ust.ui/plugin.properties
lttng/org.eclipse.tracecompass.lttng2.ust.ui/plugin.xml
lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/LttngUstCallStackAnalysisRequirement.java [deleted file]
lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/Messages.java [deleted file]
lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/messages.properties [deleted file]
lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/lttng2/ust/ui/analysis/callstack/LttngUstCallStackAnalysis.java
tmf/org.eclipse.tracecompass.tmf.ui/plugin.xml
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/AbstractCallStackAnalysis.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackAnalysisListener.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java

diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core.tests/src/org/eclipse/tracecompass/lttng2/ust/core/tests/callstack/LTTngUstCallStackAnalysisRequirementTest.java b/lttng/org.eclipse.tracecompass.lttng2.ust.core.tests/src/org/eclipse/tracecompass/lttng2/ust/core/tests/callstack/LTTngUstCallStackAnalysisRequirementTest.java
new file mode 100644 (file)
index 0000000..edd870d
--- /dev/null
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * 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.lttng2.ust.core.tests.callstack;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.LttngUstCallStackAnalysisRequirement;
+import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace;
+import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventType;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Test the {@link LttngUstCallStackAnalysisRequirement} class
+ *
+ * @author Bernd Hufmann
+ */
+public class LTTngUstCallStackAnalysisRequirementTest {
+
+    private static final @NonNull String FUNC_EXIT_FAST = "lttng_ust_cyg_profile_fast:func_exit";
+    private static final @NonNull String FUNC_EXIT = "lttng_ust_cyg_profile:func_exit";
+    private static final @NonNull String FUNC_ENTRY_FAST = "lttng_ust_cyg_profile_fast:func_entry";
+    private static final @NonNull String FUNC_ENTRY = "lttng_ust_cyg_profile:func_entry";
+    private static final @NonNull String OTHER_EVENT = "OTHER";
+
+    private static final @NonNull String CONTEXT_VTID = "context._vtid";
+    private static final @NonNull String CONTEXT_PROCNAME = "context._procname";
+    private static final @NonNull String CONTEXT_OTHER = "context._other";
+
+    private static final @NonNull Collection<String> validFields = ImmutableSet.of(CONTEXT_VTID, CONTEXT_PROCNAME);
+    private static final @NonNull Collection<String> badFields = ImmutableSet.of(CONTEXT_OTHER, CONTEXT_PROCNAME);
+
+    enum EventType {
+        EVT_EXIT_FAST           (FUNC_EXIT_FAST, validFields),
+        EVT_EXIT                (FUNC_EXIT, validFields),
+        EVT_ENTRY_FAST          (FUNC_ENTRY_FAST, validFields),
+        EVT_ENTRY               (FUNC_ENTRY, validFields),
+        EVT_OTHER               (OTHER_EVENT, validFields),
+        EVT_ENTRY_BAD_FIELDS    (FUNC_ENTRY, badFields),
+        EVT_ENTRY_FAST_BAD_FIELDS     (FUNC_ENTRY_FAST, badFields),
+        EVT_ENTRY_FAST_EMPTY_FIELDS   (FUNC_ENTRY_FAST, ImmutableSet.of());
+
+        private final @NonNull CtfTmfEventType fType;
+
+        EventType(@NonNull String name, @NonNull Collection<String> fields) {
+            fType = new CtfTmfEventType(name, null) {
+                @Override
+                public String getName() {
+                    return name;
+                }
+                @Override
+                public @NonNull Collection<String> getFieldNames() {
+                    return fields;
+                }
+            };
+        }
+
+        @NonNull CtfTmfEventType getEventType() {
+            return fType;
+        }
+    }
+
+    enum TestData {
+        TRACE_WITH_VALID_EVENTS(EventType.EVT_ENTRY, EventType.EVT_EXIT, true),
+        TRACE_WITH_VALID_EVENTS_FAST(EventType.EVT_ENTRY_FAST, EventType.EVT_EXIT_FAST, true),
+        TRACE_WITH_VALID_EVENTS_MISSING_FIELDS(EventType.EVT_ENTRY_BAD_FIELDS,
+                EventType.EVT_EXIT, false),
+        TRACE_WITH_VALID_EVENTS_MISSING_FIELDS_FAST(EventType.EVT_ENTRY_FAST_BAD_FIELDS,
+                    EventType.EVT_EXIT_FAST, false),
+        TRACE_WITH_VALID_EVENTS_WRONG_FIELDS(EventType.EVT_ENTRY_FAST_EMPTY_FIELDS,
+                EventType.EVT_EXIT_FAST, false),
+        TRACE_WITH_MISSING_EVENTS(EventType.EVT_OTHER,
+                    EventType.EVT_EXIT_FAST, false),
+        TRACE_MISMATCH_EVENTS(EventType.EVT_ENTRY_FAST, EventType.EVT_EXIT, false);
+
+        private final @NonNull LttngUstTrace fTrace;
+        private final boolean fIsValid;
+
+        TestData(EventType first, EventType second, boolean isValid) {
+            fTrace = new LttngUstTrace() {
+                @Override
+                public Set<CtfTmfEventType> getContainedEventTypes() {
+                    return ImmutableSet.of(first.getEventType(), second.getEventType());
+                }
+            };
+            fIsValid = isValid;
+        }
+
+        @NonNull LttngUstTrace getTrace() {
+            return fTrace;
+        }
+
+        boolean isValid() {
+            return fIsValid;
+        }
+
+    }
+
+    /**
+     * Test Call Stack Analysis requirements
+     */
+    @Test
+    public void testCallStackRequirements() {
+        LttngUstCallStackAnalysisRequirement req = new LttngUstCallStackAnalysisRequirement(ILttngUstEventLayout.DEFAULT_LAYOUT);
+        for (TestData item: TestData.values()) {
+            assertEquals(item.name(), item.isValid(), req.test(item.getTrace()));
+        }
+    }
+}
index db7013a86293de37d6665c42a9149d9191879332..06821166ac1ef1b521b181ed47a60f73500c7eea 100644 (file)
@@ -14,3 +14,5 @@ Bundle-Vendor = Eclipse Trace Compass
 Bundle-Name = Trace Compass LTTng Userspace Tracer Analysis Core Plug-in
 
 tracetype.type.ust = LTTng UST Trace
+
+analysis.callstack = LTTng-UST CallStack
index f11891a8f8b423a9bdb162a347a5267dc9850bce..69df9279f1ed7e5ebe23031060ef6767dcd2002c 100644 (file)
                class="org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace">
          </tracetype>
       </module>
+      <module
+            analysis_module="org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.LttngUstCallStackAnalysis"
+            automatic="false"
+            id="org.eclipse.linuxtools.lttng2.ust.analysis.callstack"
+            name="%analysis.callstack">
+         <tracetype
+               applies="true"
+               class="org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace">
+         </tracetype>
+      </module>
    </extension>
 </plugin>
diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/LttngUstCallStackAnalysis.java b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/LttngUstCallStackAnalysis.java
new file mode 100644 (file)
index 0000000..d9ac6e2
--- /dev/null
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 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.lttng2.ust.core.callstack;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.util.Set;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace;
+import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout;
+import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement;
+import org.eclipse.tracecompass.tmf.core.callstack.CallStackAnalysis;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
+import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Call-stack analysis to populate the TMF CallStack View from UST cyg-profile
+ * events.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class LttngUstCallStackAnalysis extends CallStackAnalysis {
+
+    /**
+     * ID
+     */
+    public static final String ID = "org.eclipse.linuxtools.lttng2.ust.analysis.callstack"; //$NON-NLS-1$
+
+    private @Nullable Set<@NonNull TmfAbstractAnalysisRequirement> fAnalysisRequirements = null;
+
+    @Override
+    public boolean setTrace(ITmfTrace trace) throws TmfAnalysisException {
+        if (!(trace instanceof LttngUstTrace)) {
+            return false;
+        }
+        return super.setTrace(trace);
+    }
+
+    @Override
+    protected LttngUstTrace getTrace() {
+        return (LttngUstTrace) super.getTrace();
+    }
+
+    @Override
+    protected ITmfStateProvider createStateProvider() {
+        return new LttngUstCallStackProvider(checkNotNull(getTrace()));
+    }
+
+    @Override
+    public @NonNull Iterable<@NonNull TmfAbstractAnalysisRequirement> getAnalysisRequirements() {
+
+        Set<@NonNull TmfAbstractAnalysisRequirement> requirements = fAnalysisRequirements;
+        if (requirements == null) {
+            LttngUstTrace trace = getTrace();
+            ILttngUstEventLayout layout = ILttngUstEventLayout.DEFAULT_LAYOUT;
+            if (trace != null) {
+                layout = trace.getEventLayout();
+            }
+            requirements = ImmutableSet.of(new LttngUstCallStackAnalysisRequirement(layout));
+            fAnalysisRequirements = requirements;
+        }
+        return requirements;
+    }
+
+}
diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/LttngUstCallStackAnalysisRequirement.java b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/LttngUstCallStackAnalysisRequirement.java
new file mode 100644 (file)
index 0000000..771e707
--- /dev/null
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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.lttng2.ust.core.callstack;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout;
+import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement;
+import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventFieldRequirement;
+import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfCompositeAnalysisRequirement;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Analysis requirement implementation for LTTng Call Stack Analysis.
+ *
+ * @author Bernd Hufmann
+ *
+ */
+@NonNullByDefault
+public class LttngUstCallStackAnalysisRequirement extends TmfCompositeAnalysisRequirement {
+
+    /**
+     * Constructor
+     *
+     * @param layout
+     *            The event layout (non-null)
+     */
+    public LttngUstCallStackAnalysisRequirement(ILttngUstEventLayout layout) {
+        super(getSubRequirements(layout), PriorityLevel.AT_LEAST_ONE);
+
+        addInformation(nullToEmptyString(Messages.LttnUstCallStackAnalysisModule_EventsLoadingInformation));
+    }
+
+    private static Collection<TmfAbstractAnalysisRequirement> getSubRequirements(ILttngUstEventLayout layout) {
+        Set<@NonNull String> requiredEventsFields = ImmutableSet.of(
+                layout.contextProcname(),
+                layout.contextVtid());
+
+        // Requirement for the cyg_profile events
+        TmfAnalysisEventFieldRequirement entryReq = new TmfAnalysisEventFieldRequirement(
+                layout.eventCygProfileFuncEntry(),
+                requiredEventsFields,
+                PriorityLevel.MANDATORY);
+
+        TmfAbstractAnalysisRequirement exitReq = new TmfAnalysisEventFieldRequirement(
+                layout.eventCygProfileFuncExit(),
+                requiredEventsFields,
+                PriorityLevel.MANDATORY);
+
+        TmfAbstractAnalysisRequirement cygProfile = new TmfCompositeAnalysisRequirement(ImmutableSet.of(entryReq, exitReq), PriorityLevel.MANDATORY);
+
+        // Requirement for the cyg_profile_fast events
+        entryReq = new TmfAnalysisEventFieldRequirement(
+                layout.eventCygProfileFastFuncEntry(),
+                requiredEventsFields,
+                PriorityLevel.MANDATORY);
+
+        exitReq = new TmfAnalysisEventFieldRequirement(
+                layout.eventCygProfileFastFuncExit(),
+                requiredEventsFields,
+                PriorityLevel.MANDATORY);
+        TmfAbstractAnalysisRequirement cygProfileFast = new TmfCompositeAnalysisRequirement(ImmutableSet.of(entryReq, exitReq), PriorityLevel.MANDATORY);
+
+        return ImmutableSet.of(cygProfile, cygProfileFast);
+    }
+
+}
diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/Messages.java b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/Messages.java
new file mode 100644 (file)
index 0000000..32bf7ef
--- /dev/null
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.lttng2.ust.core.callstack;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Message bundle for the call stack analysis module
+ *
+ * @author Sonia Farrah
+ */
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = Messages.class.getPackage().getName() + ".messages"; //$NON-NLS-1$
+
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    /** Information regarding events loading prior to the analysis execution */
+    public static String LttnUstCallStackAnalysisModule_EventsLoadingInformation;
+
+    private Messages() {
+    }
+}
diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/messages.properties b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/messages.properties
new file mode 100644 (file)
index 0000000..8adbf02
--- /dev/null
@@ -0,0 +1,14 @@
+###############################################################################
+# 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
+#
+# Contributors:
+#     Ericsson - Initial API and implementation
+###############################################################################
+LttnUstCallStackAnalysisModule_EventsLoadingInformation=Add the ''vtid'' and ''procname'' contexts to your trace session. \n\
+Preload the ''liblttng-ust-cyg-profile'' library when running your program: \n\
+LD_PRELOAD=/usr/lib/liblttng-ust-cyg-profile.so ./myprogram
index 9bbd1eb8ceabd05a8d4ee214da0d2b7e7b42110b..5dbe3eef695e1a1b6b458a6b7a9b8450a49072ee 100644 (file)
@@ -16,8 +16,7 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.tracecompass.tmf.core.tests,
  org.eclipse.tracecompass.lttng2.ust.core;bundle-version="2.0.0",
  org.eclipse.tracecompass.tmf.ctf.core;bundle-version="2.0.0"
-Export-Package: org.eclipse.tracecompass.lttng2.ust.ui.tests,
- org.eclipse.tracecompass.lttng2.ust.ui.tests.analysis.callstack
+Export-Package: org.eclipse.tracecompass.lttng2.ust.ui.tests
 Import-Package: com.google.common.collect,
  com.google.common.primitives
 
diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.ui.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/tests/analysis/callstack/LTTngUstCallStackAnalysisRequirementTest.java b/lttng/org.eclipse.tracecompass.lttng2.ust.ui.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/tests/analysis/callstack/LTTngUstCallStackAnalysisRequirementTest.java
deleted file mode 100644 (file)
index c423c96..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * 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.lttng2.ust.ui.tests.analysis.callstack;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Collection;
-import java.util.Set;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.internal.lttng2.ust.ui.analysis.callstack.LttngUstCallStackAnalysisRequirement;
-import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace;
-import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventType;
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Test the {@link LttngUstCallStackAnalysisRequirement} class
- *
- * @author Bernd Hufmann
- */
-public class LTTngUstCallStackAnalysisRequirementTest {
-
-    private static final @NonNull String FUNC_EXIT_FAST = "lttng_ust_cyg_profile_fast:func_exit";
-    private static final @NonNull String FUNC_EXIT = "lttng_ust_cyg_profile:func_exit";
-    private static final @NonNull String FUNC_ENTRY_FAST = "lttng_ust_cyg_profile_fast:func_entry";
-    private static final @NonNull String FUNC_ENTRY = "lttng_ust_cyg_profile:func_entry";
-    private static final @NonNull String OTHER_EVENT = "OTHER";
-
-    private static final @NonNull String CONTEXT_VTID = "context._vtid";
-    private static final @NonNull String CONTEXT_PROCNAME = "context._procname";
-    private static final @NonNull String CONTEXT_OTHER = "context._other";
-
-    private static final @NonNull Collection<String> validFields = ImmutableSet.of(CONTEXT_VTID, CONTEXT_PROCNAME);
-    private static final @NonNull Collection<String> badFields = ImmutableSet.of(CONTEXT_OTHER, CONTEXT_PROCNAME);
-
-    enum EventType {
-        EVT_EXIT_FAST           (FUNC_EXIT_FAST, validFields),
-        EVT_EXIT                (FUNC_EXIT, validFields),
-        EVT_ENTRY_FAST          (FUNC_ENTRY_FAST, validFields),
-        EVT_ENTRY               (FUNC_ENTRY, validFields),
-        EVT_OTHER               (OTHER_EVENT, validFields),
-        EVT_ENTRY_BAD_FIELDS    (FUNC_ENTRY, badFields),
-        EVT_ENTRY_FAST_BAD_FIELDS     (FUNC_ENTRY_FAST, badFields),
-        EVT_ENTRY_FAST_EMPTY_FIELDS   (FUNC_ENTRY_FAST, ImmutableSet.of());
-
-        private final @NonNull CtfTmfEventType fType;
-
-        EventType(@NonNull String name, @NonNull Collection<String> fields) {
-            fType = new CtfTmfEventType(name, null) {
-                @Override
-                public String getName() {
-                    return name;
-                }
-                @Override
-                public @NonNull Collection<String> getFieldNames() {
-                    return fields;
-                }
-            };
-        }
-
-        @NonNull CtfTmfEventType getEventType() {
-            return fType;
-        }
-    }
-
-    enum TestData {
-        TRACE_WITH_VALID_EVENTS(EventType.EVT_ENTRY, EventType.EVT_EXIT, true),
-        TRACE_WITH_VALID_EVENTS_FAST(EventType.EVT_ENTRY_FAST, EventType.EVT_EXIT_FAST, true),
-        TRACE_WITH_VALID_EVENTS_MISSING_FIELDS(EventType.EVT_ENTRY_BAD_FIELDS,
-                EventType.EVT_EXIT, false),
-        TRACE_WITH_VALID_EVENTS_MISSING_FIELDS_FAST(EventType.EVT_ENTRY_FAST_BAD_FIELDS,
-                    EventType.EVT_EXIT_FAST, false),
-        TRACE_WITH_VALID_EVENTS_WRONG_FIELDS(EventType.EVT_ENTRY_FAST_EMPTY_FIELDS,
-                EventType.EVT_EXIT_FAST, false),
-        TRACE_WITH_MISSING_EVENTS(EventType.EVT_OTHER,
-                    EventType.EVT_EXIT_FAST, false),
-        TRACE_MISMATCH_EVENTS(EventType.EVT_ENTRY_FAST, EventType.EVT_EXIT, false);
-
-        private final @NonNull LttngUstTrace fTrace;
-        private final boolean fIsValid;
-
-        TestData(EventType first, EventType second, boolean isValid) {
-            fTrace = new LttngUstTrace() {
-                @Override
-                public Set<CtfTmfEventType> getContainedEventTypes() {
-                    return ImmutableSet.of(first.getEventType(), second.getEventType());
-                }
-            };
-            fIsValid = isValid;
-        }
-
-        @NonNull LttngUstTrace getTrace() {
-            return fTrace;
-        }
-
-        boolean isValid() {
-            return fIsValid;
-        }
-
-    }
-
-    /**
-     * Test Call Stack Analysis requirements
-     */
-    @Test
-    public void testCallStackRequirements() {
-        LttngUstCallStackAnalysisRequirement req = new LttngUstCallStackAnalysisRequirement(ILttngUstEventLayout.DEFAULT_LAYOUT);
-        for (TestData item: TestData.values()) {
-            assertEquals(item.name(), item.isValid(), req.test(item.getTrace()));
-        }
-    }
-}
index 465ae5ded0ac7c3c26f9e624ca469a5d815b1584..f60e2b3fdc82f0f16cc7a14c11fc7472bdc0f981 100644 (file)
@@ -17,7 +17,6 @@ Require-Bundle: org.eclipse.core.resources,
  org.eclipse.tracecompass.tmf.ui,
  org.eclipse.tracecompass.tmf.ctf.core
 Export-Package: org.eclipse.tracecompass.internal.lttng2.ust.ui;x-friends:="org.eclipse.tracecompass.lttng2.ust.ui.tests",
- org.eclipse.tracecompass.internal.lttng2.ust.ui.analysis.callstack;x-friends:="org.eclipse.tracecompass.lttng2.ust.ui.tests",
  org.eclipse.tracecompass.internal.lttng2.ust.ui.analysis.debuginfo;x-internal:=true,
  org.eclipse.tracecompass.internal.lttng2.ust.ui.views.memusage;x-friends:="org.eclipse.tracecompass.lttng2.ust.ui.tests,org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests",
  org.eclipse.tracecompass.lttng2.ust.ui.analysis.callstack
index 29cfacc0a0ca50118ed84e89dea8685bd4182ce8..b56b61c8e7f7128843fc1e4aa9581ee5d3e1f826 100644 (file)
@@ -15,5 +15,3 @@ Bundle-Name = Trace Compass LTTng Userspace Tracer Analysis UI Plug-in
 
 tracetype.type.ust = LTTng UST Trace
 memoryusage.view.name = UST Memory Usage
-
-analysis.callstack = LTTng-UST CallStack
index 801eb4b559df1cbdbe7f20694466416f080ac8eb..130807c2af8561c705794559ac343deffe14816e 100644 (file)
    </extension>
    <extension
          point="org.eclipse.linuxtools.tmf.core.analysis">
-      <module
-            analysis_module="org.eclipse.tracecompass.lttng2.ust.ui.analysis.callstack.LttngUstCallStackAnalysis"
-            automatic="false"
-            id="org.eclipse.linuxtools.lttng2.ust.analysis.callstack"
-            name="%analysis.callstack">
-         <tracetype
-               applies="true"
-               class="org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace">
-         </tracetype>
-      </module>
       <output
             class="org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput"
             id="org.eclipse.linuxtools.lttng2.ust.memoryusage">
diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/LttngUstCallStackAnalysisRequirement.java b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/LttngUstCallStackAnalysisRequirement.java
deleted file mode 100644 (file)
index 9af91a6..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * 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.lttng2.ust.ui.analysis.callstack;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
-
-import java.util.Collection;
-import java.util.Set;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout;
-import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement;
-import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventFieldRequirement;
-import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfCompositeAnalysisRequirement;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Analysis requirement implementation for LTTng Call Stack Analysis.
- *
- * @author Bernd Hufmann
- *
- */
-@NonNullByDefault
-public class LttngUstCallStackAnalysisRequirement extends TmfCompositeAnalysisRequirement {
-
-    /**
-     * Constructor
-     *
-     * @param layout
-     *            The event layout (non-null)
-     */
-    public LttngUstCallStackAnalysisRequirement(ILttngUstEventLayout layout) {
-        super(getSubRequirements(layout), PriorityLevel.AT_LEAST_ONE);
-
-        addInformation(nullToEmptyString(Messages.LttnUstCallStackAnalysisModule_EventsLoadingInformation));
-    }
-
-    private static Collection<TmfAbstractAnalysisRequirement> getSubRequirements(ILttngUstEventLayout layout) {
-        Set<@NonNull String> requiredEventsFields = ImmutableSet.of(
-                layout.contextProcname(),
-                layout.contextVtid());
-
-        // Requirement for the cyg_profile events
-        TmfAnalysisEventFieldRequirement entryReq = new TmfAnalysisEventFieldRequirement(
-                layout.eventCygProfileFuncEntry(),
-                requiredEventsFields,
-                PriorityLevel.MANDATORY);
-
-        TmfAbstractAnalysisRequirement exitReq = new TmfAnalysisEventFieldRequirement(
-                layout.eventCygProfileFuncExit(),
-                requiredEventsFields,
-                PriorityLevel.MANDATORY);
-
-        TmfAbstractAnalysisRequirement cygProfile = new TmfCompositeAnalysisRequirement(ImmutableSet.of(entryReq, exitReq), PriorityLevel.MANDATORY);
-
-        // Requirement for the cyg_profile_fast events
-        entryReq = new TmfAnalysisEventFieldRequirement(
-                layout.eventCygProfileFastFuncEntry(),
-                requiredEventsFields,
-                PriorityLevel.MANDATORY);
-
-        exitReq = new TmfAnalysisEventFieldRequirement(
-                layout.eventCygProfileFastFuncExit(),
-                requiredEventsFields,
-                PriorityLevel.MANDATORY);
-        TmfAbstractAnalysisRequirement cygProfileFast = new TmfCompositeAnalysisRequirement(ImmutableSet.of(entryReq, exitReq), PriorityLevel.MANDATORY);
-
-        return ImmutableSet.of(cygProfile, cygProfileFast);
-    }
-
-}
diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/Messages.java b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/Messages.java
deleted file mode 100644 (file)
index 2ce8d1c..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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.lttng2.ust.ui.analysis.callstack;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Message bundle for the call stack analysis module
- *
- * @author Sonia Farrah
- */
-
-public class Messages extends NLS {
-    private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.lttng2.ust.ui.analysis.callstack.messages"; //$NON-NLS-1$
-
-    static {
-        // initialize resource bundle
-        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-    }
-
-    /** Information regarding events loading prior to the analysis execution */
-    public static String LttnUstCallStackAnalysisModule_EventsLoadingInformation;
-
-    private Messages() {
-    }
-}
diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/messages.properties b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/messages.properties
deleted file mode 100644 (file)
index 8adbf02..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# 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
-#
-# Contributors:
-#     Ericsson - Initial API and implementation
-###############################################################################
-LttnUstCallStackAnalysisModule_EventsLoadingInformation=Add the ''vtid'' and ''procname'' contexts to your trace session. \n\
-Preload the ''liblttng-ust-cyg-profile'' library when running your program: \n\
-LD_PRELOAD=/usr/lib/liblttng-ust-cyg-profile.so ./myprogram
index a8e0d6d3c34857ebcb8bb4ce53c1f30d66072a7e..a14431da2378c1abb5ea2d16b547421ea8c88217 100644 (file)
@@ -19,8 +19,8 @@ import java.util.Set;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.LttngUstCallStackAnalysisRequirement;
 import org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.LttngUstCallStackProvider;
-import org.eclipse.tracecompass.internal.lttng2.ust.ui.analysis.callstack.LttngUstCallStackAnalysisRequirement;
 import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace;
 import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout;
 import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement;
@@ -36,7 +36,11 @@ import com.google.common.collect.ImmutableSet;
  * events.
  *
  * @author Alexandre Montplaisir
+ * @deprecated This analysis was moved to core as
+ *             {@link org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.LttngUstCallStackAnalysis}
+ *             and is now internal
  */
+@Deprecated
 public class LttngUstCallStackAnalysis extends AbstractCallStackAnalysis {
 
     /**
index fe60b8acbad858973883fb9a513e5a10bc2fa909..c32715d9d88d8775f56a80fdb7653612850016aa 100644 (file)
                id="org.eclipse.linuxtools.tmf.core.statistics.analysis">
             </analysisId>
       </output>
+      <listener
+            class="org.eclipse.tracecompass.tmf.ui.views.callstack.CallStackAnalysisListener">
+      </listener>
    </extension>
    <extension
          point="org.eclipse.linuxtools.tmf.ui.tracetypeui">
index 6c39a1f438a32355b880095247fe241b396002b9..665162d7d2be84dcab12472e10684c4f85c1d4aa 100644 (file)
@@ -21,11 +21,10 @@ import org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput;
  * The base classes for analyses who want to populate the CallStack View.
  *
  * @author Alexandre Montplaisir
+ * @deprecated Use the {@link CallStackAnalysis} from the core plugins instead
+ *             of this class which was there only to register the view as output
  */
-/*
- * FIXME: deprecate at next release when we can move the callstack view to an
- * extension point
- */
+@Deprecated
 @NonNullByDefault
 public abstract class AbstractCallStackAnalysis extends CallStackAnalysis {
 
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackAnalysisListener.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackAnalysisListener.java
new file mode 100644 (file)
index 0000000..97e49e2
--- /dev/null
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.tmf.ui.views.callstack;
+
+import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
+import org.eclipse.tracecompass.tmf.core.analysis.ITmfNewAnalysisModuleListener;
+import org.eclipse.tracecompass.tmf.core.callstack.CallStackAnalysis;
+import org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput;
+
+/**
+ * Registers the {@link CallStackView} to {@link CallStackAnalysis}. The
+ * analysis being an abstract class, it is not possible to use the output
+ * extension to add the view, but the listener fixes the issue.
+ *
+ * @author Geneviève Bastien
+ * @since 2.1
+ */
+public class CallStackAnalysisListener implements ITmfNewAnalysisModuleListener {
+
+    @Override
+    public void moduleCreated(IAnalysisModule module) {
+        if (module instanceof CallStackAnalysis) {
+            module.registerOutput(new TmfAnalysisViewOutput(CallStackView.ID));
+        }
+    }
+
+}
index 32d68196c5ce78bc4b7f5a17b914f9769a723ce4..6b2aa2484a89a786aad28a5e3707d938c9c9da55 100644 (file)
@@ -59,6 +59,7 @@ import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue.Type;
+import org.eclipse.tracecompass.tmf.core.callstack.CallStackAnalysis;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal;
@@ -541,7 +542,7 @@ public class CallStackView extends AbstractTimeGraphView {
         }
 
         /* Continue with the call stack view specific operations */
-        AbstractCallStackAnalysis module = getCallStackModule(trace);
+        CallStackAnalysis module = getCallStackModule(trace);
         if (module == null) {
             addUnavailableEntry(trace, parentTrace);
             return;
@@ -1057,14 +1058,14 @@ public class CallStackView extends AbstractTimeGraphView {
         return fPrevEventAction;
     }
 
-    private static @Nullable AbstractCallStackAnalysis getCallStackModule(@NonNull ITmfTrace trace) {
+    private static @Nullable CallStackAnalysis getCallStackModule(@NonNull ITmfTrace trace) {
         /*
          * Since we cannot know the exact analysis ID (in separate plugins), we
          * will search using the analysis type.
          */
-        Iterable<AbstractCallStackAnalysis> modules =
-                TmfTraceUtils.getAnalysisModulesOfClass(trace, AbstractCallStackAnalysis.class);
-        Iterator<AbstractCallStackAnalysis> it = modules.iterator();
+        Iterable<CallStackAnalysis> modules =
+                TmfTraceUtils.getAnalysisModulesOfClass(trace, CallStackAnalysis.class);
+        Iterator<CallStackAnalysis> it = modules.iterator();
         if (!it.hasNext()) {
             /* This trace does not provide a call-stack analysis */
             return null;
@@ -1076,7 +1077,7 @@ public class CallStackView extends AbstractTimeGraphView {
          * TODO Handle the advanced case where one trace provides more than one
          * call-stack analysis.
          */
-        AbstractCallStackAnalysis module = it.next();
+        CallStackAnalysis module = it.next();
         /* This analysis is not automatic, we need to schedule it on-demand */
         module.schedule();
         if (!module.waitForInitialization()) {
This page took 0.039335 seconds and 5 git commands to generate.