From 1de6e7b8e0ee465f642e1b2f5a14611e52a7e8c2 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 3 Sep 2014 19:28:35 +0200 Subject: Select specific features to be recorded when profiling QML Some features, like the memory profiler, create huge amounts of data. Often enough, we're not actually interested in all the data available from the profiler and collecting it all can lead to excessive memory consumption. This change enables us to optionally turn various aspects of QML profiling off. Task-number: QTBUG-41118 Change-Id: I7bb223414e24eb903124ffa6e0896af6ce974e49 Reviewed-by: Gunnar Sletta --- src/quick/util/qquickprofiler_p.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/quick/util/qquickprofiler_p.h') diff --git a/src/quick/util/qquickprofiler_p.h b/src/quick/util/qquickprofiler_p.h index 3aba3430e4..62e23cd393 100644 --- a/src/quick/util/qquickprofiler_p.h +++ b/src/quick/util/qquickprofiler_p.h @@ -54,18 +54,21 @@ QT_BEGIN_NAMESPACE -#define Q_QUICK_PROFILE_IF_ENABLED(Code)\ - if (QQuickProfiler::enabled) {\ +#define Q_QUICK_PROFILE_IF_ENABLED(feature, Code)\ + if (QQuickProfiler::featuresEnabled & (1 << feature)) {\ Code;\ } else\ (void)0 -#define Q_QUICK_PROFILE(Method)\ - Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::Method) +#define Q_QUICK_PROFILE(feature, Method)\ + Q_QUICK_PROFILE_IF_ENABLED(feature, QQuickProfiler::Method) #define Q_QUICK_SG_PROFILE(Type, Params)\ - Q_QUICK_PROFILE_IF_ENABLED((QQuickProfiler::sceneGraphFrame Params)) + Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\ + (QQuickProfiler::sceneGraphFrame Params)) +#define Q_QUICK_INPUT_PROFILE(Method)\ + Q_QUICK_PROFILE(QQuickProfiler::ProfileInputEvents, Method) // This struct is somewhat dangerous to use: // You can save values either with 32 or 64 bit precision. toByteArrays will @@ -196,7 +199,11 @@ public: qint64 sendMessages(qint64 until, QList &messages); - static bool enabled; + static quint64 featuresEnabled; + static bool profilingSceneGraph() + { + return featuresEnabled & (1 << QQuickProfiler::ProfileSceneGraph); + } static void initialize(); @@ -218,7 +225,7 @@ protected: } protected slots: - void startProfilingImpl(); + void startProfilingImpl(quint64 features); void stopProfilingImpl(); void reportDataImpl(); void setTimer(const QElapsedTimer &t); -- cgit v1.2.3