diff options
author | Ben Ripkens <bripkens.dev@gmail.com> | 2015-12-29 11:54:35 +0100 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2016-01-18 11:44:00 -0500 |
commit | 5f57005ec9eacbfc7855ec7c9e246f61da5a75ae (patch) | |
tree | 2daff450b026b0d18faa494888319db7d9048393 /test/parallel/test-v8-stats.js | |
parent | e65f1f7954fb364ab70063cdb374603c82f58385 (diff) | |
download | android-node-v8-5f57005ec9eacbfc7855ec7c9e246f61da5a75ae.tar.gz android-node-v8-5f57005ec9eacbfc7855ec7c9e246f61da5a75ae.tar.bz2 android-node-v8-5f57005ec9eacbfc7855ec7c9e246f61da5a75ae.zip |
v8,src: expose statistics about heap spaces
Provide means to inspect information about the separate heap spaces
via a callable API. This is helpful to analyze memory issues.
Fixes: https://github.com/nodejs/node/issues/2079
PR-URL: https://github.com/nodejs/node/pull/4463
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-v8-stats.js')
-rw-r--r-- | test/parallel/test-v8-stats.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/parallel/test-v8-stats.js b/test/parallel/test-v8-stats.js index eb5566fe2b..54140e4110 100644 --- a/test/parallel/test-v8-stats.js +++ b/test/parallel/test-v8-stats.js @@ -15,3 +15,22 @@ assert.deepEqual(Object.keys(s).sort(), keys); keys.forEach(function(key) { assert.equal(typeof s[key], 'number'); }); + + +const expectedHeapSpaces = [ + 'new_space', + 'old_space', + 'code_space', + 'map_space', + 'large_object_space' +]; +const heapSpaceStatistics = v8.getHeapSpaceStatistics(); +const actualHeapSpaceNames = heapSpaceStatistics.map(s => s.space_name); +assert.deepEqual(actualHeapSpaceNames.sort(), expectedHeapSpaces.sort()); +heapSpaceStatistics.forEach(heapSpace => { + assert.strictEqual(typeof heapSpace.space_name, 'string'); + assert.strictEqual(typeof heapSpace.space_size, 'number'); + assert.strictEqual(typeof heapSpace.space_used_size, 'number'); + assert.strictEqual(typeof heapSpace.space_available_size, 'number'); + assert.strictEqual(typeof heapSpace.physical_space_size, 'number'); +}); |