diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-06-12 14:33:05 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-12 18:13:45 +0200 |
commit | 4d68155848723a863e59d2ce99142b56c75ab3c6 (patch) | |
tree | 9471400f4f33c8aaa160f311874027f56606bc35 /src/qml/jsruntime/qv4profiling.cpp | |
parent | 841f3e6ff78871e5d7fc90666f12756210c7435e (diff) |
Properly initialize heap profiler when starting profiling
Change-Id: Ia994464b2150dc9a9185280ae0e2f8c615393310
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4profiling.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4profiling.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4profiling.cpp b/src/qml/jsruntime/qv4profiling.cpp index f1c70c6b33..b70e9de1a0 100644 --- a/src/qml/jsruntime/qv4profiling.cpp +++ b/src/qml/jsruntime/qv4profiling.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qv4profiling_p.h" +#include "qv4mm_p.h" QT_BEGIN_NAMESPACE @@ -60,7 +61,7 @@ FunctionCallProperties FunctionCall::resolve() const } -Profiler::Profiler() : enabled(false) +Profiler::Profiler(QV4::ExecutionEngine *engine) : enabled(false), m_engine(engine) { static int metatype = qRegisterMetaType<QList<QV4::Profiling::FunctionCallProperties> >(); static int metatype2 = qRegisterMetaType<QList<QV4::Profiling::MemoryAllocationProperties> >(); @@ -96,6 +97,22 @@ void Profiler::startProfiling() { if (!enabled) { m_data.clear(); + m_memory_data.clear(); + + qint64 timestamp = m_timer.nsecsElapsed(); + MemoryAllocationProperties heap = {timestamp, + (qint64)m_engine->memoryManager->getAllocatedMem(), + HeapPage}; + m_memory_data.append(heap); + MemoryAllocationProperties small = {timestamp, + (qint64)m_engine->memoryManager->getUsedMem(), + SmallItem}; + m_memory_data.append(small); + MemoryAllocationProperties large = {timestamp, + (qint64)m_engine->memoryManager->getLargeItemsMem(), + LargeItem}; + m_memory_data.append(large); + enabled = true; } } |