diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-01-07 10:29:45 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-22 18:10:12 +0100 |
commit | b287ed4c4dee9d705073badc79cdb0c3e183d19b (patch) | |
tree | 3e2632d2408dc73f44e84831ec71d0d99e3dac2d /src/qml/debugger/qqmlprofilerservice_p.h | |
parent | f781d97e141632c646da09888c9612931f7c928b (diff) |
Put calls to QQmlVmeProfiler behind "if (enabled)" macros
The construction of arguments to those calls may be expensive and should
be avoided if we're not really profiling.
Task-number: QTBUG-35315
Change-Id: I558fa4cae6cf532d22193283f1ee2a3b680e2eee
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/debugger/qqmlprofilerservice_p.h')
-rw-r--r-- | src/qml/debugger/qqmlprofilerservice_p.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h index 85d515c7dd..20c023eb24 100644 --- a/src/qml/debugger/qqmlprofilerservice_p.h +++ b/src/qml/debugger/qqmlprofilerservice_p.h @@ -411,6 +411,12 @@ struct QQmlCompilingProfiler { } }; +#define Q_QML_VME_PROFILE(Method)\ + if (QQmlProfilerService::enabled)\ + Method;\ + else\ + (void)0 + struct QQmlVmeProfiler { public: @@ -427,12 +433,10 @@ public: void clear() { ranges.clear(); - if (QQmlProfilerService::enabled) { - if (running) - QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating); - for (int i = 0; i < backgroundRanges.count(); ++i) { - QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating); - } + if (running) + QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating); + for (int i = 0; i < backgroundRanges.count(); ++i) { + QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating); } backgroundRanges.clear(); running = false; @@ -440,29 +444,25 @@ public: void startBackground(const QString &typeName) { - if (QQmlProfilerService::enabled) { - if (running) { - QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating); - running = false; - } - QQmlProfilerService::instance->startRange(QQmlProfilerService::Creating, typeName); - backgroundRanges.push(typeName); + if (running) { + QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating); + running = false; } + QQmlProfilerService::instance->startRange(QQmlProfilerService::Creating, typeName); + backgroundRanges.push(typeName); } void start(const QString &typeName, const QUrl &url, int line, int column) { - if (QQmlProfilerService::enabled) { - switchRange(); - setCurrentRange(typeName, url, line, column); - QQmlProfilerService::instance->startRange(QQmlProfilerService::Creating, typeName, url, - line, column); - } + switchRange(); + setCurrentRange(typeName, url, line, column); + QQmlProfilerService::instance->startRange(QQmlProfilerService::Creating, typeName, url, + line, column); } void stop() { - if (QQmlProfilerService::enabled && running) { + if (running) { QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating); running = false; } @@ -470,7 +470,7 @@ public: void pop() { - if (QQmlProfilerService::enabled && ranges.count() > 0) { + if (ranges.count() > 0) { switchRange(); currentRange = ranges.pop(); QQmlProfilerService::instance->startRange(QQmlProfilerService::Creating, @@ -481,13 +481,13 @@ public: void push() { - if (QQmlProfilerService::enabled && running) + if (running) ranges.push(currentRange); } void foreground(const QUrl &url, int line, int column) { - if (QQmlProfilerService::enabled && backgroundRanges.count() > 0) { + if (backgroundRanges.count() > 0) { switchRange(); setCurrentRange(backgroundRanges.pop(), url, line, column); QQmlProfilerService::instance->rangeLocation( |