diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-08 19:37:33 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-08 19:37:33 (GMT) |
commit | 48b5fa29f5da3c241bc64520bd56ccd5713c4586 (patch) | |
tree | 2f812d575ee1e32ac60c391129ef25517fdec68f | |
parent | e2dcc68a6c8c94d7157c6ca662d1292f1dc295a4 (diff) | |
parent | 3110c9349503c2389f6aa4bcbfb78b28966549f1 (diff) | |
download | Qt-48b5fa29f5da3c241bc64520bd56ccd5713c4586.zip Qt-48b5fa29f5da3c241bc64520bd56ccd5713c4586.tar.gz Qt-48b5fa29f5da3c241bc64520bd56ccd5713c4586.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Add average frame timing to QDeclarativeView, ifdef'ed out.
-rw-r--r-- | src/declarative/util/qdeclarativeview.cpp | 17 |
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 |