diff options
3 files changed, 54 insertions, 0 deletions
diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/flamechart/CallStack.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/flamechart/CallStack.java index b5fb98dd4..733e4cae6 100644 --- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/flamechart/CallStack.java +++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/flamechart/CallStack.java @@ -303,6 +303,21 @@ public class CallStack { } /** + * Return whether the TID is variable through time for this callstack or if it + * fixed + * + * @return <code>true</code> if the TID may vary during the trace or if it is + * fixed and can be cached. + */ + public boolean isTidVariable() { + if (fThreadIdProvider != null) { + return fThreadIdProvider.variesInTime(); + } + // No TID provider, so does not vary + return false; + } + + /** * Get the start time of this callstack * * @return The start time of the callstack diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/CallStackSeries.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/CallStackSeries.java index 1e2d2c3f7..1196cdcd9 100644 --- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/CallStackSeries.java +++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/CallStackSeries.java @@ -107,6 +107,18 @@ public class CallStackSeries implements ISegmentStore<ISegment> { */ int getThreadId(long time); + /** + * Return whether the value returned by this provider is variable through time + * (ie, each function of a stack may have a different thread ID), or is fixed + * (ie, all functions in a stack have the same thread ID) + * + * @return If <code>true</code>, the thread ID will be identical for a stack all + * throughout its life, it can be therefore be used to provider other + * thread-related information on stack even when there are no function + * calls. + */ + boolean variesInTime(); + } /** @@ -118,6 +130,7 @@ public class CallStackSeries implements ISegmentStore<ISegment> { private final int fQuark; private @Nullable ITmfStateInterval fInterval; private int fLastThreadId = IHostModel.UNKNOWN_TID; + private boolean fVariesInTime = true; public AttributeValueThreadProvider(ITmfStateSystem ss, int quark) { fSs = ss; @@ -154,6 +167,12 @@ public class CallStackSeries implements ISegmentStore<ISegment> { break; } + // If the interval spans the whole state system, the tid does not vary in time + if (fSs.waitUntilBuilt(0)) { + if (interval.intersects(fSs.getStartTime()) && interval.intersects(fSs.getCurrentEndTime() - 1)) { + fVariesInTime = false; + } + } } catch (StateSystemDisposedException e) { interval = null; tid = IHostModel.UNKNOWN_TID; @@ -163,6 +182,11 @@ public class CallStackSeries implements ISegmentStore<ISegment> { return tid; } + @Override + public boolean variesInTime() { + return fVariesInTime; + } + } /** @@ -188,6 +212,11 @@ public class CallStackSeries implements ISegmentStore<ISegment> { return fTid; } + @Override + public boolean variesInTime() { + return false; + } + } /** @@ -230,6 +259,11 @@ public class CallStackSeries implements ISegmentStore<ISegment> { return IHostModel.UNKNOWN_TID; } + @Override + public boolean variesInTime() { + return true; + } + } /** diff --git a/vm/org.eclipse.tracecompass.incubator.virtual.machine.analysis.core/src/org/eclipse/tracecompass/incubator/internal/virtual/machine/analysis/core/overhead/VmOverheadAnalysis.java b/vm/org.eclipse.tracecompass.incubator.virtual.machine.analysis.core/src/org/eclipse/tracecompass/incubator/internal/virtual/machine/analysis/core/overhead/VmOverheadAnalysis.java index cde9ee073..15f5c59a8 100644 --- a/vm/org.eclipse.tracecompass.incubator.virtual.machine.analysis.core/src/org/eclipse/tracecompass/incubator/internal/virtual/machine/analysis/core/overhead/VmOverheadAnalysis.java +++ b/vm/org.eclipse.tracecompass.incubator.virtual.machine.analysis.core/src/org/eclipse/tracecompass/incubator/internal/virtual/machine/analysis/core/overhead/VmOverheadAnalysis.java @@ -126,6 +126,11 @@ public class VmOverheadAnalysis extends InstrumentedCallStackAnalysis { return IHostModel.UNKNOWN_TID; } + @Override + public boolean variesInTime() { + return true; + } + } /** |