Skip to content

Commit

Permalink
report: simplify heap space iteration
Browse files Browse the repository at this point in the history
PR-URL: #26285
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
cjihrig authored and addaleax committed Mar 1, 2019
1 parent 88256d7 commit d2d9453
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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();
}
Expand Down

0 comments on commit d2d9453

Please sign in to comment.