diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-05-24 11:58:07 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-05-27 09:31:08 +0000 |
commit | 515efdb8a65dc8ba22a56a02ee6d7056f39619cb (patch) | |
tree | d984f8725ca2e9b0663b33378e5fe1d13b64fa8e /src/qml/jsruntime/qv4profiling.cpp | |
parent | 777aac3005feb01aed21df9e135d5470182bc6ce (diff) |
QmlProfiler: Send RangeData and RangeLocation only once per type
This saves time when serializing the data to be sent.
Change-Id: Ic8c534d55445934a64dd253273099194b27d98af
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4profiling.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4profiling.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4profiling.cpp b/src/qml/jsruntime/qv4profiling.cpp index 72475c5416..349ec48e06 100644 --- a/src/qml/jsruntime/qv4profiling.cpp +++ b/src/qml/jsruntime/qv4profiling.cpp @@ -78,7 +78,8 @@ Profiler::Profiler(QV4::ExecutionEngine *engine) : featuresEnabled(0), m_engine( void Profiler::stopProfiling() { featuresEnabled = 0; - reportData(); + reportData(true); + m_sentLocations.clear(); } bool operator<(const FunctionCall &call1, const FunctionCall &call2) @@ -88,7 +89,7 @@ bool operator<(const FunctionCall &call1, const FunctionCall &call2) (call1.m_end == call2.m_end && call1.m_function < call2.m_function))); } -void Profiler::reportData() +void Profiler::reportData(bool trackLocations) { std::sort(m_data.begin(), m_data.end()); QVector<FunctionCallProperties> properties; @@ -97,9 +98,15 @@ void Profiler::reportData() foreach (const FunctionCall &call, m_data) { properties.append(call.properties()); - FunctionLocation &location = locations[properties.constLast().id]; - if (!location.isValid()) - location = call.resolveLocation(); + Function *function = call.function(); + SentMarker &marker = m_sentLocations[reinterpret_cast<quintptr>(function)]; + if (!trackLocations || !marker.isValid()) { + FunctionLocation &location = locations[properties.constLast().id]; + if (!location.isValid()) + location = call.resolveLocation(); + if (trackLocations) + marker.setFunction(function); + } } emit dataReady(locations, properties, m_memory_data); |