+
+/* -----------------------------------------------------------------------------
+ stat_describe_gens
+
+ Produce some detailed info on the state of the generational GC.
+ -------------------------------------------------------------------------- */
+void
+stat_describe_gens(void)
+{
+ nat g, s, mut, lge, live;
+ StgMutClosure *m;
+ bdescr *bd;
+ step *step;
+
+ fprintf(stderr, " Gen Steps Max Mutable Step Blocks Live Large\n" " Blocks Closures Objects\n");
+
+ for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
+ for (m = generations[g].mut_list, mut = 0; m != END_MUT_LIST;
+ m = m->mut_link)
+ mut++;
+ fprintf(stderr, "%8d %8d %8d %9d", g, generations[g].n_steps,
+ generations[g].max_blocks, mut);
+
+ for (s = 0; s < generations[g].n_steps; s++) {
+ step = &generations[g].steps[s];
+ for (bd = step->large_objects, lge = 0; bd; bd = bd->link)
+ lge++;
+ live = 0;
+ for (bd = step->blocks; bd; bd = bd->link) {
+ live += (bd->free - bd->start) * sizeof(W_);
+ }
+ if (s != 0) {
+ fprintf(stderr,"%36s","");
+ }
+ fprintf(stderr,"%6d %8d %8d %8d\n", s, step->n_blocks,
+ live, lge);
+ }
+ }
+ fprintf(stderr,"\n");
+}