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);
- ppidInterval = ssq.querySingleState(startTime, ppidQuark);
+ ppidInterval = StateSystemUtils.queryUntilNonNullValue(ssq, ppidQuark, startTime, endTime);
} 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()) {
+ if (ppidInterval != null) {
ppid = ppidInterval.getStateValue().unboxInt();
}
entry = new ControlFlowEntry(threadQuark, trace, execName, threadId, ppid, startTime, endTime);
boolean root = (entry.getParent() == null);
if (root && entry.getParentThreadId() > 0) {
for (ControlFlowEntry parent : entryList) {
+ /*
+ * 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.getThreadId() == entry.getParentThreadId() &&
- entry.getStartTime() >= parent.getStartTime() &&
- entry.getStartTime() <= parent.getEndTime()) {
+ !(entry.getStartTime() > parent.getEndTime() ||
+ entry.getEndTime() < parent.getStartTime())) {
parent.addChild(entry);
root = false;
if (rootList != null && rootList.contains(entry)) {