diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-09-17 13:34:38 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-10-30 20:07:45 +0000 |
commit | cdb0ddeffd1bab0afd4c763e44431b11c8e8e0b0 (patch) | |
tree | a131686359acd1f9bdc378fa5523a8d726397e6d /src/quick/util/qquickprofiler_p.h | |
parent | b5cd093559d71fb28c9c8e9cffc415e1aa1e7b11 (diff) |
QmlProfiler: Collect useful input events
Just "Key" or "Mouse" as only attributes of input events are not very
useful. This change adds some additional information and also collects
input events from QQuickWindow.
Change-Id: I062bbffeef3fa87776bc8be33f2321edf793faa2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/quick/util/qquickprofiler_p.h')
-rw-r--r-- | src/quick/util/qquickprofiler_p.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/quick/util/qquickprofiler_p.h b/src/quick/util/qquickprofiler_p.h index 6b6e7fa062..78216acc7d 100644 --- a/src/quick/util/qquickprofiler_p.h +++ b/src/quick/util/qquickprofiler_p.h @@ -97,8 +97,9 @@ QT_BEGIN_NAMESPACE (QQuickProfiler::reportSceneGraphFrame<Type, true>(Payload))) -#define Q_QUICK_INPUT_PROFILE(Method)\ - Q_QUICK_PROFILE(QQuickProfiler::ProfileInputEvents, Method) +#define Q_QUICK_INPUT_PROFILE(Type, DetailType, A, B)\ + Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileInputEvents,\ + (QQuickProfiler::inputEvent<Type, DetailType>(A, B))) // This struct is somewhat dangerous to use: // You can save values either with 32 or 64 bit precision. toByteArrays will @@ -117,10 +118,10 @@ struct Q_AUTOTEST_EXPORT QQuickProfilerData time(time), messageType(messageType), detailType(detailType), detailUrl(url), x(x), y(y), framerate(framerate), count(count) {} - QQuickProfilerData(qint64 time, int messageType, int detailType, int framerate = 0, - int count = 0, int threadId = 0) : - time(time), messageType(messageType), detailType(detailType), framerate(framerate), - count(count), threadId(threadId) {} + QQuickProfilerData(qint64 time, int messageType, int detailType, int framerateOrInputType = 0, + int countOrInputA = 0, int threadIdOrInputB = 0) : + time(time), messageType(messageType), detailType(detailType), + framerate(framerateOrInputType), count(countOrInputA), threadId(threadIdOrInputB) {} // 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. @@ -149,16 +150,19 @@ struct Q_AUTOTEST_EXPORT QQuickProfilerData union { qint64 subtime_3; int framerate; //used by animation events + int inputType; }; union { qint64 subtime_4; int count; //used by animation events and for pixmaps + int inputA; //used by input events }; union { qint64 subtime_5; int threadId; + int inputB; //used by input events }; void toByteArrays(QList<QByteArray> &messages) const; @@ -208,11 +212,11 @@ public: RenderThread }; - template<EventType DetailType> - static void addEvent() + template<EventType DetailType, InputEventType InputType> + static void inputEvent(int x, int y = 0) { s_instance->processMessage(QQuickProfilerData(s_instance->timestamp(), 1 << Event, - 1 << DetailType)); + 1 << DetailType, InputType, x, y)); } static void animationFrame(qint64 delta, AnimationThread threadId) |