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 /libraries/base/GHC/Stats.hsc | |
parent | 06ccad0de07026ea8128a9951f608bcc67ef23d8 (diff) | |
download | haskell-c0ba775dda6ddec1251363d1b73f4f3e35931dd9.tar.gz |
Add fragmentation statistic to GHC.Stats
Implements #21537
Diffstat (limited to 'libraries/base/GHC/Stats.hsc')
-rw-r--r-- | libraries/base/GHC/Stats.hsc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libraries/base/GHC/Stats.hsc b/libraries/base/GHC/Stats.hsc index 8504e1fff3..08e973b213 100644 --- a/libraries/base/GHC/Stats.hsc +++ b/libraries/base/GHC/Stats.hsc @@ -159,6 +159,11 @@ data GCDetails = GCDetails { , gcdetails_par_max_copied_bytes :: Word64 -- | In parallel GC, the amount of balanced data copied by all threads , gcdetails_par_balanced_copied_bytes :: Word64 + -- | The amount of memory lost due to block fragmentation in bytes. + -- Block fragmentation is the difference between the amount of blocks retained by the RTS and the blocks that are in use. + -- This occurs when megablocks are only sparsely used, eg, when data that cannot be moved retains a megablock. + -- @since 4.17.0.0 + , gcdetails_block_fragmentation_bytes :: Word64 -- | The time elapsed during synchronisation before GC , gcdetails_sync_elapsed_ns :: RtsTime -- | The CPU time used during GC itself @@ -241,6 +246,8 @@ getRTSStats = do (# peek GCDetails, par_max_copied_bytes) pgc gcdetails_par_balanced_copied_bytes <- (# peek GCDetails, par_balanced_copied_bytes) pgc + gcdetails_block_fragmentation_bytes <- + (# peek GCDetails, block_fragmentation_bytes) pgc gcdetails_sync_elapsed_ns <- (# peek GCDetails, sync_elapsed_ns) pgc gcdetails_cpu_ns <- (# peek GCDetails, cpu_ns) pgc gcdetails_elapsed_ns <- (# peek GCDetails, elapsed_ns) pgc |