QmlProfiler: Make the progress bar somewhat nicer.

Allow adding a weight to certain tasks so that the movement of the bar
gets smoother and update the progress from more places.

Change-Id: Ifb8331dc77116cc0464b3970cd6344fbbeacec41
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Ulf Hermann
2014-02-12 17:50:55 +01:00
parent 47ce17b1ba
commit abb55de9b5
6 changed files with 32 additions and 4 deletions

View File

@@ -69,6 +69,9 @@ QmlProfilerEventsModelProxy::QmlProfilerEventsModelProxy(QmlProfilerModelManager
connect(modelManager->simpleModel(), SIGNAL(changed()), this, SLOT(dataChanged()));
d->modelId = modelManager->registerModelProxy();
// We're iterating twice in loadData.
modelManager->setProxyCountWeight(d->modelId, 2);
d->acceptedTypes << QmlDebug::Compiling << QmlDebug::Creating << QmlDebug::Binding << QmlDebug::HandlingSignal << QmlDebug::Javascript;
}
@@ -211,6 +214,8 @@ void QmlProfilerEventsModelProxy::loadData(qint64 rangeStart, qint64 rangeEnd)
}
// post-process: calc mean time, median time, percentoftime
int i = d->data.size();
int total = i * 2;
foreach (const QString &hash, d->data.keys()) {
QmlEventStats* stats = &d->data[hash];
if (stats->calls > 0)
@@ -223,6 +228,7 @@ void QmlProfilerEventsModelProxy::loadData(qint64 rangeStart, qint64 rangeEnd)
}
stats->percentOfTime = stats->duration * 100.0 / qmlTime;
d->modelManager->modelProxyCountUpdated(d->modelId, i++, total);
}
// set binding loop flag