From: Geneviève Bastien Date: Tue, 20 Dec 2016 02:17:12 +0000 (-0500) Subject: lttng: Remove procname from callstack requirements X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=543e0b452d3fac49322cf2f57aef6249d9f44a16;p=deliverable%2Ftracecompass.git lttng: Remove procname from callstack requirements The analysis does not need the procname and it adds some overhead in a trace with a lot of function calls. Though procname makes it prettier, it should not prevent a user from seeing the callstack of a perfectly workable trace. Change-Id: I3603b52f8559c40b86193d954ab94d9e65dc9bce Signed-off-by: Geneviève Bastien Reviewed-on: https://git.eclipse.org/r/87449 Reviewed-by: Hudson CI Reviewed-by: Matthew Khouzam Tested-by: Matthew Khouzam --- diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/META-INF/MANIFEST.MF b/lttng/org.eclipse.tracecompass.lttng2.ust.core/META-INF/MANIFEST.MF index c5d9abe412..a108e18fd1 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.core/META-INF/MANIFEST.MF +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/META-INF/MANIFEST.MF @@ -28,4 +28,5 @@ Import-Package: com.google.common.annotations;version="15.0.0", com.google.common.base, com.google.common.cache, com.google.common.collect, - com.google.common.io + com.google.common.io, + org.apache.commons.lang3;version="3.1.0" 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 index 771e7070f6..2025b4a85a 100644 --- 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 @@ -11,6 +11,7 @@ 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.Collections; import java.util.Set; import org.eclipse.jdt.annotation.NonNull; @@ -44,9 +45,7 @@ public class LttngUstCallStackAnalysisRequirement extends TmfCompositeAnalysisRe } private static Collection getSubRequirements(ILttngUstEventLayout layout) { - Set<@NonNull String> requiredEventsFields = ImmutableSet.of( - layout.contextProcname(), - layout.contextVtid()); + Set<@NonNull String> requiredEventsFields = Collections.singleton(layout.contextVtid()); // Requirement for the cyg_profile events TmfAnalysisEventFieldRequirement entryReq = new TmfAnalysisEventFieldRequirement( diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/LttngUstCallStackProvider.java b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/LttngUstCallStackProvider.java index 3486465acd..ead41c602b 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/LttngUstCallStackProvider.java +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/callstack/LttngUstCallStackProvider.java @@ -15,6 +15,7 @@ package org.eclipse.tracecompass.internal.lttng2.ust.core.callstack; import java.util.Set; +import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -121,8 +122,7 @@ public class LttngUstCallStackProvider extends CallStackStateProvider { return false; } ITmfEventField content = ((CtfTmfEvent) event).getContent(); - if (content.getField(fLayout.contextVtid()) == null || - content.getField(fLayout.contextProcname()) == null) { + if (content.getField(fLayout.contextVtid()) == null) { return false; } return true; @@ -178,8 +178,9 @@ public class LttngUstCallStackProvider extends CallStackStateProvider { public @Nullable String getThreadName(ITmfEvent event) { /* We checked earlier that the "procname" context is present */ ITmfEventField content = event.getContent(); - String procName = (String) content.getField(fLayout.contextProcname()).getValue(); + ITmfEventField field = content.getField(fLayout.contextProcname()); + String procName = field == null ? StringUtils.EMPTY : (String.valueOf(field.getValue()) + '-'); long vtid = getThreadId(event); - return (procName + '-' + Long.toString(vtid)); + return (procName + Long.toString(vtid)); } }