Commit 5bc6bf03 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Don't update the time display during state transitions

Previously, the display would show 0.0 while the profiler was waiting
for the application to send data. That is somewhat confusing.

Change-Id: I3ad85e5479c2cf3a65e6c4b411d959a5b15baae8
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 69377f0d
...@@ -416,12 +416,20 @@ void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber, ...@@ -416,12 +416,20 @@ void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber,
void QmlProfilerTool::updateTimeDisplay() void QmlProfilerTool::updateTimeDisplay()
{ {
double seconds = 0; double seconds = 0;
if (d->m_profilerState->serverRecording() && switch (d->m_profilerState->currentState()) {
d->m_profilerState->currentState() == QmlProfilerStateManager::AppRunning) { case QmlProfilerStateManager::AppStopRequested:
case QmlProfilerStateManager::AppDying:
return; // Transitional state: don't update the display.
case QmlProfilerStateManager::AppRunning:
if (d->m_profilerState->serverRecording()) {
seconds = d->m_recordingElapsedTime.elapsed() / 1000.0; seconds = d->m_recordingElapsedTime.elapsed() / 1000.0;
} else if (d->m_profilerModelManager->state() != QmlProfilerModelManager::Empty && break;
d->m_profilerModelManager->state() != QmlProfilerModelManager::ClearingData) { } // else fall through
seconds = d->m_profilerModelManager->traceTime()->duration() / 1.0e9; case QmlProfilerStateManager::Idle:
if (d->m_profilerModelManager->state() != QmlProfilerModelManager::Empty &&
d->m_profilerModelManager->state() != QmlProfilerModelManager::ClearingData)
seconds = d->m_profilerModelManager->traceTime()->duration() / 1.0e9;
break;
} }
QString timeString = QString::number(seconds,'f',1); QString timeString = QString::number(seconds,'f',1);
QString profilerTimeStr = QmlProfilerTool::tr("%1 s").arg(timeString, 6); QString profilerTimeStr = QmlProfilerTool::tr("%1 s").arg(timeString, 6);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment