0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

report: simplify heap space iteration

PR-URL: https://github.com/nodejs/node/pull/26285
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
cjihrig 2019-02-24 11:47:12 -05:00
parent c2b180fcbb
commit 084f74a304
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -447,8 +447,7 @@ static void PrintGCStatistics(JSONWriter* writer, Isolate* isolate) {
writer->json_objectstart("heapSpaces");
// Loop through heap spaces
size_t i;
for (i = 0; i < isolate->NumberOfHeapSpaces() - 1; i++) {
for (size_t i = 0; i < isolate->NumberOfHeapSpaces(); i++) {
isolate->GetHeapSpaceStatistics(&v8_heap_space_stats, i);
writer->json_objectstart(v8_heap_space_stats.space_name());
writer->json_keyvalue("memorySize", v8_heap_space_stats.space_size());
@ -464,19 +463,7 @@ static void PrintGCStatistics(JSONWriter* writer, Isolate* isolate) {
"available", v8_heap_space_stats.space_available_size());
writer->json_objectend();
}
isolate->GetHeapSpaceStatistics(&v8_heap_space_stats, i);
writer->json_objectstart(v8_heap_space_stats.space_name());
writer->json_keyvalue("memorySize", v8_heap_space_stats.space_size());
writer->json_keyvalue(
"committedMemory", v8_heap_space_stats.physical_space_size());
writer->json_keyvalue(
"capacity",
v8_heap_space_stats.space_used_size() +
v8_heap_space_stats.space_available_size());
writer->json_keyvalue("used", v8_heap_space_stats.space_used_size());
writer->json_keyvalue(
"available", v8_heap_space_stats.space_available_size());
writer->json_objectend();
writer->json_objectend();
writer->json_objectend();
}