forked from qt-creator/qt-creator
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:
@@ -67,8 +67,6 @@ QmlProfilerStatisticsModel::QmlProfilerStatisticsModel(QmlProfilerModelManager *
|
|||||||
QObject(parent), d(new QmlProfilerStatisticsModelPrivate)
|
QObject(parent), d(new QmlProfilerStatisticsModelPrivate)
|
||||||
{
|
{
|
||||||
d->modelManager = modelManager;
|
d->modelManager = modelManager;
|
||||||
d->callStack.push(QmlEvent());
|
|
||||||
d->compileStack.push(QmlEvent());
|
|
||||||
connect(modelManager, &QmlProfilerModelManager::stateChanged,
|
connect(modelManager, &QmlProfilerModelManager::stateChanged,
|
||||||
this, &QmlProfilerStatisticsModel::dataChanged);
|
this, &QmlProfilerStatisticsModel::dataChanged);
|
||||||
connect(modelManager->notesModel(), &Timeline::TimelineNotesModel::changed,
|
connect(modelManager->notesModel(), &Timeline::TimelineNotesModel::changed,
|
||||||
@@ -142,8 +140,6 @@ void QmlProfilerStatisticsModel::clear()
|
|||||||
d->notes.clear();
|
d->notes.clear();
|
||||||
d->callStack.clear();
|
d->callStack.clear();
|
||||||
d->compileStack.clear();
|
d->compileStack.clear();
|
||||||
d->callStack.push(QmlEvent());
|
|
||||||
d->compileStack.push(QmlEvent());
|
|
||||||
d->qmlTime = 0;
|
d->qmlTime = 0;
|
||||||
d->lastEndTime = 0;
|
d->lastEndTime = 0;
|
||||||
d->durations.clear();
|
d->durations.clear();
|
||||||
@@ -215,7 +211,7 @@ void QmlProfilerStatisticsModel::loadEvent(const QmlEvent &event, const QmlEvent
|
|||||||
case RangeStart:
|
case RangeStart:
|
||||||
// binding loop detection: check whether event is already in stack
|
// binding loop detection: check whether event is already in stack
|
||||||
if (type.rangeType() == Binding || type.rangeType() == HandlingSignal) {
|
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()) {
|
if (stack.at(ii).typeIndex() == event.typeIndex()) {
|
||||||
d->eventsInBindingLoop.insert(event.typeIndex());
|
d->eventsInBindingLoop.insert(event.typeIndex());
|
||||||
break;
|
break;
|
||||||
@@ -246,7 +242,7 @@ void QmlProfilerStatisticsModel::loadEvent(const QmlEvent &event, const QmlEvent
|
|||||||
|
|
||||||
stack.pop();
|
stack.pop();
|
||||||
|
|
||||||
if (stack.count() > 1)
|
if (!stack.isEmpty())
|
||||||
d->data[stack.top().typeIndex()].durationSelf -= duration;
|
d->data[stack.top().typeIndex()].durationSelf -= duration;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user