forked from qt-creator/qt-creator
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: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -143,18 +143,38 @@ public:
|
||||
QLinkedList<int> parents;
|
||||
for (int range = 0; range != count(); ++range) {
|
||||
Range ¤t = ranges[range];
|
||||
for (QLinkedList<int>::iterator parent = parents.begin(); parent != parents.end();) {
|
||||
qint64 parentEnd = ranges[*parent].start + ranges[*parent].duration;
|
||||
for (QLinkedList<int>::iterator parentIt = parents.begin();;) {
|
||||
Range &parent = ranges[*parentIt];
|
||||
qint64 parentEnd = parent.start + parent.duration;
|
||||
if (parentEnd < current.start) {
|
||||
parent = parents.erase(parent);
|
||||
} else if (parentEnd >= current.start + current.duration) {
|
||||
current.parent = *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 {
|
||||
++parent;
|
||||
parentIt = parents.erase(parentIt);
|
||||
}
|
||||
} else if (parentEnd >= current.start + current.duration) {
|
||||
// no need to insert
|
||||
current.parent = *parentIt;
|
||||
break;
|
||||
} else {
|
||||
++parentIt;
|
||||
}
|
||||
|
||||
if (parentIt == parents.end()) {
|
||||
parents.append(range);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user