diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-08-31 18:04:47 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-09-10 15:56:35 +0000 |
commit | de2f5d2bc11a71fe12fcc4c08fff9bf59571db36 (patch) | |
tree | 7e67a981ab3d8e7c2670478e6e13900ce6baad6b /tests | |
parent | bf07bdcdf97473f1239ff965c7de795ec6caca42 (diff) |
Qml Preview: Record more detailed frame statistics
Just the number of frames per second doesn't tell us the reason for any
low frame rates. The problem could either be GPU-bound, and rendering
could take very long, or the problem could be CPU-bound, with
synchronizing or the gap between frames being very long.
Reporting the rendering and synchronization times in more detail gives
the client an idea of what is actually going on.
Change-Id: Ib2840a9e1aa9b9738e967730c668769946659be2
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp index 14254d9725..b4f8f389cf 100644 --- a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp +++ b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp @@ -57,7 +57,7 @@ private: QStringList m_filesNotFound; QStringList m_directories; QStringList m_serviceErrors; - quint16 m_frames = 0; + QQmlPreviewClient::FpsInfo m_frameStats; private slots: void cleanup() final; @@ -105,8 +105,9 @@ QList<QQmlDebugClient *> tst_QQmlPreview::createClients() QObject::connect(m_client, &QQmlPreviewClient::error, this, [this](const QString &error) { m_serviceErrors.append(error); }); - QObject::connect(m_client, &QQmlPreviewClient::fps, this, [this](quint16 frames) { - m_frames += frames; + QObject::connect(m_client, &QQmlPreviewClient::fps, + this, [this](const QQmlPreviewClient::FpsInfo &info) { + m_frameStats = info; }); return QList<QQmlDebugClient *>({m_client}); @@ -141,7 +142,7 @@ void tst_QQmlPreview::cleanup() m_files.clear(); m_filesNotFound.clear(); m_serviceErrors.clear(); - m_frames = 0; + m_frameStats = QQmlPreviewClient::FpsInfo(); } void tst_QQmlPreview::connect() @@ -336,10 +337,19 @@ void tst_QQmlPreview::fps() QCOMPARE(startQmlProcess(file), ConnectSuccess); QVERIFY(m_client); m_client->triggerLoad(testFileUrl(file)); - if (QGuiApplication::platformName() != "offscreen") - QTRY_VERIFY(m_frames > 100); - else + if (QGuiApplication::platformName() != "offscreen") { + QTRY_VERIFY(m_frameStats.numSyncs > 10); + QVERIFY(m_frameStats.minSync <= m_frameStats.maxSync); + QVERIFY(m_frameStats.totalSync / m_frameStats.numSyncs >= m_frameStats.minSync - 1); + QVERIFY(m_frameStats.totalSync / m_frameStats.numSyncs <= m_frameStats.maxSync); + + QVERIFY(m_frameStats.numRenders > 0); + QVERIFY(m_frameStats.minRender <= m_frameStats.maxRender); + QVERIFY(m_frameStats.totalRender / m_frameStats.numRenders >= m_frameStats.minRender - 1); + QVERIFY(m_frameStats.totalRender / m_frameStats.numRenders <= m_frameStats.maxRender); + } else { QSKIP("offscreen rendering doesn't produce any frames"); + } } void tst_QQmlPreview::language() |