Commit e91c79cb authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: Allow ranges starting at the exact same time



Previously, SortedTimelineModel could be confused by ranges starting at
the exact same time if they were inserted in the wrong order. With this
change the nesting calculation keeps track of that.

Change-Id: Id296a54eed7e1ab421e94a296ec4e30adce185f2
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent 57823631
...@@ -143,18 +143,38 @@ public: ...@@ -143,18 +143,38 @@ public:
QLinkedList<int> parents; QLinkedList<int> parents;
for (int range = 0; range != count(); ++range) { for (int range = 0; range != count(); ++range) {
Range &current = ranges[range]; Range &current = ranges[range];
for (QLinkedList<int>::iterator parent = parents.begin(); parent != parents.end();) { for (QLinkedList<int>::iterator parentIt = parents.begin();;) {
qint64 parentEnd = ranges[*parent].start + ranges[*parent].duration; Range &parent = ranges[*parentIt];
qint64 parentEnd = parent.start + parent.duration;
if (parentEnd < current.start) { if (parentEnd < current.start) {
parent = parents.erase(parent); if (parent.start == current.start) {
if (parent.parent == -1) {
parent.parent = range;
} else {
Range &ancestor = ranges[parent.parent];
if (ancestor.start == current.start &&
ancestor.duration < current.duration)
parent.parent = range;
}
// Just switch the old parent range for the new, larger one
*parentIt = range;
break;
} else {
parentIt = parents.erase(parentIt);
}
} else if (parentEnd >= current.start + current.duration) { } else if (parentEnd >= current.start + current.duration) {
current.parent = *parent; // no need to insert
current.parent = *parentIt;
break; break;
} else { } else {
++parent; ++parentIt;
}
if (parentIt == parents.end()) {
parents.append(range);
break;
} }
} }
parents.append(range);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment