@@ -162,11 +162,30 @@ let main unix argv ppf ~flambda2 =
162
162
if ! Flambda_backend_flags. gc_timings then begin
163
163
let minor = Gc_timings. gc_minor_ns () in
164
164
let major = Gc_timings. gc_major_ns () in
165
+ let stats = Gc. quick_stat () in
165
166
let secs x = x *. 1e-9 in
166
167
let precision = ! Clflags. timings_precision in
168
+ let w2b n = n * (Sys. word_size / 8 ) in
169
+ let fw2b x = w2b (Float. to_int x) in
167
170
Format. fprintf Format. std_formatter " %0.*fs gc\n " precision (secs (minor +. major));
168
171
Format. fprintf Format. std_formatter " %0.*fs minor\n " precision (secs minor);
169
- Format. fprintf Format. std_formatter " %0.*fs major\n " precision (secs major)
172
+ Format. fprintf Format. std_formatter " %0.*fs major\n " precision (secs major);
173
+ Format. fprintf Format. std_formatter " - heap\n " ;
174
+ (* Having minor + major + promoted = total alloc make more sense for
175
+ hierarchical stats. *)
176
+ Format. fprintf Format. std_formatter " %ib alloc\n "
177
+ (fw2b stats.minor_words + (fw2b stats.major_words - fw2b stats.promoted_words));
178
+ Format. fprintf Format. std_formatter " %ib minor\n "
179
+ (fw2b stats.minor_words - fw2b stats.promoted_words);
180
+ Format. fprintf Format. std_formatter " %ib major\n "
181
+ (fw2b stats.major_words - fw2b stats.promoted_words);
182
+ Format. fprintf Format. std_formatter " %ib promoted\n "
183
+ (fw2b stats.promoted_words);
184
+ Format. fprintf Format. std_formatter " %ib top\n " (w2b stats.top_heap_words);
185
+ Format. fprintf Format. std_formatter " %i collections\n "
186
+ (stats.minor_collections + stats.major_collections);
187
+ Format. fprintf Format. std_formatter " %i minor\n " stats.minor_collections;
188
+ Format. fprintf Format. std_formatter " %i major\n " stats.major_collections;
170
189
end ;
171
190
Profile. print Format. std_formatter ! Clflags. profile_columns ~timings_precision: ! Clflags. timings_precision;
172
191
0
0 commit comments