summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2010-09-08 07:17:26 (GMT)
committerGunnar Sletta <gunnar.sletta@nokia.com>2010-09-08 07:18:50 (GMT)
commit1830535a87245b611f6630dc0ce5848bfd41d075 (patch)
tree3c6ed153deb73a3e8c5887ef1f16f9d3a2015919
parent0901337e0c23910f265f0991b9fc6875efafedaf (diff)
downloadQt-1830535a87245b611f6630dc0ce5848bfd41d075.zip
Qt-1830535a87245b611f6630dc0ce5848bfd41d075.tar.gz
Qt-1830535a87245b611f6630dc0ce5848bfd41d075.tar.bz2
Add average frame timing to QDeclarativeView, ifdef'ed out.
Reviewed-by: Aaron Kennedy
-rw-r--r--src/declarative/util/qdeclarativeview.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp
index 8f06858..7b88610 100644
--- a/src/declarative/util/qdeclarativeview.cpp
+++ b/src/declarative/util/qdeclarativeview.cpp
@@ -702,6 +702,23 @@ void QDeclarativeView::paintEvent(QPaintEvent *event)
if (frameRateDebug())
qDebug() << "paintEvent:" << d->frameTimer.elapsed() << "time since last frame:" << time;
+
+#if QT_SHOW_DECLARATIVEVIEW_FPS
+ static QTime timer;
+ static int frames;
+
+ if (frames == 0) {
+ timer.start();
+ } else if (timer.elapsed() > 5000) {
+ qreal avgtime = timer.elapsed() / (qreal) frames;
+ qDebug("Average time per frame: %f ms (%i fps)", avgtime, int(1000 / avgtime));
+ timer.start();
+ frames = 0;
+ }
+ ++frames;
+ scene()->update();
+#endif
+
}
QT_END_NAMESPACE