diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-11-27 10:53:33 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-12-11 10:21:42 +0000 |
commit | 894211971ebf8b53ed3a78d771764021f7de2de6 (patch) | |
tree | b303ddc905205b72fb36b458365b61e4d460ab61 /src/qml/memory/qv4mm_p.h | |
parent | 41293196b4db1aa7a0c616af312875c484639644 (diff) |
Add logging categories for GC statistics
And use them to dump some useful information. This replaces
the old QV4_MM_STATS environment variable and introduces
the qt.qml.gc.statistics (for some stats at app exit) and
qt.qml.gc.allocatorStats (for stats on each GC run) logging
categories.
Change-Id: I0a16b25b8663aa7dbfe2adae299d3d990e8e5554
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/memory/qv4mm_p.h')
-rw-r--r-- | src/qml/memory/qv4mm_p.h | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h index e3cccb6aa0..aa8d13de8c 100644 --- a/src/qml/memory/qv4mm_p.h +++ b/src/qml/memory/qv4mm_p.h @@ -58,8 +58,6 @@ #include <private/qv4mmdefs_p.h> #include <QVector> -//#define DETAILED_MM_STATS - #define QV4_MM_MAXBLOCK_SHIFT "QV4_MM_MAXBLOCK_SHIFT" #define QV4_MM_MAX_CHUNK_SIZE "QV4_MM_MAX_CHUNK_SIZE" #define QV4_MM_STATS "QV4_MM_STATS" @@ -121,9 +119,6 @@ struct BlockAllocator { : chunkAllocator(chunkAllocator), engine(engine) { memset(freeBins, 0, sizeof(freeBins)); -#if MM_DEBUG - memset(allocations, 0, sizeof(allocations)); -#endif } enum { NumBins = 8 }; @@ -132,10 +127,6 @@ struct BlockAllocator { return nSlots >= NumBins ? NumBins - 1 : nSlots; } -#if MM_DEBUG - void stats(); -#endif - HeapItem *allocate(size_t size, bool forceAllocation = false); size_t totalSlots() const { @@ -163,9 +154,7 @@ struct BlockAllocator { ChunkAllocator *chunkAllocator; ExecutionEngine *engine; std::vector<Chunk *> chunks; -#if MM_DEBUG - uint allocations[NumBins]; -#endif + uint *allocationStats = nullptr; }; struct HugeItemAllocator { @@ -449,10 +438,6 @@ protected: Heap::Base *allocData(std::size_t size); Heap::Object *allocObjectWithMemberData(const QV4::VTable *vtable, uint nMembers); -#ifdef DETAILED_MM_STATS - void willAllocate(std::size_t size); -#endif // DETAILED_MM_STATS - private: void collectFromJSStack() const; void mark(); @@ -475,6 +460,14 @@ public: bool gcBlocked = false; bool aggressiveGC = false; bool gcStats = false; + bool gcCollectorStats = false; + + struct { + size_t maxReservedMem = 0; + size_t maxAllocatedMem = 0; + size_t maxUsedMem = 0; + uint allocations[BlockAllocator::NumBins]; + } statistics; }; } |