Commit 5dd4b7d8 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Simplify stack handling in statistics model

There is no need to keep empty events at the bottom.

Change-Id: I072b50329a9f277005cbfa45350c060abd7e7a36
Reviewed-by: Christian Kandeler's avatarChristian Kandeler <christian.kandeler@qt.io>
parent ba46ebc0
......@@ -67,8 +67,6 @@ QmlProfilerStatisticsModel::QmlProfilerStatisticsModel(QmlProfilerModelManager *
QObject(parent), d(new QmlProfilerStatisticsModelPrivate)
{
d->modelManager = modelManager;
d->callStack.push(QmlEvent());
d->compileStack.push(QmlEvent());
connect(modelManager, &QmlProfilerModelManager::stateChanged,
this, &QmlProfilerStatisticsModel::dataChanged);
connect(modelManager->notesModel(), &Timeline::TimelineNotesModel::changed,
......@@ -142,8 +140,6 @@ void QmlProfilerStatisticsModel::clear()
d->notes.clear();
d->callStack.clear();
d->compileStack.clear();
d->callStack.push(QmlEvent());
d->compileStack.push(QmlEvent());
d->qmlTime = 0;
d->lastEndTime = 0;
d->durations.clear();
......@@ -215,7 +211,7 @@ void QmlProfilerStatisticsModel::loadEvent(const QmlEvent &event, const QmlEvent
case RangeStart:
// binding loop detection: check whether event is already in stack
if (type.rangeType() == Binding || type.rangeType() == HandlingSignal) {
for (int ii = 1; ii < stack.size(); ++ii) {
for (int ii = 0; ii < stack.size(); ++ii) {
if (stack.at(ii).typeIndex() == event.typeIndex()) {
d->eventsInBindingLoop.insert(event.typeIndex());
break;
......@@ -246,7 +242,7 @@ void QmlProfilerStatisticsModel::loadEvent(const QmlEvent &event, const QmlEvent
stack.pop();
if (stack.count() > 1)
if (!stack.isEmpty())
d->data[stack.top().typeIndex()].durationSelf -= duration;
break;
}
......
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