X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=org.eclipse.linuxtools.lttng2.kernel.ui%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Finternal%2Flttng2%2Fkernel%2Fui%2Fviews%2Fcontrolflow%2FControlFlowView.java;h=3bbd30ca991056ff451469aa084464ad561daa1b;hb=bcec0116448fab84a99a822ea9912cabb5c983f4;hp=ce25ecf4c3fc1f633adc277282065284b76f94b3;hpb=ff3f02c861e15775cdd2f4263b98fb9634359bbf;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java index ce25ecf4c3..3bbd30ca99 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java @@ -20,20 +20,21 @@ import java.util.List; import java.util.Map; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes; import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Activator; import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages; -import org.eclipse.linuxtools.lttng2.kernel.ui.analysis.LttngKernelAnalysisModule; -import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException; -import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException; -import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException; -import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException; -import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval; -import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem; -import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue; +import org.eclipse.linuxtools.lttng2.kernel.core.analysis.LttngKernelAnalysisModule; +import org.eclipse.linuxtools.statesystem.core.ITmfStateSystem; +import org.eclipse.linuxtools.statesystem.core.exceptions.AttributeNotFoundException; +import org.eclipse.linuxtools.statesystem.core.exceptions.StateSystemDisposedException; +import org.eclipse.linuxtools.statesystem.core.exceptions.StateValueTypeException; +import org.eclipse.linuxtools.statesystem.core.exceptions.TimeRangeException; +import org.eclipse.linuxtools.statesystem.core.interval.ITmfStateInterval; +import org.eclipse.linuxtools.statesystem.core.statevalue.ITmfStateValue; import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager; import org.eclipse.linuxtools.tmf.ui.views.timegraph.AbstractTimeGraphView; @@ -266,42 +267,57 @@ public class ControlFlowView extends AbstractTimeGraphView { if (threadId <= 0) { // ignore the 'unknown' (-1) and swapper (0) threads continue; } + + int execNameQuark; + List execNameIntervals; try { - int execNameQuark = ssq.getQuarkRelative(threadQuark, Attributes.EXEC_NAME); - List execNameIntervals = ssq.queryHistoryRange(execNameQuark, start, end); - for (ITmfStateInterval execNameInterval : execNameIntervals) { - if (monitor.isCanceled()) { - return; - } - ControlFlowEntry entry = entryMap.get(threadId); - if (!execNameInterval.getStateValue().isNull() && - execNameInterval.getStateValue().getType() == ITmfStateValue.Type.STRING) { - String execName = execNameInterval.getStateValue().unboxStr(); - long startTime = execNameInterval.getStartTime(); - long endTime = execNameInterval.getEndTime() + 1; - if (entry == null) { - int ppid = -1; + execNameQuark = ssq.getQuarkRelative(threadQuark, Attributes.EXEC_NAME); + execNameIntervals = ssq.queryHistoryRange(execNameQuark, start, end); + } catch (AttributeNotFoundException e) { + /* No information on this thread (yet?), skip it for now */ + continue; + } catch (StateSystemDisposedException e) { + /* State system is closing down, no point continuing */ + break; + } + + for (ITmfStateInterval execNameInterval : execNameIntervals) { + if (monitor.isCanceled()) { + return; + } + ControlFlowEntry entry = entryMap.get(threadId); + if (!execNameInterval.getStateValue().isNull() && + execNameInterval.getStateValue().getType() == ITmfStateValue.Type.STRING) { + String execName = execNameInterval.getStateValue().unboxStr(); + long startTime = execNameInterval.getStartTime(); + long endTime = execNameInterval.getEndTime() + 1; + if (entry == null) { + ITmfStateInterval ppidInterval = null; + try { int ppidQuark = ssq.getQuarkRelative(threadQuark, Attributes.PPID); - ITmfStateInterval ppidInterval = ssq.querySingleState(startTime, ppidQuark); - if (!ppidInterval.getStateValue().isNull()) { - ppid = ppidInterval.getStateValue().unboxInt(); - } - entry = new ControlFlowEntry(threadQuark, trace, execName, threadId, ppid, startTime, endTime); - entryList.add(entry); - entryMap.put(threadId, entry); - } else { - // update the name of the entry to the latest execName - entry.setName(execName); - entry.updateEndTime(endTime); + ppidInterval = ssq.querySingleState(startTime, ppidQuark); + } catch (AttributeNotFoundException e) { + /* No info, keep PPID at -1 */ + } catch (StateSystemDisposedException e) { + /* SS is closing down, time to bail */ + break; + } + int ppid = -1; + if (!(ppidInterval == null) && !ppidInterval.getStateValue().isNull()) { + ppid = ppidInterval.getStateValue().unboxInt(); } + entry = new ControlFlowEntry(threadQuark, trace, execName, threadId, ppid, startTime, endTime); + entryList.add(entry); + entryMap.put(threadId, entry); } else { - entryMap.remove(threadId); + // update the name of the entry to the latest + // execName + entry.setName(execName); + entry.updateEndTime(endTime); } + } else { + entryMap.remove(threadId); } - } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) { - e.printStackTrace(); - } catch (StateSystemDisposedException e) { - /* Ignored */ } } @@ -367,7 +383,7 @@ public class ControlFlowView extends AbstractTimeGraphView { long endTime = Math.min(end + 1, entry.getEndTime()); long resolution = Math.max(1, (end - ssq.getStartTime()) / getDisplayWidth()); List eventList = getEventList(entry, startTime, endTime, resolution, monitor); - if (monitor.isCanceled()) { + if (eventList == null) { return; } for (ITimeEvent event : eventList) { @@ -386,7 +402,7 @@ public class ControlFlowView extends AbstractTimeGraphView { } @Override - protected List getEventList(TimeGraphEntry tgentry, long startTime, long endTime, long resolution, IProgressMonitor monitor) { + protected @Nullable List getEventList(TimeGraphEntry tgentry, long startTime, long endTime, long resolution, IProgressMonitor monitor) { List eventList = null; if (!(tgentry instanceof ControlFlowEntry)) { return eventList;