Print total node count in -Z hir-stats

This commit is contained in:
Sam Estep 2024-11-13 23:19:47 -05:00
parent 8adb4b30f4
commit 12eaa3ab84
3 changed files with 12 additions and 5 deletions

View File

@ -126,6 +126,7 @@ impl<'k> StatCollector<'k> {
});
let total_size = nodes.iter().map(|(_, node)| node.stats.count * node.stats.size).sum();
let total_count = nodes.iter().map(|(_, node)| node.stats.count).sum();
eprintln!("{prefix} {title}");
eprintln!(
@ -167,7 +168,13 @@ impl<'k> StatCollector<'k> {
}
}
eprintln!("{prefix} ----------------------------------------------------------------");
eprintln!("{} {:<18}{:>10}", prefix, "Total", to_readable_str(total_size));
eprintln!(
"{} {:<18}{:>10} {:>14}",
prefix,
"Total",
to_readable_str(total_size),
to_readable_str(total_count),
);
eprintln!("{prefix}");
}
}

View File

@ -1,6 +1,6 @@
//@ check-pass
//@ compile-flags: -Zhir-stats
//@ only-x86_64
//@ only-64bit
// layout randomization affects the hir stat output
//@ needs-deterministic-layouts

View File

@ -53,7 +53,7 @@ ast-stats-1 - Enum 136 ( 2.0%) 1
ast-stats-1 - Fn 272 ( 4.1%) 2
ast-stats-1 - Use 408 ( 6.1%) 3
ast-stats-1 ----------------------------------------------------------------
ast-stats-1 Total 6_640
ast-stats-1 Total 6_640 116
ast-stats-1
ast-stats-2 POST EXPANSION AST STATS
ast-stats-2 Name Accumulated Size Count Item Size
@ -113,7 +113,7 @@ ast-stats-2 - ForeignMod 136 ( 1.9%) 1
ast-stats-2 - Fn 272 ( 3.7%) 2
ast-stats-2 - Use 544 ( 7.5%) 4
ast-stats-2 ----------------------------------------------------------------
ast-stats-2 Total 7_288
ast-stats-2 Total 7_288 127
ast-stats-2
hir-stats HIR STATS
hir-stats Name Accumulated Size Count Item Size
@ -174,5 +174,5 @@ hir-stats - Use 352 ( 3.9%) 4
hir-stats Path 1_240 (13.7%) 31 40
hir-stats PathSegment 1_920 (21.3%) 40 48
hir-stats ----------------------------------------------------------------
hir-stats Total 9_024
hir-stats Total 9_024 180
hir-stats