QML_RENDER_TIMING: Add time since last frame to output
authorThomas McGuire <thomas.mcguire.qnx@kdab.com>
Fri, 7 Sep 2012 10:42:39 +0000 (12:42 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 10 Sep 2012 12:24:05 +0000 (14:24 +0200)
This is quite useful to see how much time the rest of the app takes.
The same information has been available in QtQuick1.

Change-Id: I31ae91bfa764a4d8013af80de9459514ed72314f
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
src/quick/items/qquickthreadedwindowmanager.cpp
src/quick/items/qquickwindowmanager.cpp

index 3d480ce..653192b 100644 (file)
@@ -476,10 +476,14 @@ void QQuickRenderThreadSingleContextWindowManager::run()
 
 #ifdef QQUICK_RENDER_TIMING
             if (qquick_render_timing()) {
+                static QTime lastFrameTime = QTime::currentTime();
                 swapTime = threadTimer.elapsed() - renderTime;
                 qDebug() << "- Breakdown of frame time; sync:" << syncTime
                          << "ms render:" << renderTime << "ms swap:" << swapTime
-                         << "ms total:" << swapTime + renderTime << "ms";
+                         << "ms total:" << swapTime + renderTime
+                         << "ms time since last frame:" << (lastFrameTime.msecsTo(QTime::currentTime()))
+                         << "ms";
+                lastFrameTime = QTime::currentTime();
             }
 #endif
 
index 930e2a9..d864d72 100644 (file)
@@ -261,10 +261,14 @@ void QQuickTrivialWindowManager::renderWindow(QQuickWindow *window)
     }
 
     if (qquick_render_timing()) {
+        static QTime lastFrameTime = QTime::currentTime();
         const int swapTime = renderTimer.elapsed() - renderTime;
         qDebug() << "- Breakdown of frame time; sync:" << syncTime
                  << "ms render:" << renderTime << "ms swap:" << swapTime
-                 << "ms total:" << swapTime + renderTime << "ms";
+                 << "ms total:" << swapTime + renderTime
+                 << "ms time since last frame:" << (lastFrameTime.msecsTo(QTime::currentTime()))
+                 << "ms";
+        lastFrameTime = QTime::currentTime();
     }
 
     // Might have been set during syncSceneGraph()