diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-04-21 16:57:10 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-05-02 09:03:20 +0000 |
commit | a2e64a20777867726b51a9c9196dc1b8dd68f512 (patch) | |
tree | 3c0462e5b5db214c42f58e3bd6d5e48ae9cc2eed /src/qml/jsruntime/qv4profiling_p.h | |
parent | d93daba909d0aeb8a32fe3b0e0a7145b60d77531 (diff) |
V4 profiler: Don't duplicate function locations
Saving the name/file/line/column over and over for each function call
is wasteful. We can instead key them by the pointer to the JS Function
object. Also, make sure we don't accidentally detach the data when
sending messages.
Task-number: QTBUG-52937
Change-Id: I8a03e4003dc3239f88b49c56424df05cd8b9ef8a
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4profiling_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4profiling_p.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h index 25ef8223bf..0b4193204f 100644 --- a/src/qml/jsruntime/qv4profiling_p.h +++ b/src/qml/jsruntime/qv4profiling_p.h @@ -77,12 +77,18 @@ enum MemoryType { struct FunctionCallProperties { qint64 start; qint64 end; + quintptr id; +}; + +struct FunctionLocation { QString name; QString file; int line; int column; }; +typedef QHash<qint64, QV4::Profiling::FunctionLocation> FunctionLocationHash; + struct MemoryAllocationProperties { qint64 timestamp; qint64 size; @@ -118,7 +124,8 @@ public: return *this; } - FunctionCallProperties resolve() const; + FunctionLocation resolveLocation() const; + FunctionCallProperties properties() const; private: friend bool operator<(const FunctionCall &call1, const FunctionCall &call2); @@ -173,7 +180,8 @@ public slots: void setTimer(const QElapsedTimer &timer) { m_timer = timer; } signals: - void dataReady(const QVector<QV4::Profiling::FunctionCallProperties> &, + void dataReady(const QV4::Profiling::FunctionLocationHash &, + const QVector<QV4::Profiling::FunctionCallProperties> &, const QVector<QV4::Profiling::MemoryAllocationProperties> &); private: @@ -218,8 +226,10 @@ public: Q_DECLARE_TYPEINFO(QV4::Profiling::MemoryAllocationProperties, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(QV4::Profiling::FunctionCallProperties, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(QV4::Profiling::FunctionCall, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(QV4::Profiling::FunctionLocation, Q_MOVABLE_TYPE); QT_END_NAMESPACE +Q_DECLARE_METATYPE(QV4::Profiling::FunctionLocationHash) Q_DECLARE_METATYPE(QVector<QV4::Profiling::FunctionCallProperties>) Q_DECLARE_METATYPE(QVector<QV4::Profiling::MemoryAllocationProperties>) |