From: Geneviève Bastien Date: Fri, 22 Jul 2016 13:58:13 +0000 (-0400) Subject: tmf/ust: deprecate AbstractCallStackAnalysis and move the UST module to core X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;ds=sidebyside;h=1841657eea27734cea011aff43d2014288319113;p=deliverable%2Ftracecompass.git tmf/ust: deprecate AbstractCallStackAnalysis and move the UST module to core 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 Reviewed-on: https://git.eclipse.org/r/77781 Reviewed-by: Hudson CI --- 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 index 0000000000..edd870d898 --- /dev/null +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core.tests/src/org/eclipse/tracecompass/lttng2/ust/core/tests/callstack/LTTngUstCallStackAnalysisRequirementTest.java @@ -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 validFields = ImmutableSet.of(CONTEXT_VTID, CONTEXT_PROCNAME); + private static final @NonNull Collection 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 fields) { + fType = new CtfTmfEventType(name, null) { + @Override + public String getName() { + return name; + } + @Override + public @NonNull Collection 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 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())); + } + } +} diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/plugin.properties b/lttng/org.eclipse.tracecompass.lttng2.ust.core/plugin.properties index db7013a862..06821166ac 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.core/plugin.properties +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/plugin.properties @@ -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 diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/plugin.xml b/lttng/org.eclipse.tracecompass.lttng2.ust.core/plugin.xml index f11891a8f8..69df9279f1 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.core/plugin.xml +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/plugin.xml @@ -32,5 +32,15 @@ class="org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace"> + + + + 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 index 0000000000..d9ac6e2ea8 --- /dev/null +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/LttngUstCallStackAnalysis.java @@ -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 index 0000000000..771e7070f6 --- /dev/null +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/LttngUstCallStackAnalysisRequirement.java @@ -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 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 index 0000000000..32bf7ef816 --- /dev/null +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/Messages.java @@ -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 index 0000000000..8adbf025da --- /dev/null +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/messages.properties @@ -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 diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.ui.tests/META-INF/MANIFEST.MF b/lttng/org.eclipse.tracecompass.lttng2.ust.ui.tests/META-INF/MANIFEST.MF index 9bbd1eb8ce..5dbe3eef69 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.ui.tests/META-INF/MANIFEST.MF +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.ui.tests/META-INF/MANIFEST.MF @@ -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 index c423c969ac..0000000000 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.ui.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/tests/analysis/callstack/LTTngUstCallStackAnalysisRequirementTest.java +++ /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 validFields = ImmutableSet.of(CONTEXT_VTID, CONTEXT_PROCNAME); - private static final @NonNull Collection 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 fields) { - fType = new CtfTmfEventType(name, null) { - @Override - public String getName() { - return name; - } - @Override - public @NonNull Collection 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 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())); - } - } -} diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/META-INF/MANIFEST.MF b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/META-INF/MANIFEST.MF index 465ae5ded0..f60e2b3fdc 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/META-INF/MANIFEST.MF +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/META-INF/MANIFEST.MF @@ -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 diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/plugin.properties b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/plugin.properties index 29cfacc0a0..b56b61c8e7 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/plugin.properties +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/plugin.properties @@ -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 diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/plugin.xml b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/plugin.xml index 801eb4b559..130807c2af 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/plugin.xml +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/plugin.xml @@ -21,16 +21,6 @@ - - - - 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 index 9af91a621d..0000000000 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/LttngUstCallStackAnalysisRequirement.java +++ /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 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 index 2ce8d1ce45..0000000000 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/Messages.java +++ /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 index 8adbf025da..0000000000 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/analysis/callstack/messages.properties +++ /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 diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/lttng2/ust/ui/analysis/callstack/LttngUstCallStackAnalysis.java b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/lttng2/ust/ui/analysis/callstack/LttngUstCallStackAnalysis.java index a8e0d6d3c3..a14431da23 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/lttng2/ust/ui/analysis/callstack/LttngUstCallStackAnalysis.java +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/lttng2/ust/ui/analysis/callstack/LttngUstCallStackAnalysis.java @@ -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 { /** diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/plugin.xml b/tmf/org.eclipse.tracecompass.tmf.ui/plugin.xml index fe60b8acba..c32715d9d8 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/plugin.xml +++ b/tmf/org.eclipse.tracecompass.tmf.ui/plugin.xml @@ -1901,6 +1901,9 @@ id="org.eclipse.linuxtools.tmf.core.statistics.analysis"> + + diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/AbstractCallStackAnalysis.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/AbstractCallStackAnalysis.java index 6c39a1f438..665162d7d2 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/AbstractCallStackAnalysis.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/AbstractCallStackAnalysis.java @@ -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 index 0000000000..97e49e2147 --- /dev/null +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackAnalysisListener.java @@ -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)); + } + } + +} diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java index 32d68196c5..6b2aa2484a 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java @@ -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 modules = - TmfTraceUtils.getAnalysisModulesOfClass(trace, AbstractCallStackAnalysis.class); - Iterator it = modules.iterator(); + Iterable modules = + TmfTraceUtils.getAnalysisModulesOfClass(trace, CallStackAnalysis.class); + Iterator 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()) {