aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/debugger/qqmlprofiler_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@digia.com>2014-09-03 19:28:35 +0200
committerUlf Hermann <ulf.hermann@digia.com>2014-09-11 11:41:27 +0200
commit1de6e7b8e0ee465f642e1b2f5a14611e52a7e8c2 (patch)
tree3ac952d6e7539c0fda1fe3c9cd7f16ace849c91a /src/qml/debugger/qqmlprofiler_p.h
parent85627c26afb087975fe2e57f91837c9314d54ba7 (diff)
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 <gunnar@sletta.org>
Diffstat (limited to 'src/qml/debugger/qqmlprofiler_p.h')
-rw-r--r--src/qml/debugger/qqmlprofiler_p.h41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/qml/debugger/qqmlprofiler_p.h b/src/qml/debugger/qqmlprofiler_p.h
index 02cdbf0a4e..13e6b8ddae 100644
--- a/src/qml/debugger/qqmlprofiler_p.h
+++ b/src/qml/debugger/qqmlprofiler_p.h
@@ -56,14 +56,14 @@
QT_BEGIN_NAMESPACE
-#define Q_QML_PROFILE_IF_ENABLED(profiler, Code)\
- if (profiler && profiler->enabled) {\
+#define Q_QML_PROFILE_IF_ENABLED(feature, profiler, Code)\
+ if (profiler && (profiler->featuresEnabled & (1 << feature))) {\
Code;\
} else\
(void)0
-#define Q_QML_PROFILE(profiler, Method)\
- Q_QML_PROFILE_IF_ENABLED(profiler, profiler->Method)
+#define Q_QML_PROFILE(feature, profiler, Method)\
+ Q_QML_PROFILE_IF_ENABLED(feature, profiler, profiler->Method)
// This struct is somewhat dangerous to use:
// The messageType is a bit field. You can pack multiple messages into
@@ -162,10 +162,10 @@ public:
QQmlProfiler();
- bool enabled;
+ quint64 featuresEnabled;
public slots:
- void startProfiling();
+ void startProfiling(quint64 features);
void stopProfiling();
void reportData();
void setTimer(const QElapsedTimer &timer) { m_timer = timer; }
@@ -204,12 +204,14 @@ struct QQmlBindingProfiler : public QQmlProfilerHelper {
QQmlBindingProfiler(QQmlProfiler *profiler, const QString &url, int line, int column) :
QQmlProfilerHelper(profiler)
{
- Q_QML_PROFILE(profiler, startBinding(url, line, column));
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileBinding, profiler,
+ startBinding(url, line, column));
}
~QQmlBindingProfiler()
{
- Q_QML_PROFILE(profiler, endRange<Binding>());
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileBinding, profiler,
+ endRange<Binding>());
}
};
@@ -217,12 +219,14 @@ struct QQmlHandlingSignalProfiler : public QQmlProfilerHelper {
QQmlHandlingSignalProfiler(QQmlProfiler *profiler, QQmlBoundSignalExpression *expression) :
QQmlProfilerHelper(profiler)
{
- Q_QML_PROFILE(profiler, startHandlingSignal(expression->sourceLocation()));
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileHandlingSignal, profiler,
+ startHandlingSignal(expression->sourceLocation()));
}
~QQmlHandlingSignalProfiler()
{
- Q_QML_PROFILE(profiler, endRange<QQmlProfiler::HandlingSignal>());
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileHandlingSignal, profiler,
+ endRange<QQmlProfiler::HandlingSignal>());
}
};
@@ -230,12 +234,12 @@ struct QQmlCompilingProfiler : public QQmlProfilerHelper {
QQmlCompilingProfiler(QQmlProfiler *profiler, const QString &name) :
QQmlProfilerHelper(profiler)
{
- Q_QML_PROFILE(profiler, startCompiling(name));
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileCompiling, profiler, startCompiling(name));
}
~QQmlCompilingProfiler()
{
- Q_QML_PROFILE(profiler, endRange<Compiling>());
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileCompiling, profiler, endRange<Compiling>());
}
};
@@ -278,20 +282,20 @@ private:
QFiniteStack<Data> ranges;
};
-#define Q_QML_OC_PROFILE(profilerMember, Code)\
- Q_QML_PROFILE_IF_ENABLED(profilerMember.profiler, Code)
+#define Q_QML_OC_PROFILE(member, Code)\
+ Q_QML_PROFILE_IF_ENABLED(QQmlProfilerDefinitions::ProfileCreating, member.profiler, Code)
class QQmlObjectCreationProfiler : public QQmlVmeProfiler::Data {
public:
QQmlObjectCreationProfiler(QQmlProfiler *profiler) : profiler(profiler)
{
- Q_QML_PROFILE(profiler, startCreating());
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileCreating, profiler, startCreating());
}
~QQmlObjectCreationProfiler()
{
- Q_QML_PROFILE(profiler, endRange<QQmlProfilerDefinitions::Creating>());
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileCreating, profiler, endRange<QQmlProfilerDefinitions::Creating>());
}
void update(const QString &typeName, const QUrl &url, int line, int column)
@@ -312,7 +316,7 @@ public:
QQmlObjectCompletionProfiler(QQmlVmeProfiler *parent) :
profiler(parent->profiler)
{
- Q_QML_PROFILE_IF_ENABLED(profiler, {
+ Q_QML_PROFILE_IF_ENABLED(QQmlProfilerDefinitions::ProfileCreating, profiler, {
QQmlVmeProfiler::Data data = parent->pop();
profiler->startCreating(data.m_typeName, data.m_url, data.m_line, data.m_column);
});
@@ -320,7 +324,8 @@ public:
~QQmlObjectCompletionProfiler()
{
- Q_QML_PROFILE(profiler, endRange<QQmlProfilerDefinitions::Creating>());
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileCreating, profiler,
+ endRange<QQmlProfilerDefinitions::Creating>());
}
private:
QQmlProfiler *profiler;