diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2013-11-27 12:58:13 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-29 11:35:16 +0100 |
commit | 17c8fa04ce00a332310793b0e21991ab19c74e0d (patch) | |
tree | cf4b6fff05c5c0b553ef4b03806687a6df2ab19e /src/qml/debugger/qqmlprofilerservice_p.h | |
parent | e0a0b81427f311464a9dbfcd7bf297229a6100e1 (diff) |
Add a stack-based object creation profiler
The simple instantiate-in-context way of profiling object
creation doesn't work anymore because the VME's contexts don't
necessarily map to C++ contexts anymore. The new profiler
introduces two stacks of contexts, one for currently running
ranges (such as components) and one for ranges that will be
revived later to profile componentComplete() and similar things.
Task-number: QTCREATORBUG-10631
Change-Id: Idf19b2adf062bc9c185b3bb5ff5229381f577645
Reviewed-by: Ulf Hermann <ulf.hermann@digia.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 | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h index 52a1dead09..c2e9eb421a 100644 --- a/src/qml/debugger/qqmlprofilerservice_p.h +++ b/src/qml/debugger/qqmlprofilerservice_p.h @@ -225,6 +225,7 @@ private: friend struct QQmlBindingProfiler; friend struct QQmlHandlingSignalProfiler; + friend struct QQmlVmeProfiler; friend struct QQmlCompilingProfiler; friend struct QQmlPixmapProfiler; }; @@ -298,6 +299,54 @@ struct QQmlCompilingProfiler { bool enabled; }; +struct QQmlVmeProfiler { +public: + const bool enabled; + + struct Data { + Data() : line(0), column(0) {} + QUrl url; + int line; + int column; + QString typeName; + void clear(); + }; + + QQmlVmeProfiler() : + enabled(QQmlProfilerService::instance ? QQmlProfilerService::instance->profilingEnabled() : false), + running(false) + {} + + ~QQmlVmeProfiler() + { + if (enabled) + clear(); + } + + void clear(); + + void start(const QUrl &url, int line, int column, const QString &typeName); + void start(); + void stop(); + + void updateLocation(const QUrl &url, int line, int column); + void updateTypeName(const QString &typeName); + + void pop(); + void push(); + + void background(); + void foreground(); + +private: + void switchRange(); + + Data currentRange; + QStack<Data> ranges; + QStack<Data> backgroundRanges; + bool running; +}; + struct QQmlPixmapProfiler { QQmlPixmapProfiler() { QQmlProfilerService *instance = QQmlProfilerService::instance; |