diff options
author | Gareth Ellis <gareth.ellis@uk.ibm.com> | 2016-09-17 10:52:26 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2016-11-20 02:23:00 +0100 |
commit | 440057eae048821fb8ae11313663de4fcced2cfd (patch) | |
tree | a645382f6a4728830647ad2b82bf32e4c6079911 /lib/v8.js | |
parent | 31dac410a43455a6facbf2a573bcd792a63ba0ca (diff) | |
download | node-new-440057eae048821fb8ae11313663de4fcced2cfd.tar.gz |
src: extend `HeapStatistics` with new fields
src: Add does_zap_garbage, malloced_memory and
peak_malloced_memory to v8 HeapStatistics
Following https://github.com/nodejs/code-and-learn/issues/56 I
have exposed does_zap_garbage to HeapStatistics.
The other fields, malloced_memory and peak_malloced_memory don't
seem to be in the current version of v8 in master.
PR-URL: https://github.com/nodejs/node/pull/8610
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'lib/v8.js')
-rw-r--r-- | lib/v8.js | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -25,6 +25,9 @@ const kTotalPhysicalSizeIndex = v8binding.kTotalPhysicalSizeIndex; const kTotalAvailableSize = v8binding.kTotalAvailableSize; const kUsedHeapSizeIndex = v8binding.kUsedHeapSizeIndex; const kHeapSizeLimitIndex = v8binding.kHeapSizeLimitIndex; +const kDoesZapGarbageIndex = v8binding.kDoesZapGarbageIndex; +const kMallocedMemoryIndex = v8binding.kMallocedMemoryIndex; +const kPeakMallocedMemoryIndex = v8binding.kPeakMallocedMemoryIndex; // Properties for heap space statistics buffer extraction. const heapSpaceStatisticsBuffer = @@ -49,7 +52,10 @@ exports.getHeapStatistics = function() { 'total_physical_size': buffer[kTotalPhysicalSizeIndex], 'total_available_size': buffer[kTotalAvailableSize], 'used_heap_size': buffer[kUsedHeapSizeIndex], - 'heap_size_limit': buffer[kHeapSizeLimitIndex] + 'heap_size_limit': buffer[kHeapSizeLimitIndex], + 'malloced_memory': buffer[kMallocedMemoryIndex], + 'peak_malloced_memory': buffer[kPeakMallocedMemoryIndex], + 'does_zap_garbage': buffer[kDoesZapGarbageIndex] }; }; |