Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeneviève Bastien2018-03-26 09:38:28 -0400
committerGenevieve Bastien2018-04-06 11:58:34 -0400
commit61ad88e04821721bb6c3a003fe547f6721f77f74 (patch)
tree2964d275d3452ad06c40e45d92f3a2a92c8a1071
parent8f39a744eb2b74a78b3f7d712ea0afdfbe48afff (diff)
downloadorg.eclipse.tracecompass.incubator-61ad88e04821721bb6c3a003fe547f6721f77f74.tar.gz
org.eclipse.tracecompass.incubator-61ad88e04821721bb6c3a003fe547f6721f77f74.tar.xz
org.eclipse.tracecompass.incubator-61ad88e04821721bb6c3a003fe547f6721f77f74.zip
callstack: Allow only one series per analysis
Allowing multiple series was a bit over-engineered. If multiple series are possible, they can either be another level in the state system (if they have the same structure), or XML-define the other series using the same analysis as the first one. With the data provider, there will be one provider per analysis/series. Change-Id: I88634cd1bda6cea067c4dd8e4aaf7c40ad94a8ce Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net> Reviewed-on: https://git.eclipse.org/r/120187 Tested-by: CI Bot Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/CallStackTest.java8
-rw-r--r--callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/statesystem/CallStackStateSystemTest.java11
-rw-r--r--callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/stubs/org/eclipse/tracecompass/incubator/callstack/core/tests/stubs/CallGraphAnalysisStub.java12
-rw-r--r--callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/IFlameChartProvider.java9
-rw-r--r--callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/InstrumentedCallStackAnalysis.java16
-rw-r--r--callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CallGraphAnalysis.java25
-rw-r--r--callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/xml/callstack/CallstackXmlAnalysis.java116
-rw-r--r--callstack/org.eclipse.tracecompass.incubator.callstack.ui/src/org/eclipse/tracecompass/incubator/internal/callstack/ui/views/flamechart/FlameChartView.java17
8 files changed, 102 insertions, 112 deletions
diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/CallStackTest.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/CallStackTest.java
index c258ce36..5ccbec36 100644
--- a/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/CallStackTest.java
+++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/CallStackTest.java
@@ -54,9 +54,7 @@ public class CallStackTest extends CallStackTestBase {
CallStackAnalysisStub module = getModule();
assertNotNull(module);
- Collection<CallStackSeries> callStacks = module.getCallStackSeries();
- assertEquals(1, callStacks.size());
- CallStackSeries callstack = callStacks.iterator().next();
+ CallStackSeries callstack = module.getCallStackSeries();
assertNotNull(callstack);
Collection<ICallStackElement> processes = callstack.getRootElements();
@@ -241,9 +239,7 @@ public class CallStackTest extends CallStackTestBase {
CallStackAnalysisStub module = getModule();
assertNotNull(module);
- Collection<CallStackSeries> callStacks = module.getCallStackSeries();
- assertEquals(1, callStacks.size());
- CallStackSeries callstack = callStacks.iterator().next();
+ CallStackSeries callstack = module.getCallStackSeries();
assertNotNull(callstack);
Collection<ICallStackElement> processes = callstack.getRootElements();
diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/statesystem/CallStackStateSystemTest.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/statesystem/CallStackStateSystemTest.java
index 8a40433b..a8a93cd9 100644
--- a/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/statesystem/CallStackStateSystemTest.java
+++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/statesystem/CallStackStateSystemTest.java
@@ -18,7 +18,6 @@ import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.List;
import org.eclipse.tracecompass.incubator.callstack.core.base.ICallStackGroupDescriptor;
@@ -56,9 +55,8 @@ public class CallStackStateSystemTest extends CallStackTestBase {
assertNotNull(module);
// There should be only 1 callstack series
- Collection<CallStackSeries> callStacks = module.getCallStackSeries();
- assertEquals(1, callStacks.size());
- CallStackSeries callstack = callStacks.iterator().next();
+ CallStackSeries callstack = module.getCallStackSeries();
+ assertNotNull(callstack);
// Get the patterns for each level of the callstack
List<String[]> patterns = module.getPatterns();
@@ -95,9 +93,8 @@ public class CallStackStateSystemTest extends CallStackTestBase {
assertNotNull(module);
// There should be 1 callstack series
- Collection<CallStackSeries> callStacks = module.getCallStackSeries();
- assertEquals(1, callStacks.size());
- CallStackSeries callstack = callStacks.iterator().next();
+ CallStackSeries callstack = module.getCallStackSeries();
+ assertNotNull(callstack);
ITmfStateSystem ss = module.getStateSystem();
assertNotNull(ss);
diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/stubs/org/eclipse/tracecompass/incubator/callstack/core/tests/stubs/CallGraphAnalysisStub.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/stubs/org/eclipse/tracecompass/incubator/callstack/core/tests/stubs/CallGraphAnalysisStub.java
index 3e9a7e75..1f51845e 100644
--- a/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/stubs/org/eclipse/tracecompass/incubator/callstack/core/tests/stubs/CallGraphAnalysisStub.java
+++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/stubs/org/eclipse/tracecompass/incubator/callstack/core/tests/stubs/CallGraphAnalysisStub.java
@@ -9,8 +9,6 @@
package org.eclipse.tracecompass.incubator.callstack.core.tests.stubs;
-import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -78,9 +76,9 @@ public class CallGraphAnalysisStub extends CallGraphAnalysis {
}
@Override
- public Collection<CallStackSeries> getCallStackSeries() {
+ public @Nullable CallStackSeries getCallStackSeries() {
List<String @NonNull []> patterns = fPatterns;
- return Collections.singleton(new CallStackSeries(fSs, patterns == null ? PATTERNS : patterns, 0, "", new CallStackHostUtils.TraceHostIdResolver(getTrace()), new CallStackSeries.AttributeValueThreadResolver(1))); //$NON-NLS-1$
+ return new CallStackSeries(fSs, patterns == null ? PATTERNS : patterns, 0, "", new CallStackHostUtils.TraceHostIdResolver(getTrace()), new CallStackSeries.AttributeValueThreadResolver(1)); //$NON-NLS-1$
}
@Override
@@ -130,7 +128,11 @@ public class CallGraphAnalysisStub extends CallGraphAnalysis {
* @return The return value of the iteration
*/
public boolean iterate() {
- return iterateOverCallstackSerie(fCsProvider.getCallStackSeries().iterator().next(), ModelManager.getModelFor(""), getCallGraph(), 0, Long.MAX_VALUE, new NullProgressMonitor());
+ CallStackSeries callStackSeries = fCsProvider.getCallStackSeries();
+ if (callStackSeries == null) {
+ throw new NullPointerException();
+ }
+ return iterateOverCallstackSerie(callStackSeries, ModelManager.getModelFor(""), getCallGraph(), 0, Long.MAX_VALUE, new NullProgressMonitor());
}
@Override
diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/IFlameChartProvider.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/IFlameChartProvider.java
index 9f90a62b..9dbf4856 100644
--- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/IFlameChartProvider.java
+++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/IFlameChartProvider.java
@@ -9,8 +9,7 @@
package org.eclipse.tracecompass.incubator.callstack.core.instrumented;
-import java.util.Collection;
-
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider;
import org.eclipse.tracecompass.incubator.callstack.core.instrumented.statesystem.CallStackHostUtils;
import org.eclipse.tracecompass.incubator.callstack.core.instrumented.statesystem.CallStackSeries;
@@ -25,11 +24,11 @@ import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
public interface IFlameChartProvider extends IAnalysisModule, ISegmentStoreProvider {
/**
- * Get all the callstacks provided by this analysis.
+ * Get the callstacks series provided by this analysis.
*
- * @return A collection of call stacks
+ * @return The callstack series or null if it is not available yet
*/
- Collection<CallStackSeries> getCallStackSeries();
+ @Nullable CallStackSeries getCallStackSeries();
/**
* Get the ID of the host this callstack provider is for
diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/InstrumentedCallStackAnalysis.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/InstrumentedCallStackAnalysis.java
index d508565c..0bf82880 100644
--- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/InstrumentedCallStackAnalysis.java
+++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/InstrumentedCallStackAnalysis.java
@@ -65,7 +65,7 @@ public abstract class InstrumentedCallStackAnalysis extends TmfStateSystemAnalys
private static final List<String[]> PATTERNS = ImmutableList.of(DEFAULT_PROCESSES_PATTERN, DEFAULT_THREADS_PATTERN);
- private @Nullable Collection<CallStackSeries> fCallStacks;
+ private @Nullable CallStackSeries fCallStacks;
private final CallGraphAnalysis fCallGraph;
@@ -102,15 +102,15 @@ public abstract class InstrumentedCallStackAnalysis extends TmfStateSystemAnalys
}
@Override
- public Collection<CallStackSeries> getCallStackSeries() {
- Collection<CallStackSeries> callstacks = fCallStacks;
+ public @Nullable CallStackSeries getCallStackSeries() {
+ CallStackSeries callstacks = fCallStacks;
if (callstacks == null) {
ITmfStateSystem ss = getStateSystem();
ITmfTrace trace = getTrace();
if (ss == null || trace == null) {
- return Collections.emptySet();
+ return null;
}
- callstacks = Collections.singleton(new CallStackSeries(ss, getPatterns(), 0, "", getCallStackHostResolver(trace), getCallStackTidResolver())); //$NON-NLS-1$
+ callstacks = new CallStackSeries(ss, getPatterns(), 0, "", getCallStackHostResolver(trace), getCallStackTidResolver()); //$NON-NLS-1$
fCallStacks = callstacks;
}
return callstacks;
@@ -253,11 +253,11 @@ public abstract class InstrumentedCallStackAnalysis extends TmfStateSystemAnalys
*/
@Override
public @Nullable ISegmentStore<ISegment> getSegmentStore() {
- Collection<CallStackSeries> callStacks = getCallStackSeries();
- if (callStacks.isEmpty()) {
+ CallStackSeries series = getCallStackSeries();
+ if (series == null) {
return null;
}
- return callStacks.iterator().next();
+ return series;
}
@Override
diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CallGraphAnalysis.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CallGraphAnalysis.java
index d1cc5648..3be1b089 100644
--- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CallGraphAnalysis.java
+++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CallGraphAnalysis.java
@@ -14,14 +14,12 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import java.util.stream.Collectors;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.tracecompass.common.core.StreamUtils;
import org.eclipse.tracecompass.incubator.analysis.core.concepts.AggregatedCallSite;
import org.eclipse.tracecompass.incubator.analysis.core.concepts.ICallStackSymbol;
import org.eclipse.tracecompass.incubator.analysis.core.concepts.ProcessStatusInterval;
@@ -139,7 +137,8 @@ public class CallGraphAnalysis extends TmfAbstractAnalysisModule implements ICal
IFlameChartProvider callstackModule = (IFlameChartProvider) module;
IHostModel model = ModelManager.getModelFor(callstackModule.getHostId());
- for (CallStackSeries callstack : callstackModule.getCallStackSeries()) {
+ CallStackSeries callstack = callstackModule.getCallStackSeries();
+ if (callstack != null) {
long time0 = range.getStartTime().toNanos();
long time1 = range.getEndTime().toNanos();
long start = Math.min(time0, time1);
@@ -252,14 +251,14 @@ public class CallGraphAnalysis extends TmfAbstractAnalysisModule implements ICal
*
* @return The collection of callstack series
*/
- public Collection<CallStackSeries> getSeries() {
- List<CallStackSeries> series = new ArrayList<>();
+ public @Nullable CallStackSeries getSeries() {
+ CallStackSeries series = null;
for (IAnalysisModule dependent : getDependentAnalyses()) {
if (!(dependent instanceof IFlameChartProvider)) {
continue;
}
IFlameChartProvider csProvider = (IFlameChartProvider) dependent;
- series.addAll(csProvider.getCallStackSeries());
+ series = csProvider.getCallStackSeries();
}
return series;
}
@@ -283,10 +282,16 @@ public class CallGraphAnalysis extends TmfAbstractAnalysisModule implements ICal
@Override
public Collection<ICallStackGroupDescriptor> getGroupDescriptors() {
- return StreamUtils.getStream(getDependentAnalyses())
- .flatMap(m -> StreamUtils.getStream(((IFlameChartProvider) m).getCallStackSeries()))
- .map(CallStackSeries::getRootGroup)
- .collect(Collectors.toList());
+ List<ICallStackGroupDescriptor> descriptors = new ArrayList<>();
+ for (IAnalysisModule module : getDependentAnalyses()) {
+ if (module instanceof IFlameChartProvider) {
+ CallStackSeries serie = ((IFlameChartProvider) module).getCallStackSeries();
+ if (serie != null) {
+ descriptors.add(serie.getRootGroup());
+ }
+ }
+ }
+ return descriptors;
}
@Override
diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/xml/callstack/CallstackXmlAnalysis.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/xml/callstack/CallstackXmlAnalysis.java
index d14411e9..fc28f1d0 100644
--- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/xml/callstack/CallstackXmlAnalysis.java
+++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/xml/callstack/CallstackXmlAnalysis.java
@@ -33,6 +33,7 @@ import org.eclipse.tracecompass.incubator.callstack.core.instrumented.statesyste
import org.eclipse.tracecompass.incubator.callstack.core.instrumented.statesystem.CallStackHostUtils.IHostIdResolver;
import org.eclipse.tracecompass.incubator.callstack.core.instrumented.statesystem.CallStackSeries;
import org.eclipse.tracecompass.incubator.callstack.core.instrumented.statesystem.CallStackSeries.IThreadIdResolver;
+import org.eclipse.tracecompass.incubator.internal.callstack.core.Activator;
import org.eclipse.tracecompass.incubator.internal.callstack.core.instrumented.callgraph.CallGraphAnalysis;
import org.eclipse.tracecompass.incubator.internal.callstack.core.xml.callstack.CallstackXmlModuleHelper.ISubModuleHelper;
import org.eclipse.tracecompass.segmentstore.core.ISegment;
@@ -48,8 +49,6 @@ import org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithState
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
*
@@ -61,7 +60,7 @@ public class CallstackXmlAnalysis extends TmfAbstractAnalysisModule implements I
private final Path fSourceFile;
private final ISubModuleHelper fHelper;
private @Nullable IAnalysisModule fModule = null;
- private @Nullable Collection<CallStackSeries> fCallStacks = null;
+ private @Nullable CallStackSeries fCallStacks = null;
private final CallGraphAnalysis fCallGraph;
private final ListenerList fListeners = new ListenerList(ListenerList.IDENTITY);
@@ -82,85 +81,84 @@ public class CallstackXmlAnalysis extends TmfAbstractAnalysisModule implements I
}
@Override
- public Collection<CallStackSeries> getCallStackSeries() {
- Collection<CallStackSeries> callstacks = fCallStacks;
- if (callstacks == null) {
+ public @Nullable CallStackSeries getCallStackSeries() {
+ CallStackSeries series = fCallStacks;
+ if (series == null) {
IAnalysisModule module = getAnalysisModule();
if (!(module instanceof ITmfAnalysisModuleWithStateSystems)) {
- return Collections.EMPTY_SET;
+ return null;
}
Iterator<@NonNull ITmfStateSystem> stateSystems = ((ITmfAnalysisModuleWithStateSystems) module).getStateSystems().iterator();
if (!stateSystems.hasNext()) {
- return Collections.EMPTY_SET;
+ return null;
}
ITmfStateSystem ss = stateSystems.next();
Path xmlFile = fSourceFile;
final String pathString = xmlFile.toString();
Element doc = TmfXmlUtils.getElementInFile(pathString, CallstackXmlStrings.CALLSTACK, getId());
if (doc == null) {
- fCallStacks = Collections.EMPTY_SET;
- return Collections.EMPTY_SET;
+ fCallStacks = null;
+ return null;
}
/* parser for defined Fields */
- NodeList callstackNodes = doc.getElementsByTagName(CallstackXmlStrings.CALLSTACK_GROUP);
- NodeList childNodes = doc.getChildNodes();
- for (int i = 0; i<childNodes.getLength(); i++) {
- Node item = childNodes.item(i);
- System.out.println(item.getNodeName());
+ List<Element> callStackElements = TmfXmlUtils.getChildElements(doc, CallstackXmlStrings.CALLSTACK_GROUP);
+ if (callStackElements.size() > 1) {
+ Activator.getInstance().logWarning("More than one callstack series defined. Only the first one will be displayed"); //$NON-NLS-1$
+ } else if (callStackElements.isEmpty()) {
+ fCallStacks = null;
+ return null;
}
- callstacks = new ArrayList<>();
- for (int i = 0; i < callstackNodes.getLength(); i++) {
- Element element = (Element) callstackNodes.item(i);
- List<String[]> patterns = new ArrayList<>();
- for (Element child : TmfXmlUtils.getChildElements(element, CallstackXmlStrings.CALLSTACK_LEVEL)) {
- String attribute = child.getAttribute(CallstackXmlStrings.CALLSTACK_PATH);
- patterns.add(attribute.split("/")); //$NON-NLS-1$
- }
+ Element callStackElement = callStackElements.get(0);
- // Build the thread resolver
- List<Element> childElements = TmfXmlUtils.getChildElements(element, CallstackXmlStrings.CALLSTACK_THREAD);
- IThreadIdResolver resolver = null;
- if (childElements.size() > 0) {
- Element threadElement = childElements.get(0);
- String attribute = threadElement.getAttribute(CallstackXmlStrings.CALLSTACK_THREADCPU);
- if (!attribute.isEmpty()) {
- resolver = new CallStackSeries.CpuResolver(attribute.split("/")); //$NON-NLS-1$
- } else {
- attribute = threadElement.getAttribute(CallstackXmlStrings.CALLSTACK_THREADLEVEL);
- if (!attribute.isEmpty()) {
- String type = threadElement.getAttribute(CallstackXmlStrings.CALLSTACK_THREADLEVEL_TYPE);
- if (type.equals(CallstackXmlStrings.CALLSTACK_THREADLEVEL_VALUE)) {
- resolver = new CallStackSeries.AttributeValueThreadResolver(Integer.valueOf(attribute));
- } else {
- resolver = new CallStackSeries.AttributeNameThreadResolver(Integer.valueOf(attribute));
- }
- }
- }
- }
+ List<String[]> patterns = new ArrayList<>();
+ for (Element child : TmfXmlUtils.getChildElements(callStackElement, CallstackXmlStrings.CALLSTACK_LEVEL)) {
+ String attribute = child.getAttribute(CallstackXmlStrings.CALLSTACK_PATH);
+ patterns.add(attribute.split("/")); //$NON-NLS-1$
+ }
- // Build the host resolver
- childElements = TmfXmlUtils.getChildElements(element, CallstackXmlStrings.CALLSTACK_HOST);
- IHostIdResolver hostResolver = null;
- if (childElements.size() > 0) {
- Element hostElement = childElements.get(0);
- String attribute = hostElement.getAttribute(CallstackXmlStrings.CALLSTACK_THREADLEVEL);
+ // Build the thread resolver
+ List<Element> childElements = TmfXmlUtils.getChildElements(callStackElement, CallstackXmlStrings.CALLSTACK_THREAD);
+ IThreadIdResolver resolver = null;
+ if (childElements.size() > 0) {
+ Element threadElement = childElements.get(0);
+ String attribute = threadElement.getAttribute(CallstackXmlStrings.CALLSTACK_THREADCPU);
+ if (!attribute.isEmpty()) {
+ resolver = new CallStackSeries.CpuResolver(attribute.split("/")); //$NON-NLS-1$
+ } else {
+ attribute = threadElement.getAttribute(CallstackXmlStrings.CALLSTACK_THREADLEVEL);
if (!attribute.isEmpty()) {
- String type = hostElement.getAttribute(CallstackXmlStrings.CALLSTACK_THREADLEVEL_TYPE);
+ String type = threadElement.getAttribute(CallstackXmlStrings.CALLSTACK_THREADLEVEL_TYPE);
if (type.equals(CallstackXmlStrings.CALLSTACK_THREADLEVEL_VALUE)) {
- hostResolver = new CallStackHostUtils.AttributeValueHostResolver(Integer.valueOf(attribute));
+ resolver = new CallStackSeries.AttributeValueThreadResolver(Integer.valueOf(attribute));
} else {
- hostResolver = new CallStackHostUtils.AttributeNameHostResolver(Integer.valueOf(attribute));
+ resolver = new CallStackSeries.AttributeNameThreadResolver(Integer.valueOf(attribute));
}
}
}
- hostResolver = hostResolver == null ? new CallStackHostUtils.TraceHostIdResolver(Objects.requireNonNull(getTrace())) : hostResolver;
+ }
- callstacks.add(new CallStackSeries(ss, patterns, 0, element.getAttribute(TmfXmlStrings.NAME), hostResolver, resolver));
+ // Build the host resolver
+ childElements = TmfXmlUtils.getChildElements(callStackElement, CallstackXmlStrings.CALLSTACK_HOST);
+ IHostIdResolver hostResolver = null;
+ if (childElements.size() > 0) {
+ Element hostElement = childElements.get(0);
+ String attribute = hostElement.getAttribute(CallstackXmlStrings.CALLSTACK_THREADLEVEL);
+ if (!attribute.isEmpty()) {
+ String type = hostElement.getAttribute(CallstackXmlStrings.CALLSTACK_THREADLEVEL_TYPE);
+ if (type.equals(CallstackXmlStrings.CALLSTACK_THREADLEVEL_VALUE)) {
+ hostResolver = new CallStackHostUtils.AttributeValueHostResolver(Integer.valueOf(attribute));
+ } else {
+ hostResolver = new CallStackHostUtils.AttributeNameHostResolver(Integer.valueOf(attribute));
+ }
+ }
}
- fCallStacks = callstacks;
+ hostResolver = hostResolver == null ? new CallStackHostUtils.TraceHostIdResolver(Objects.requireNonNull(getTrace())) : hostResolver;
+
+ series = new CallStackSeries(ss, patterns, 0, callStackElement.getAttribute(TmfXmlStrings.NAME), hostResolver, resolver);
+ fCallStacks = series;
}
- return callstacks;
+ return series;
}
@Override
@@ -327,11 +325,11 @@ public class CallstackXmlAnalysis extends TmfAbstractAnalysisModule implements I
@Override
public @Nullable ISegmentStore<ISegment> getSegmentStore() {
- Collection<CallStackSeries> series = getCallStackSeries();
- if (series.isEmpty()) {
+ CallStackSeries series = getCallStackSeries();
+ if (series == null) {
return null;
}
- return series.iterator().next();
+ return series;
}
/**
diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.ui/src/org/eclipse/tracecompass/incubator/internal/callstack/ui/views/flamechart/FlameChartView.java b/callstack/org.eclipse.tracecompass.incubator.callstack.ui/src/org/eclipse/tracecompass/incubator/internal/callstack/ui/views/flamechart/FlameChartView.java
index 554ee6ab..3a89ce97 100644
--- a/callstack/org.eclipse.tracecompass.incubator.callstack.ui/src/org/eclipse/tracecompass/incubator/internal/callstack/ui/views/flamechart/FlameChartView.java
+++ b/callstack/org.eclipse.tracecompass.incubator.callstack.ui/src/org/eclipse/tracecompass/incubator/internal/callstack/ui/views/flamechart/FlameChartView.java
@@ -570,8 +570,8 @@ public class FlameChartView extends AbstractTimeGraphView {
setEndTime(getEndTime() == SWT.DEFAULT ? end + 1 : Math.max(getEndTime(), end + 1));
Map<ITmfTrace, TraceEntry> traceEntryMap = new HashMap<>();
- Collection<CallStackSeries> callStacks = csProvider.getCallStackSeries();
- if (callStacks.isEmpty()) {
+ CallStackSeries callstack = csProvider.getCallStackSeries();
+ if (callstack == null) {
return;
}
@@ -585,16 +585,9 @@ public class FlameChartView extends AbstractTimeGraphView {
traceEntry.updateEndTime(end);
}
- for (CallStackSeries callstack : callStacks) {
- // If there is more than one callstack objects in the analysis
- TimeGraphEntry callStackRootEntry = traceEntry;
- if (callStacks.size() > 1) {
- callStackRootEntry = new TimeGraphEntry(callstack.getName(), start, end + 1);
- traceEntry.addChild(callStackRootEntry);
- }
- for (ICallStackElement element : callstack.getRootElements()) {
- processCallStackElement(symbolProviders, element, callStackRootEntry);
- }
+ TimeGraphEntry callStackRootEntry = traceEntry;
+ for (ICallStackElement element : callstack.getRootElements()) {
+ processCallStackElement(symbolProviders, element, callStackRootEntry);
}
final long entryStart = getStartTime();
final long entryEnd = getEndTime();

Back to the top