Skip to content

Commit

Permalink
Explain what GC numbers mean
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodigrim committed Jul 2, 2024
1 parent df493e4 commit db8fbc7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,26 @@ All
All 3 tests passed (7.25s)
```

This data is reported as per `RTSStats` fields: `allocated_bytes`, `copied_bytes`
and `max_mem_in_use_bytes`.
This data is reported as per [`GHC.Stats.RTSStats`](https://hackage.haskell.org/package/base/docs/GHC-Stats.html#t:RTSStats) fields:

* `allocated_bytes`

Total size of data ever allocated since the start
of the benchmark iteration. Even if data was immediately
garbage collected and freed, it still counts.

* `copied_bytes`

Total size of data ever copied by GC (because it was alive and kicking)
since the start of the benchmark iteration. Note that zero bytes often mean
that the benchmark was too short to trigger GC at all.

* `max_mem_in_use_bytes`

Peak size of live data since the very start of the process.
This is a global metric, it cumulatively grows and does not say much
about individual benchmarks, but rather characterizes heap
environment in which they are executed.

## Combining tests and benchmarks

Expand Down
25 changes: 23 additions & 2 deletions src/Test/Tasty/Bench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,29 @@ report memory usage:
>
> All 3 tests passed (7.25s)
This data is reported as per 'RTSStats' fields: 'allocated_bytes',
'copied_bytes' and 'max_mem_in_use_bytes'.
This data is reported as per
<https://hackage.haskell.org/package/base/docs/GHC-Stats.html#t:RTSStats GHC.Stats.RTSStats>
fields:
- 'allocated_bytes'
Total size of data ever allocated since the start of the benchmark
iteration. Even if data was immediately garbage collected and freed,
it still counts.
- 'copied_bytes'
Total size of data ever copied by GC (because it was alive and
kicking) since the start of the benchmark iteration. Note that zero
bytes often mean that the benchmark was too short to trigger GC at
all.
- 'max_mem_in_use_bytes'
Peak size of live data since the very start of the process. This is
a global metric, it cumulatively grows and does not say much about
individual benchmarks, but rather characterizes heap environment in
which they are executed.
=== Combining tests and benchmarks
Expand Down

0 comments on commit db8fbc7

Please sign in to comment.