QmlProfiler: Add another data state "ClearingData"

This allows us to steer the timeline models in a more fine grained
way and avoid duplicate processing of the same data. We don't need
to rebuild everything on stateChanged of the model manager then.

Task-number: QTCREATORBUG-10950
Change-Id: I2aa9a96a33c602f062fc3b644ac06280ba7cd45a
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Ulf Hermann
2013-12-09 12:11:48 +01:00
parent 210e780cc3
commit 5c7509dd09
6 changed files with 11 additions and 4 deletions

View File

@@ -41,7 +41,6 @@ void AbstractTimelineModel::setModelManager(QmlProfilerModelManager *modelManage
{ {
m_modelManager = modelManager; m_modelManager = modelManager;
connect(modelManager->simpleModel(),SIGNAL(changed()),this,SLOT(dataChanged())); connect(modelManager->simpleModel(),SIGNAL(changed()),this,SLOT(dataChanged()));
connect(modelManager,SIGNAL(stateChanged()),this,SLOT(dataChanged()));
m_modelId = modelManager->registerModelProxy(); m_modelId = modelManager->registerModelProxy();
} }
@@ -85,7 +84,7 @@ void AbstractTimelineModel::dataChanged()
case QmlProfilerDataState::ProcessingData: case QmlProfilerDataState::ProcessingData:
loadData(); loadData();
break; break;
case QmlProfilerDataState::Empty: case QmlProfilerDataState::ClearingData:
clear(); clear();
break; break;
default: default:

View File

@@ -99,7 +99,7 @@ void QmlProfilerEventsModelProxy::dataChanged()
if (d->modelManager->state() == QmlProfilerDataState::ProcessingData) if (d->modelManager->state() == QmlProfilerDataState::ProcessingData)
loadData(); loadData();
if (d->modelManager->state() == QmlProfilerDataState::Empty) if (d->modelManager->state() == QmlProfilerDataState::ClearingData)
clear(); clear();
} }

View File

@@ -57,6 +57,9 @@ void QmlProfilerDataState::setState(QmlProfilerDataState::State state)
return; return;
switch (state) { switch (state) {
case ClearingData:
QTC_ASSERT(m_state == Done || m_state == Empty, /**/);
break;
case Empty: case Empty:
// if it's not empty, complain but go on // if it's not empty, complain but go on
QTC_ASSERT(m_modelManager->isEmpty(), /**/); QTC_ASSERT(m_modelManager->isEmpty(), /**/);
@@ -345,6 +348,7 @@ QmlProfilerDataState::State QmlProfilerModelManager::state() const
void QmlProfilerModelManager::clear() void QmlProfilerModelManager::clear()
{ {
setState(QmlProfilerDataState::ClearingData);
for (int i = 0; i < d->partialCounts.count(); i++) for (int i = 0; i < d->partialCounts.count(); i++)
d->partialCounts[i] = 0; d->partialCounts[i] = 0;
d->progress = 0; d->progress = 0;

View File

@@ -52,6 +52,7 @@ public:
Empty, Empty,
AcquiringData, AcquiringData,
ProcessingData, ProcessingData,
ClearingData,
Done Done
}; };

View File

@@ -522,6 +522,8 @@ void QmlProfilerTool::profilerDataModelStateChanged()
{ {
switch (d->m_profilerModelManager->state()) { switch (d->m_profilerModelManager->state()) {
case QmlProfilerDataState::Empty : case QmlProfilerDataState::Empty :
break;
case QmlProfilerDataState::ClearingData :
clearDisplay(); clearDisplay();
break; break;
case QmlProfilerDataState::AcquiringData : case QmlProfilerDataState::AcquiringData :

View File

@@ -474,7 +474,8 @@ void QmlProfilerTraceView::setAppKilled()
void QmlProfilerTraceView::profilerDataModelStateChanged() void QmlProfilerTraceView::profilerDataModelStateChanged()
{ {
switch (d->m_modelManager->state()) { switch (d->m_modelManager->state()) {
case QmlProfilerDataState::Empty: case QmlProfilerDataState::Empty: break;
case QmlProfilerDataState::ClearingData:
emit enableToolbar(false); emit enableToolbar(false);
break; break;
case QmlProfilerDataState::AcquiringData: break; case QmlProfilerDataState::AcquiringData: break;