lttng: Add analysis requirements for LTTng UST Call Stack analysis
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Fri, 11 Mar 2016 18:31:07 +0000 (13:31 -0500)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Tue, 19 Apr 2016 14:40:38 +0000 (10:40 -0400)
With this the user gets notified when the call stack analysis cannot be
executed. The help text will give some details about this.

Change-Id: Ib3628606a74ae5e83b60fde81720f7035d7eae86
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/68235
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java
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 [new file with mode: 0644]
lttng/org.eclipse.tracecompass.lttng2.ust.ui/META-INF/MANIFEST.MF
lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/LttngUstCallStackAnalysisRequirement.java [new file with mode: 0644]
lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/Messages.java [new file with mode: 0644]
lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/messages.properties [new file with mode: 0644]
lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/lttng2/ust/ui/analysis/callstack/LttngUstCallStackAnalysis.java

index 57c02e39490df384f4e1763b6b62b370045c253f..03bb239088d7f135f56f17db56b8379b9be9d78f 100644 (file)
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -204,16 +205,32 @@ public class CtfTmfTrace extends TmfTrace
              * register a trace to that type in the TmfEventTypeManager
              */
             try (CtfIterator iter = fIteratorManager.getIterator(ctx)) {
+                Set<@NonNull ITmfEventField> streamContextNames = new HashSet<>();
                 for (IEventDeclaration ied : iter.getEventDeclarations()) {
                     CtfTmfEventType ctfTmfEventType = fContainedEventTypes.get(ied.getName());
                     if (ctfTmfEventType == null) {
                         List<ITmfEventField> content = new ArrayList<>();
+
                         /* Should only return null the first time */
                         final StructDeclaration fields = ied.getFields();
                         if (fields != null) {
                             for (String fieldName : fields.getFieldsList()) {
                                 content.add(new TmfEventField(checkNotNull(fieldName), null, null));
                             }
+                        }
+
+                        /* Add stream contexts */
+                        final StructDeclaration streamContexts = ied.getStream().getEventContextDecl();
+                        if (streamContextNames.isEmpty()) {
+                            if (streamContexts != null) {
+                                for (String fieldName : streamContexts.getFieldsList()) {
+                                    streamContextNames.add(new TmfEventField(checkNotNull(CtfConstants.CONTEXT_FIELD_PREFIX + fieldName), null, null));
+                                }
+                            }
+                        }
+                        content.addAll(streamContextNames);
+
+                        if (!content.isEmpty()) {
                             ITmfEventField contentTree = new TmfEventField(
                                     ITmfEventField.ROOT_FIELD_ID,
                                     null,
index 197f98312bce084cdf20b45183d15da047d093a5..5dbe3eef695e1a1b6b458a6b7a9b8450a49072ee 100644 (file)
@@ -11,5 +11,12 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.ui,
  org.eclipse.core.resources,
  org.eclipse.core.runtime,
- org.eclipse.tracecompass.lttng2.ust.ui
+ org.eclipse.tracecompass.lttng2.ust.ui,
+ org.eclipse.tracecompass.tmf.core;bundle-version="2.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
+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
new file mode 100644 (file)
index 0000000..7d59f66
--- /dev/null
@@ -0,0 +1,319 @@
+/*******************************************************************************
+ * 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.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+import java.util.Collections;
+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.core.event.ITmfEventField;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
+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";
+
+    /* A trace class with pre-defined events with valid events and fields */
+    private static class TraceWithValidEvents extends LttngUstTrace {
+        @Override
+        public @NonNull Set<@NonNull CtfTmfEventType> getContainedEventTypes() {
+            return ImmutableSet.of(
+                    new CtfTmfEventType(FUNC_ENTRY, null) {
+
+                        @Override
+                        public @NonNull String getName() {
+                            return FUNC_ENTRY;
+                        }
+
+                        @Override
+                        public ITmfEventField getRootField() {
+                            return null;
+                        }
+
+                        @Override
+                        public Collection<String> getFieldNames() {
+                            return ImmutableSet.of(CONTEXT_VTID, CONTEXT_PROCNAME);
+                        }
+                    },
+                    new CtfTmfEventType(FUNC_EXIT, null) {
+                        @Override
+                        public @NonNull String getName() {
+                            return FUNC_EXIT;
+                        }
+
+                        @Override
+                        public ITmfEventField getRootField() {
+                            return null;
+                        }
+
+                        @Override
+                        public Collection<String> getFieldNames() {
+                            return ImmutableSet.of(CONTEXT_VTID, CONTEXT_PROCNAME);
+                        }
+                    });
+        }
+    }
+
+    /* A trace class with pre-defined events with valid events and fields */
+    private static class TraceWithValidEventsFast extends LttngUstTrace {
+        @Override
+        public @NonNull Set<@NonNull CtfTmfEventType> getContainedEventTypes() {
+            return ImmutableSet.of(
+                    new CtfTmfEventType(FUNC_ENTRY_FAST, null) {
+
+                        @Override
+                        public @NonNull String getName() {
+                            return FUNC_ENTRY_FAST;
+                        }
+
+                        @Override
+                        public ITmfEventField getRootField() {
+                            return null;
+                        }
+
+                        @Override
+                        public Collection<String> getFieldNames() {
+                            return ImmutableSet.of(CONTEXT_VTID, CONTEXT_PROCNAME);
+                        }
+                    },
+                    new CtfTmfEventType(FUNC_EXIT_FAST, null) {
+                        @Override
+                        public @NonNull String getName() {
+                            return FUNC_EXIT_FAST;
+                        }
+
+                        @Override
+                        public ITmfEventField getRootField() {
+                            return null;
+                        }
+
+                        @Override
+                        public Collection<String> getFieldNames() {
+                            return ImmutableSet.of(CONTEXT_VTID, CONTEXT_PROCNAME);
+                        }
+                    });
+        }
+    }
+
+    /*
+     * A trace class with pre-defined events with valid events but missing
+     * fields
+     */
+    private static class TraceWithValidEventsMissingFields extends LttngUstTrace {
+        @Override
+        public @NonNull Set<@NonNull CtfTmfEventType> getContainedEventTypes() {
+            return ImmutableSet.of(
+                    new CtfTmfEventType(FUNC_ENTRY, null) {
+                        @Override
+                        public @NonNull String getName() {
+                            return FUNC_ENTRY;
+                        }
+
+                        @Override
+                        public ITmfEventField getRootField() {
+                            return null;
+                        }
+
+                        @Override
+                        public Collection<String> getFieldNames() {
+                            return Collections.EMPTY_LIST;
+                        }
+                    },
+                    new CtfTmfEventType(FUNC_EXIT, null) {
+                        @Override
+                        public @NonNull String getName() {
+                            return FUNC_EXIT;
+                        }
+
+                        @Override
+                        public ITmfEventField getRootField() {
+                            return null;
+                        }
+
+                        @Override
+                        public Collection<String> getFieldNames() {
+                            return ImmutableSet.of(CONTEXT_VTID, CONTEXT_PROCNAME);
+                        }
+                    });
+        }
+    }
+
+    /*
+     * A trace class with pre-defined events with valid events but missing
+     * fields
+     */
+    private static class TraceWithValidEventsMissingFieldsFast extends LttngUstTrace {
+        @Override
+        public @NonNull Set<@NonNull CtfTmfEventType> getContainedEventTypes() {
+            return ImmutableSet.of(
+                    new CtfTmfEventType(FUNC_ENTRY_FAST, null) {
+                        @Override
+                        public @NonNull String getName() {
+                            return FUNC_ENTRY_FAST;
+                        }
+
+                        @Override
+                        public ITmfEventField getRootField() {
+                            return null;
+                        }
+
+                        @Override
+                        public Collection<String> getFieldNames() {
+                            return ImmutableSet.of(CONTEXT_VTID, CONTEXT_PROCNAME);
+                        }
+                    },
+                    new CtfTmfEventType(FUNC_EXIT_FAST, null) {
+                        @Override
+                        public @NonNull String getName() {
+                            return FUNC_EXIT_FAST;
+                        }
+
+                        @Override
+                        public ITmfEventField getRootField() {
+                            return null;
+                        }
+
+                        @Override
+                        public Collection<String> getFieldNames() {
+                            return Collections.EMPTY_LIST;
+                        }
+                    });
+        }
+    }
+
+    /*
+     * A trace class with pre-defined events with valid events but missing
+     * fields and other fields
+     */
+    private static class TraceWithValidEventsWrongFields extends LttngUstTrace {
+        @Override
+        public @NonNull Set<@NonNull CtfTmfEventType> getContainedEventTypes() {
+            return ImmutableSet.of(
+                    new CtfTmfEventType(FUNC_ENTRY, null) {
+                        @Override
+                        public @NonNull String getName() {
+                            return FUNC_ENTRY;
+                        }
+
+                        @Override
+                        public ITmfEventField getRootField() {
+                            return null;
+                        }
+
+                        @Override
+                        public Collection<String> getFieldNames() {
+                            return ImmutableSet.of(CONTEXT_OTHER, CONTEXT_PROCNAME);
+                        }
+                    },
+                    new CtfTmfEventType(FUNC_EXIT, null) {
+                        @Override
+                        public @NonNull String getName() {
+                            return FUNC_EXIT;
+                        }
+
+                        @Override
+                        public ITmfEventField getRootField() {
+                            return null;
+                        }
+
+                        @Override
+                        public Collection<String> getFieldNames() {
+                            return ImmutableSet.of(CONTEXT_OTHER, CONTEXT_PROCNAME);
+                        }
+                    });
+        }
+    }
+
+    /* A trace class with pre-defined events with missing events */
+    private static class TraceWithMissingEvents extends LttngUstTrace {
+        @Override
+        public @NonNull Set<@NonNull CtfTmfEventType> getContainedEventTypes() {
+            return ImmutableSet.of(
+                    new CtfTmfEventType(OTHER_EVENT, null) {
+                        @Override
+                        public @NonNull String getName() {
+                            return OTHER_EVENT;
+                        }
+
+                        @Override
+                        public ITmfEventField getRootField() {
+                            return null;
+                        }
+
+                        @Override
+                        public Collection<String> getFieldNames() {
+                            return ImmutableSet.of(CONTEXT_VTID, CONTEXT_PROCNAME);
+                        }
+                    },
+                    new CtfTmfEventType(FUNC_EXIT_FAST, null) {
+                        @Override
+                        public @NonNull String getName() {
+                            return FUNC_EXIT_FAST;
+                        }
+
+                        @Override
+                        public ITmfEventField getRootField() {
+                            return null;
+                        }
+
+                        @Override
+                        public Collection<String> getFieldNames() {
+                            return ImmutableSet.of(CONTEXT_VTID, CONTEXT_PROCNAME);
+                        }
+                    });
+        }
+    }
+
+    private final @NonNull TmfTrace traceValid = new TraceWithValidEvents();
+    private final @NonNull TmfTrace traceValidFast = new TraceWithValidEventsFast();
+    private final @NonNull TmfTrace traceValidMissingFields = new TraceWithValidEventsMissingFields();
+    private final @NonNull TmfTrace traceValidMissingFiledsFast = new TraceWithValidEventsMissingFieldsFast();
+    private final @NonNull TmfTrace traceValidEventsWrongFields = new TraceWithValidEventsWrongFields();
+    private final @NonNull TmfTrace traceMissingEvents = new TraceWithMissingEvents();
+
+    /**
+     * Test with optional requirements
+     */
+    @Test
+    public void testCallStackRequirements() {
+        /* Test optional requirement */
+        LttngUstCallStackAnalysisRequirement req = new LttngUstCallStackAnalysisRequirement(ILttngUstEventLayout.DEFAULT_LAYOUT);
+        assertTrue(req.test(traceValid));
+        assertTrue(req.test(traceValidFast));
+        assertFalse(req.test(traceValidMissingFields));
+        assertFalse(req.test(traceValidMissingFiledsFast));
+        assertFalse(req.test(traceValidEventsWrongFields));
+        assertFalse(req.test(traceMissingEvents));
+    }
+}
index 26c2a70ccbe3d65b0cee9ec56451ff35678c405d..d5c9704e779edfe2761b4e6d7b73c03067384b7d 100644 (file)
@@ -17,6 +17,9 @@ 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.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
-Import-Package: org.swtchart
+Import-Package: com.google.common.base,
+ com.google.common.collect,
+ org.swtchart
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
new file mode 100644 (file)
index 0000000..4864aee
--- /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.lttng2.ust.ui.analysis.callstack;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
+
+import java.util.ArrayList;
+import java.util.List;
+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.TmfAnalysisEventFieldRequirement;
+import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisRequirement;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Analysis requirement implementation for LTTng Call Stack Analysis.
+ *
+ * @author Bernd Hufmann
+ *
+ */
+@NonNullByDefault
+public class LttngUstCallStackAnalysisRequirement extends TmfAnalysisRequirement {
+
+    private static String REQUIRMENT_TYPE = "event & context"; //$NON-NLS-1$
+
+    private List<TmfAnalysisEventFieldRequirement> fEntryRequirements = new ArrayList<>();
+    private List<TmfAnalysisEventFieldRequirement> fExitRequirements = new ArrayList<>();
+    /**
+     * Constructor
+     *
+     * @param layout
+     *            The event layout (non-null)
+     */
+    public LttngUstCallStackAnalysisRequirement(ILttngUstEventLayout layout) {
+        super(REQUIRMENT_TYPE);
+
+        Set<@NonNull String> requiredEventsFields = ImmutableSet.of(
+                layout.contextProcname(),
+                layout.contextVtid());
+        TmfAnalysisEventFieldRequirement requirement = new TmfAnalysisEventFieldRequirement(
+                layout.eventCygProfileFuncEntry(),
+                requiredEventsFields,
+                ValuePriorityLevel.MANDATORY);
+        fEntryRequirements.add(requirement);
+
+        requirement = new TmfAnalysisEventFieldRequirement(
+                layout.eventCygProfileFastFuncEntry(),
+                requiredEventsFields,
+                ValuePriorityLevel.MANDATORY);
+        fEntryRequirements.add(requirement);
+
+        requirement = new TmfAnalysisEventFieldRequirement(
+                layout.eventCygProfileFuncExit(),
+                requiredEventsFields,
+                ValuePriorityLevel.MANDATORY);
+        fExitRequirements.add(requirement);
+
+        requirement = new TmfAnalysisEventFieldRequirement(
+                layout.eventCygProfileFastFuncExit(),
+                requiredEventsFields,
+                ValuePriorityLevel.MANDATORY);
+        fExitRequirements.add(requirement);
+
+        // Add mandatory values (event names and context names)
+        addValue(layout.eventCygProfileFuncEntry(), ValuePriorityLevel.MANDATORY);
+        addValue(layout.eventCygProfileFuncExit(), ValuePriorityLevel.MANDATORY);
+        addValues(requiredEventsFields, ValuePriorityLevel.MANDATORY);
+        addInformation(nullToEmptyString(Messages.LttnUstCallStackAnalysisModule_EventsLoadingInformation));
+    }
+
+    @Override
+    public boolean test(ITmfTrace trace) {
+        boolean fullfilled = fEntryRequirements.stream().anyMatch(requirement -> {
+            return requirement.test(trace);
+        });
+
+        if (fullfilled) {
+            fullfilled = fExitRequirements.stream().anyMatch(requirement -> {
+                return requirement.test(trace);
+            });
+        }
+        return fullfilled;
+    }
+}
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
new file mode 100644 (file)
index 0000000..bdcc3ad
--- /dev/null
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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 ust memory analysis module
+ *
+ * @author Bernd Hufmann
+ */
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.lttng2.ust.ui.analysis.callstack.messages"; //$NON-NLS-1$
+
+    /** Information regarding events loading prior to the analysis execution */
+    public static String LttnUstCallStackAnalysisModule_EventsLoadingInformation;
+
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    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
new file mode 100644 (file)
index 0000000..a5e29a8
--- /dev/null
@@ -0,0 +1,12 @@
+###############################################################################
+# 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
+###############################################################################
+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 6078caaa2d81ba9ec3775da28356bb901dd73098..e533d135770c49f338eb6f0f503405e43bfb05f7 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2015 Ericsson
+ * 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
@@ -8,19 +8,29 @@
  *
  * Contributors:
  *   Alexandre Montplaisir - Initial API and implementation
+ *   Bernd Hufmann - Added analysis requirements
  *******************************************************************************/
 
 package org.eclipse.tracecompass.lttng2.ust.ui.analysis.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.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.TmfAnalysisRequirement;
 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 org.eclipse.tracecompass.tmf.ui.views.callstack.AbstractCallStackAnalysis;
 
+import com.google.common.collect.ImmutableSet;
+
 /**
  * Call-stack analysis to populate the TMF CallStack View from UST cyg-profile
  * events.
@@ -29,6 +39,8 @@ import org.eclipse.tracecompass.tmf.ui.views.callstack.AbstractCallStackAnalysis
  */
 public class LttngUstCallStackAnalysis extends AbstractCallStackAnalysis {
 
+    private @Nullable Set<@NonNull TmfAnalysisRequirement> fAnalysisRequirements = null;
+
     /**
      * @since 1.0
      */
@@ -50,4 +62,22 @@ public class LttngUstCallStackAnalysis extends AbstractCallStackAnalysis {
         return new LttngUstCallStackProvider(checkNotNull(getTrace()));
     }
 
+    @Override
+    public @NonNull Iterable<@NonNull TmfAnalysisRequirement> getAnalysisRequirements() {
+
+        Set<@NonNull TmfAnalysisRequirement> 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;
+    }
+
+
+
 }
This page took 0.033591 seconds and 5 git commands to generate.