diff options
author | Teo Camarasu <teofilcamarasu@gmail.com> | 2022-05-09 19:26:29 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-09-21 14:30:37 -0400 |
commit | c0ba775dda6ddec1251363d1b73f4f3e35931dd9 (patch) | |
tree | e2524d79e81d4cc40be133fd4768f2491717bee8 /rts/Stats.c | |
parent | 06ccad0de07026ea8128a9951f608bcc67ef23d8 (diff) | |
download | haskell-c0ba775dda6ddec1251363d1b73f4f3e35931dd9.tar.gz |
Add fragmentation statistic to GHC.Stats
Implements #21537
Diffstat (limited to 'rts/Stats.c')
-rw-r--r-- | rts/Stats.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/rts/Stats.c b/rts/Stats.c index 82a4e5dff5..517e6c32f2 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -182,6 +182,7 @@ initStats0(void) .copied_bytes = 0, .par_max_copied_bytes = 0, .par_balanced_copied_bytes = 0, + .block_fragmentation_bytes = 0, .sync_elapsed_ns = 0, .cpu_ns = 0, .elapsed_ns = 0, @@ -482,6 +483,9 @@ stat_endGC (Capability *cap, gc_thread *initiating_gct, W_ live, W_ copied, W_ s stats.gc.copied_bytes = copied * sizeof(W_); stats.gc.par_max_copied_bytes = par_max_copied * sizeof(W_); stats.gc.par_balanced_copied_bytes = par_balanced_copied * sizeof(W_); + stats.gc.block_fragmentation_bytes = + (mblocks_allocated * BLOCKS_PER_MBLOCK + - n_alloc_blocks) * BLOCK_SIZE; bool stats_enabled = RtsFlags.GcFlags.giveStats != NO_GC_STATS || @@ -582,9 +586,7 @@ stat_endGC (Capability *cap, gc_thread *initiating_gct, W_ live, W_ copied, W_ s stats.gc.gen, stats.gc.copied_bytes, stats.gc.slop_bytes, - /* current loss due to fragmentation */ - (mblocks_allocated * BLOCKS_PER_MBLOCK - - n_alloc_blocks) * BLOCK_SIZE, + stats.gc.block_fragmentation_bytes, par_n_threads, stats.gc.par_max_copied_bytes, stats.gc.copied_bytes, |