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 <christian.kandeler@qt.io>
This commit is contained in:
Ulf Hermann
2016-12-28 18:40:01 +01:00
parent ba46ebc0f2
commit 5dd4b7d8fe

View File

@@ -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;
}