Skip to content

Commit d2d9453

Browse files
cjihrigaddaleax
authored andcommitted
report: simplify heap space iteration
PR-URL: #26285 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 88256d7 commit d2d9453

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/node_report.cc

+2-15
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,7 @@ static void PrintGCStatistics(JSONWriter* writer, Isolate* isolate) {
447447

448448
writer->json_objectstart("heapSpaces");
449449
// Loop through heap spaces
450-
size_t i;
451-
for (i = 0; i < isolate->NumberOfHeapSpaces() - 1; i++) {
450+
for (size_t i = 0; i < isolate->NumberOfHeapSpaces(); i++) {
452451
isolate->GetHeapSpaceStatistics(&v8_heap_space_stats, i);
453452
writer->json_objectstart(v8_heap_space_stats.space_name());
454453
writer->json_keyvalue("memorySize", v8_heap_space_stats.space_size());
@@ -464,19 +463,7 @@ static void PrintGCStatistics(JSONWriter* writer, Isolate* isolate) {
464463
"available", v8_heap_space_stats.space_available_size());
465464
writer->json_objectend();
466465
}
467-
isolate->GetHeapSpaceStatistics(&v8_heap_space_stats, i);
468-
writer->json_objectstart(v8_heap_space_stats.space_name());
469-
writer->json_keyvalue("memorySize", v8_heap_space_stats.space_size());
470-
writer->json_keyvalue(
471-
"committedMemory", v8_heap_space_stats.physical_space_size());
472-
writer->json_keyvalue(
473-
"capacity",
474-
v8_heap_space_stats.space_used_size() +
475-
v8_heap_space_stats.space_available_size());
476-
writer->json_keyvalue("used", v8_heap_space_stats.space_used_size());
477-
writer->json_keyvalue(
478-
"available", v8_heap_space_stats.space_available_size());
479-
writer->json_objectend();
466+
480467
writer->json_objectend();
481468
writer->json_objectend();
482469
}

0 commit comments

Comments
 (0)