diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-05-11 13:58:20 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-05-23 11:44:13 +0000 |
commit | 1093be042513e643fe11e364164d59f11476ba27 (patch) | |
tree | dd0f2adfc26d3ec66e4c7131dad41495992b1b9f /src/plugins/qmlprofiler | |
parent | 46e043ed1ed273b2dd8b4a000f6644c8ca1d09f1 (diff) | |
download | qt-creator-1093be042513e643fe11e364164d59f11476ba27.tar.gz |
QmlProfiler: Remove detailed progress tracking
The progress bar in the state widget was rather meaningless. We rarely
know how many events we expect and it's rather hard to tell how long
each model will take to process them. Instead, we just show a 0-ranged
progress bar to tell the user that "something is happening".
Change-Id: Icb80840d1f0a1538bcf254faa37cbb36e25d342c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler')
-rw-r--r-- | src/plugins/qmlprofiler/debugmessagesmodel.cpp | 2 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/flamegraphmodel.cpp | 7 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/inputeventsmodel.cpp | 2 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/memoryusagemodel.cpp | 3 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/pixmapcachemodel.cpp | 4 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp | 3 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp | 11 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp | 50 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilermodelmanager.h | 4 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp | 11 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp | 17 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp | 11 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp | 6 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertimelinemodel.h | 1 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp | 3 |
15 files changed, 9 insertions, 126 deletions
diff --git a/src/plugins/qmlprofiler/debugmessagesmodel.cpp b/src/plugins/qmlprofiler/debugmessagesmodel.cpp index f34ad5b1b3..f943952b7d 100644 --- a/src/plugins/qmlprofiler/debugmessagesmodel.cpp +++ b/src/plugins/qmlprofiler/debugmessagesmodel.cpp @@ -116,11 +116,9 @@ void DebugMessagesModel::loadData() MessageData(event.string(), event.typeIndex())); if (type.detailType > m_maximumMsgType) m_maximumMsgType = event.typeIndex(); - updateProgress(count(), simpleModel->events().count()); } setCollapsedRowCount(2); setExpandedRowCount(m_maximumMsgType + 2); - updateProgress(1, 1); } void DebugMessagesModel::clear() diff --git a/src/plugins/qmlprofiler/flamegraphmodel.cpp b/src/plugins/qmlprofiler/flamegraphmodel.cpp index b8bf8a7ada..101cac1b6b 100644 --- a/src/plugins/qmlprofiler/flamegraphmodel.cpp +++ b/src/plugins/qmlprofiler/flamegraphmodel.cpp @@ -50,16 +50,12 @@ FlameGraphModel::FlameGraphModel(QmlProfilerModelManager *modelManager, this, [this](int typeId, int, int){loadNotes(typeId, true);}); m_modelId = modelManager->registerModelProxy(); - // We're iterating twice in loadData. - modelManager->setProxyCountWeight(m_modelId, 2); - m_acceptedTypes << Compiling << Creating << Binding << HandlingSignal << Javascript; modelManager->announceFeatures(m_modelId, Constants::QML_JS_RANGE_FEATURES); } void FlameGraphModel::clear() { - m_modelManager->modelProxyCountUpdated(m_modelId, 0, 1); m_stackBottom = FlameGraphData(); m_typeIdsWithNotes.clear(); } @@ -134,8 +130,6 @@ void FlameGraphModel::loadData(qint64 rangeStart, qint64 rangeEnd) callStack.push(event); stackTop = pushChild(stackTop, event); - - m_modelManager->modelProxyCountUpdated(m_modelId, i, eventList.count()); } foreach (FlameGraphData *child, m_stackBottom.children) @@ -143,7 +137,6 @@ void FlameGraphModel::loadData(qint64 rangeStart, qint64 rangeEnd) loadNotes(-1, false); - m_modelManager->modelProxyCountUpdated(m_modelId, 1, 1); endResetModel(); } diff --git a/src/plugins/qmlprofiler/inputeventsmodel.cpp b/src/plugins/qmlprofiler/inputeventsmodel.cpp index 455f78b6a8..055e4259f5 100644 --- a/src/plugins/qmlprofiler/inputeventsmodel.cpp +++ b/src/plugins/qmlprofiler/inputeventsmodel.cpp @@ -162,11 +162,9 @@ void InputEventsModel::loadData() } else if (m_keyTypeId == -1) { m_keyTypeId = event.typeIndex(); } - updateProgress(count(), simpleModel->events().count()); } setCollapsedRowCount(2); setExpandedRowCount(3); - updateProgress(1, 1); } void InputEventsModel::clear() diff --git a/src/plugins/qmlprofiler/memoryusagemodel.cpp b/src/plugins/qmlprofiler/memoryusagemodel.cpp index 178a07400f..cc48c6f330 100644 --- a/src/plugins/qmlprofiler/memoryusagemodel.cpp +++ b/src/plugins/qmlprofiler/memoryusagemodel.cpp @@ -217,8 +217,6 @@ void MemoryUsageModel::loadData() m_data.insert(currentJSHeapIndex, allocation); } } - - updateProgress(count(), simpleModel->events().count()); } if (currentJSHeapIndex != -1) @@ -232,7 +230,6 @@ void MemoryUsageModel::loadData() computeNesting(); setExpandedRowCount(3); setCollapsedRowCount(3); - updateProgress(1, 1); } void MemoryUsageModel::clear() diff --git a/src/plugins/qmlprofiler/pixmapcachemodel.cpp b/src/plugins/qmlprofiler/pixmapcachemodel.cpp index 37392181d1..384ebe975b 100644 --- a/src/plugins/qmlprofiler/pixmapcachemodel.cpp +++ b/src/plugins/qmlprofiler/pixmapcachemodel.cpp @@ -397,8 +397,6 @@ void PixmapCacheModel::loadData() default: break; } - - updateProgress(count(), 2 * simpleModel->events().count()); } if (lastCacheSizeEvent != -1) @@ -410,8 +408,6 @@ void PixmapCacheModel::loadData() computeMaxCacheSize(); flattenLoads(); computeNesting(); - - updateProgress(1, 1); } void PixmapCacheModel::clear() diff --git a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp index a9cece7fdd..ddad50220b 100644 --- a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp @@ -110,14 +110,11 @@ void QmlProfilerAnimationsModel::loadData() m_maxRenderThreadAnimations); minNextStartTimes[lastThread] = event.timestamp() + 1; - - updateProgress(count(), referenceList.count()); } computeNesting(); setExpandedRowCount((m_maxGuiThreadAnimations == 0 || m_maxRenderThreadAnimations == 0) ? 2 : 3); setCollapsedRowCount(expandedRowCount()); - updateProgress(1, 1); } int QmlProfilerAnimationsModel::rowFromThreadId(int threadId) const diff --git a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp index 1f64834392..f1d368753e 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp @@ -111,9 +111,6 @@ QmlProfilerDataModel::QmlProfilerDataModel(Utils::FileInProjectFinder *fileFinde this, &QmlProfilerDataModel::detailsDone); connect(this, &QmlProfilerDataModel::requestReload, d->detailsRewriter, &QmlProfilerDetailsRewriter::reloadDocuments); - - // The document loading is very expensive. - d->modelManager->setProxyCountWeight(d->modelId, 4); } QmlProfilerDataModel::~QmlProfilerDataModel() @@ -145,8 +142,6 @@ void QmlProfilerDataModel::setData(qint64 traceStart, qint64 traceEnd, d->eventTypes = types; for (int id = 0; id < types.count(); ++id) d->eventTypeIds[types[id]] = id; - // Half the work is done. processData() will do the rest. - d->modelManager->modelProxyCountUpdated(d->modelId, 1, 2); } int QmlProfilerDataModel::count() const @@ -162,7 +157,6 @@ void QmlProfilerDataModel::clear() d->eventTypes.clear(); d->eventTypeIds.clear(); d->detailsRewriter->clearRequests(); - d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1); emit changed(); } @@ -228,7 +222,6 @@ void QmlProfilerDataModel::processData() continue; d->detailsRewriter->requestDetailsForLocation(i, event->location); - d->modelManager->modelProxyCountUpdated(d->modelId, i + n, n * 2); } // Allow changed() event only after documents have been reloaded to avoid @@ -260,9 +253,6 @@ void QmlProfilerDataModel::addEvent(Message message, RangeType rangeType, int de } d->eventList.append(eventData); - - d->modelManager->modelProxyCountUpdated(d->modelId, startTime, - d->modelManager->traceTime()->duration() * 2); } qint64 QmlProfilerDataModel::lastTimeMark() const @@ -287,7 +277,6 @@ void QmlProfilerDataModel::detailsDone() { Q_D(QmlProfilerDataModel); emit changed(); - d->modelManager->modelProxyCountUpdated(d->modelId, isEmpty() ? 0 : 1, 1); d->modelManager->processingDone(); } diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index 206fe7aa59..b194d937fb 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -132,24 +132,17 @@ public: QmlProfilerModelManager::State state; QmlProfilerTraceTime *traceTime; - QVector<double> partialCounts; - QVector<int> partialCountWeights; + int numRegisteredModels; quint64 availableFeatures; quint64 visibleFeatures; quint64 recordedFeatures; - - int totalWeight; - double progress; - double previousProgress; }; QmlProfilerModelManager::QmlProfilerModelManager(Utils::FileInProjectFinder *finder, QObject *parent) : QObject(parent), d(new QmlProfilerModelManagerPrivate) { - d->totalWeight = 0; - d->previousProgress = 0; - d->progress = 0; + d->numRegisteredModels = 0; d->availableFeatures = 0; d->visibleFeatures = 0; d->recordedFeatures = 0; @@ -184,42 +177,9 @@ bool QmlProfilerModelManager::isEmpty() const return d->model->isEmpty(); } -double QmlProfilerModelManager::progress() const -{ - return d->progress; -} - int QmlProfilerModelManager::registerModelProxy() { - d->partialCounts << 0; - d->partialCountWeights << 1; - d->totalWeight++; - return d->partialCounts.count()-1; -} - -void QmlProfilerModelManager::setProxyCountWeight(int proxyId, int weight) -{ - d->totalWeight += weight - d->partialCountWeights[proxyId]; - d->partialCountWeights[proxyId] = weight; -} - -void QmlProfilerModelManager::modelProxyCountUpdated(int proxyId, qint64 count, qint64 max) -{ - d->progress -= d->partialCounts[proxyId] * d->partialCountWeights[proxyId] / - d->totalWeight; - - if (max <= 0) - d->partialCounts[proxyId] = 1; - else - d->partialCounts[proxyId] = (double)count / (double) max; - - d->progress += d->partialCounts[proxyId] * d->partialCountWeights[proxyId] / - d->totalWeight; - - if (d->progress - d->previousProgress > 0.01) { - d->previousProgress = d->progress; - emit progressChanged(); - } + return d->numRegisteredModels++; } void QmlProfilerModelManager::announceFeatures(int proxyId, quint64 features) @@ -423,10 +383,6 @@ QmlProfilerModelManager::State QmlProfilerModelManager::state() const void QmlProfilerModelManager::clear() { setState(ClearingData); - for (int i = 0; i < d->partialCounts.count(); i++) - d->partialCounts[i] = 0; - d->progress = 0; - d->previousProgress = 0; d->model->clear(); d->traceTime->clear(); d->notesModel->clear(); diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h index f40c35b152..66f11b7317 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h @@ -90,10 +90,7 @@ public: bool isEmpty() const; - double progress() const; int registerModelProxy(); - void setProxyCountWeight(int proxyId, int weight); - void modelProxyCountUpdated(int proxyId, qint64 count, qint64 max); void announceFeatures(int proxyId, quint64 features); quint64 availableFeatures() const; quint64 visibleFeatures() const; @@ -109,7 +106,6 @@ public: signals: void error(const QString &error); void stateChanged(); - void progressChanged(); void loadFinished(); void saveFinished(); diff --git a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp index 2dc7b363b2..e79fb6b333 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp @@ -79,30 +79,19 @@ void QmlProfilerRangeModel::loadData() // store starttime-based instance m_data.insert(insert(event.timestamp(), event.duration(), event.typeIndex()), QmlRangeEventStartInstance()); - updateProgress(count(), eventList.count() * 5); } - updateProgress(1, 5); - // compute range nesting computeNesting(); - updateProgress(2, 5); - // compute nestingLevel - nonexpanded computeNestingContracted(); - updateProgress(3, 5); - // compute nestingLevel - expanded computeExpandedLevels(); - updateProgress(4, 5); - if (supportsBindingLoops()) findBindingLoops(); - - updateProgress(1, 1); } void QmlProfilerRangeModel::computeNestingContracted() diff --git a/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp b/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp index 4086e12269..cb54d1bf55 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp @@ -68,7 +68,7 @@ QmlProfilerStateWidget::QmlProfilerStateWidget(QmlProfilerStateManager *stateMan d->progressBar = new QProgressBar(this); layout->addWidget(d->progressBar); - d->progressBar->setMaximum(1000); + d->progressBar->setRange(0, 0); d->progressBar->setVisible(false); setLayout(layout); @@ -77,8 +77,6 @@ QmlProfilerStateWidget::QmlProfilerStateWidget(QmlProfilerStateManager *stateMan d->m_modelManager = modelManager; connect(d->m_modelManager, &QmlProfilerModelManager::stateChanged, this, &QmlProfilerStateWidget::updateDisplay); - connect(d->m_modelManager, &QmlProfilerModelManager::progressChanged, - this, &QmlProfilerStateWidget::updateDisplay); d->m_profilerState = stateManager; connect(d->m_profilerState, &QmlProfilerStateManager::stateChanged, this, &QmlProfilerStateWidget::updateDisplay); @@ -103,8 +101,6 @@ void QmlProfilerStateWidget::reposition() void QmlProfilerStateWidget::showText(const QString &text, bool showProgress) { setVisible(true); - if (showProgress) - d->progressBar->setValue(d->m_modelManager->progress() * 1000); d->progressBar->setVisible(showProgress); d->text->setText(text); resize(300, 70); @@ -122,26 +118,25 @@ void QmlProfilerStateWidget::updateDisplay() QmlProfilerModelManager::State state = d->m_modelManager->state(); if (state == QmlProfilerModelManager::Done || state == QmlProfilerModelManager::Empty) { // After profiling, there is an empty trace - if (d->m_modelManager->traceTime()->duration() > 0 && - (d->m_modelManager->isEmpty() || d->m_modelManager->progress() == 0)) { + if (d->m_modelManager->traceTime()->duration() > 0 && d->m_modelManager->isEmpty()) { showText(tr("No QML events recorded")); return; } - } else if (d->m_modelManager->progress() != 0 && !d->m_modelManager->isEmpty()) { + } else if (!d->m_modelManager->isEmpty()) { // When datamodel is acquiring or processing data if (state == QmlProfilerModelManager::ProcessingData) { showText(tr("Processing data"), true); - } else if (d->m_profilerState->currentState() != QmlProfilerStateManager::Idle) { + } else if (d->m_profilerState->currentState() != QmlProfilerStateManager::Idle) { if (state == QmlProfilerModelManager::AcquiringData) { // we don't know how much more, so progress numbers are strange here - showText(tr("Waiting for more data")); + showText(tr("Loading buffered data")); } else if (state == QmlProfilerModelManager::ClearingData) { // when starting a second recording from the same process without aggregation showText(tr("Clearing old trace")); } } else if (state == QmlProfilerModelManager::AcquiringData) { // Application died before all data could be read - showText(tr("Application stopped before loading all data")); + showText(tr("Loading offline data")); } else if (state == QmlProfilerModelManager::ClearingData) { showText(tr("Clearing old trace")); } diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp index c46b51d152..72a122168c 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp @@ -63,9 +63,6 @@ QmlProfilerStatisticsModel::QmlProfilerStatisticsModel(QmlProfilerModelManager * this, &QmlProfilerStatisticsModel::notesChanged); d->modelId = modelManager->registerModelProxy(); - // We're iterating twice in loadData. - modelManager->setProxyCountWeight(d->modelId, 2); - d->acceptedTypes << Compiling << Creating << Binding << HandlingSignal << Javascript; modelManager->announceFeatures(d->modelId, Constants::QML_JS_RANGE_FEATURES); @@ -106,7 +103,6 @@ const QHash<int, QString> &QmlProfilerStatisticsModel::getNotes() const void QmlProfilerStatisticsModel::clear() { - d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1); d->data.clear(); d->eventsInBindingLoop.clear(); d->notes.clear(); @@ -234,14 +230,9 @@ void QmlProfilerStatisticsModel::loadData(qint64 rangeStart, qint64 rangeEnd) if (callStack.count() > 1) d->data[callStack.top()->typeIndex()].durationSelf -= event->duration(); callStack.push(event); - - d->modelManager->modelProxyCountUpdated(d->modelId, i, eventList.count()*2); } // post-process: calc mean time, median time, percentoftime - int i = d->data.size(); - int total = i * 2; - for (QHash<int, QmlEventStats>::iterator it = d->data.begin(); it != d->data.end(); ++it) { QmlEventStats* stats = &it.value(); if (stats->calls > 0) @@ -255,7 +246,6 @@ void QmlProfilerStatisticsModel::loadData(qint64 rangeStart, qint64 rangeEnd) stats->percentOfTime = stats->duration * 100.0 / qmlTime; stats->percentSelf = stats->durationSelf * 100.0 / qmlTime; - d->modelManager->modelProxyCountUpdated(d->modelId, i++, total); } // set binding loop flag @@ -273,7 +263,6 @@ void QmlProfilerStatisticsModel::loadData(qint64 rangeStart, qint64 rangeEnd) d->data.insert(-1, rootEvent); - d->modelManager->modelProxyCountUpdated(d->modelId, 1, 1); emit dataAvailable(); } diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp index f67aeca8ec..abaf16476d 100644 --- a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp @@ -73,7 +73,6 @@ bool QmlProfilerTimelineModel::handlesTypeId(int typeIndex) const void QmlProfilerTimelineModel::clear() { TimelineModel::clear(); - updateProgress(0, 1); } QmlProfilerModelManager *QmlProfilerTimelineModel::modelManager() const @@ -81,11 +80,6 @@ QmlProfilerModelManager *QmlProfilerTimelineModel::modelManager() const return m_modelManager; } -void QmlProfilerTimelineModel::updateProgress(qint64 count, qint64 max) const -{ - m_modelManager->modelProxyCountUpdated(modelId(), count, max); -} - void QmlProfilerTimelineModel::announceFeatures(quint64 features) const { m_modelManager->announceFeatures(modelId(), features); diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h index 816db44710..14a4e5ea32 100644 --- a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h +++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h @@ -61,7 +61,6 @@ private slots: void onVisibleFeaturesChanged(quint64 features); protected: - void updateProgress(qint64 count, qint64 max) const; void announceFeatures(quint64 features) const; private: diff --git a/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp b/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp index d537c200fc..fc91143eb6 100644 --- a/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp +++ b/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp @@ -227,13 +227,10 @@ void SceneGraphTimelineModel::loadData() } default: break; } - - updateProgress(count(), simpleModel->events().count()); } computeNesting(); flattenLoads(); - updateProgress(1, 1); } void SceneGraphTimelineModel::flattenLoads() |