diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-03-07 16:20:23 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-18 12:02:39 +0100 |
commit | 5977fbfd16f4d2d268dfecc48b1120a1f0dcf004 (patch) | |
tree | a7a744047668acfa5ba2e9d2ced8184d1ab85b3c /src/quick/util/qquickprofiler_p.h | |
parent | b456fb1a11302557ac51ac47c635ba993d1653a3 (diff) |
Register animation profiler callback also from render thread
The QUnifiedTimer in the GUI thread doesn't cover the render thread
animations. We need a separate registration for those. We also need
to keep track of which animation events are coming from which
threads.
Task-number: QTCREATORBUG-11659
Change-Id: I1fdd80a5630cc6a33e527b99be7347f3bd63510f
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/quick/util/qquickprofiler_p.h')
-rw-r--r-- | src/quick/util/qquickprofiler_p.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/quick/util/qquickprofiler_p.h b/src/quick/util/qquickprofiler_p.h index 721560b9e5..03cef951b5 100644 --- a/src/quick/util/qquickprofiler_p.h +++ b/src/quick/util/qquickprofiler_p.h @@ -95,9 +95,9 @@ struct Q_AUTOTEST_EXPORT QQuickProfilerData framerate(framerate), count(count) {} QQuickProfilerData(qint64 time, int messageType, int detailType, int framerate = 0, - int count = 0) : + int count = 0, int threadId = 0) : time(time), messageType(messageType), detailType(detailType), framerate(framerate), - count(count) {} + count(count), threadId(threadId) {} // Special ctor for scenegraph frames. Note that it's missing the QString/QUrl params. // This is slightly ugly, but makes it easier to disambiguate between int and qint64 params. @@ -133,7 +133,10 @@ struct Q_AUTOTEST_EXPORT QQuickProfilerData int count; //used by animation events and for pixmaps }; - qint64 subtime_5; + union { + qint64 subtime_5; + int threadId; + }; void toByteArrays(QList<QByteArray> &messages) const; }; @@ -144,6 +147,11 @@ class Q_QUICK_PRIVATE_EXPORT QQuickProfiler : public QQmlAbstractProfilerAdapter Q_OBJECT public: + enum AnimationThread { + GuiThread, + RenderThread + }; + template<EventType DetailType> static void addEvent() { @@ -151,13 +159,14 @@ public: 1 << DetailType)); } - static void animationFrame(qint64 delta) + static void animationFrame(qint64 delta, AnimationThread threadId) { int animCount = QUnifiedTimer::instance()->runningAnimationCount(); if (animCount > 0 && delta > 0) { s_instance->processMessage(QQuickProfilerData(s_instance->timestamp(), 1 << Event, - 1 << AnimationFrame, 1000 / (int)delta /* trim fps to integer */, animCount)); + 1 << AnimationFrame, 1000 / (int)delta /* trim fps to integer */, animCount, + threadId)); } } @@ -191,6 +200,8 @@ public: 1 << PixmapCacheEvent, 1 << CountType, url, 0, 0, 0, count)); } + static void registerAnimationCallback(); + qint64 timestamp() { return m_timer.nsecsElapsed(); } qint64 sendMessages(qint64 until, QList<QByteArray> &messages); |