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;
if (threadId <= 0) { // ignore the 'unknown' (-1) and swapper (0) threads
continue;
}
+
+ int execNameQuark;
+ List<ITmfStateInterval> execNameIntervals;
try {
- int execNameQuark = ssq.getQuarkRelative(threadQuark, Attributes.EXEC_NAME);
- List<ITmfStateInterval> 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 */
}
}
long endTime = Math.min(end + 1, entry.getEndTime());
long resolution = Math.max(1, (end - ssq.getStartTime()) / getDisplayWidth());
List<ITimeEvent> eventList = getEventList(entry, startTime, endTime, resolution, monitor);
- if (monitor.isCanceled()) {
+ if (eventList == null) {
return;
}
for (ITimeEvent event : eventList) {
}
@Override
- protected List<ITimeEvent> getEventList(TimeGraphEntry tgentry, long startTime, long endTime, long resolution, IProgressMonitor monitor) {
+ protected @Nullable List<ITimeEvent> getEventList(TimeGraphEntry tgentry, long startTime, long endTime, long resolution, IProgressMonitor monitor) {
List<ITimeEvent> eventList = null;
if (!(tgentry instanceof ControlFlowEntry)) {
return eventList;