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

QmlProfiler: Fix nesting calculation.



The previous version makes no sense as two events for which
start2 > end1 cannot have start1 == start2. Also, as we only keep
parents, not children, in the parent list, we don't need all the
special cases for grandparents.

Change-Id: Ic6bae2fe237a31726fd55f560c309ba09b5af25d
Reviewed-by: default avatarKai Koehne <kai.koehne@theqtcompany.com>
parent 3c3e62df
......@@ -34,6 +34,7 @@
#include "timelineselectionrenderpass.h"
#include "timelinenotesrenderpass.h"
#include <utils/qtcassert.h>
#include <QLinkedList>
namespace Timeline {
......@@ -75,25 +76,19 @@ void TimelineModel::computeNesting()
TimelineModelPrivate::Range &parent = d->ranges[*parentIt];
qint64 parentEnd = parent.start + parent.duration;
if (parentEnd < current.start) {
if (parent.start == current.start) {
if (parent.parent == -1) {
parent.parent = range;
} else {
TimelineModelPrivate::Range &ancestor = d->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);
}
// We've completely passed the parent. Remove it.
parentIt = parents.erase(parentIt);
} else if (parentEnd >= current.start + current.duration) {
// no need to insert
// Current range is completely inside the parent range: no need to insert
current.parent = *parentIt;
break;
} else if (parent.start == current.start) {
// The parent range starts at the same time but ends before the current range.
// We need to switch them.
QTC_CHECK(parent.parent == -1);
parent.parent = range;
*parentIt = range;
break;
} else {
++parentIt;
}
......
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