X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=org.eclipse.tracecompass.tmf.analysis.xml.ui%2Fsrc%2Forg%2Feclipse%2Ftracecompass%2Ftmf%2Fanalysis%2Fxml%2Fui%2Fviews%2Ftimegraph%2FXmlTimeGraphView.java;h=74bdaeba40523366ef1fb29cb1897dce7bab12a9;hb=657cb785e01ccb9f8b18f220db8c8905a4dd7650;hp=0a7938ff3c20870b61f5c957a1dd5f0f4a362dba;hpb=1dd75589718832113f585fbae2b786aa11a673a3;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java b/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java index 0a7938ff3c..74bdaeba40 100644 --- a/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java +++ b/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java @@ -13,6 +13,8 @@ package org.eclipse.tracecompass.tmf.analysis.xml.ui.views.timegraph; +import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull; + import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -50,6 +52,7 @@ import org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithState import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; +import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView; import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider2; import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ILinkEvent; @@ -244,6 +247,7 @@ public class XmlTimeGraphView extends AbstractTimeGraphView { List entries = XmlUtils.getChildElements(viewElement, TmfXmlUiStrings.ENTRY_ELEMENT); Set entryList = new TreeSet<>(getEntryComparator()); for (ITmfTrace aTrace : TmfTraceManager.getTraceSet(trace)) { + aTrace = checkNotNull(aTrace); if (monitor.isCanceled()) { return; } @@ -253,12 +257,13 @@ public class XmlTimeGraphView extends AbstractTimeGraphView { /* * No analysis specified, take all state system analysis modules */ - for (ITmfAnalysisModuleWithStateSystems module : aTrace.getAnalysisModulesOfClass(ITmfAnalysisModuleWithStateSystems.class)) { + for (ITmfAnalysisModuleWithStateSystems module : TmfTraceUtils.getAnalysisModulesOfClass(aTrace, ITmfAnalysisModuleWithStateSystems.class)) { stateSystemModules.add(module); } } else { for (String moduleId : analysisIds) { - ITmfAnalysisModuleWithStateSystems module = aTrace.getAnalysisModuleOfClass(ITmfAnalysisModuleWithStateSystems.class, moduleId); + moduleId = checkNotNull(moduleId); + ITmfAnalysisModuleWithStateSystems module = TmfTraceUtils.getAnalysisModuleOfClass(aTrace, ITmfAnalysisModuleWithStateSystems.class, moduleId); if (module != null) { stateSystemModules.add(module); } @@ -376,7 +381,7 @@ public class XmlTimeGraphView extends AbstractTimeGraphView { } private XmlEntry processEntry(@NonNull Element entryElement, @NonNull Element displayEl, - XmlEntry parentEntry, int quark, ITmfStateSystem ss) { + @NonNull XmlEntry parentEntry, int quark, ITmfStateSystem ss) { /* * Get the start time and end time of this entry from the display * attribute @@ -423,7 +428,7 @@ public class XmlTimeGraphView extends AbstractTimeGraphView { entryStart, entryEnd, EntryDisplayType.DISPLAY, ss, entryElement); } - private void buildStatusEvent(XmlEntry traceEntry, IProgressMonitor monitor, long start, long end) { + private void buildStatusEvent(XmlEntry traceEntry, @NonNull IProgressMonitor monitor, long start, long end) { long resolution = (end - start) / getDisplayWidth(); long startTime = Math.max(start, traceEntry.getStartTime()); long endTime = Math.min(end + 1, traceEntry.getEndTime()); @@ -449,9 +454,17 @@ public class XmlTimeGraphView extends AbstractTimeGraphView { boolean root = true; if (!entry.getParentId().isEmpty()) { XmlEntry parent = entryMap.get(entry.getParentId()); + /* + * Associate the parent entry only if their time overlap. A + * child entry may start before its parent, for example at the + * beginning of the trace if a parent has not yet appeared in + * the state system. We just want to make sure that the entry + * didn't start after the parent ended or ended before the + * parent started. + */ if (parent != null && - entry.getStartTime() >= parent.getStartTime() && - entry.getStartTime() <= parent.getEndTime()) { + !(entry.getStartTime() > parent.getEndTime() || + entry.getEndTime() < parent.getStartTime())) { parent.addChild(entry); root = false; }