diff options
author | Douglas Wilson <douglas.wilson@gmail.com> | 2022-06-21 09:28:10 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2022-07-05 11:12:04 +0100 |
commit | b2a1f15153182c206c3358c944a58596ec223e63 (patch) | |
tree | c3ab8283ba94a9e85f69669749a975e9dcb5b0d5 | |
parent | 1d70036efbe09eff373e52cda84222b24b8579d4 (diff) | |
download | haskell-b2a1f15153182c206c3358c944a58596ec223e63.tar.gz |
rts: gc stats: account properly for copied bytes in sequential collections
We were not updating the [copied,any_work,scav_find_work, max_n_todo_overflow]
counters during sequential collections. As well, we were double counting for
parallel collections.
To fix this we add an `else` clause to the `if (is_par_gc())`.
The par_* counters do not need to be updated in the sequential case
because they must be 0.
(cherry picked from commit eb0431489144effd6931c248801af3fe65227368)
-rw-r--r-- | docs/users_guide/9.4.1-notes.rst | 3 | ||||
-rw-r--r-- | rts/sm/GC.c | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/docs/users_guide/9.4.1-notes.rst b/docs/users_guide/9.4.1-notes.rst index 8fd8374136..d24e55442a 100644 --- a/docs/users_guide/9.4.1-notes.rst +++ b/docs/users_guide/9.4.1-notes.rst @@ -222,6 +222,9 @@ Runtime system eliminating the need to pass the :ghc-flag:`-eventlog` flag to use the eventlog. This flag has been deprecated (:ghc-ticket:`18948`). +- Summary statistics, i.e. the output of :rts-flag:`-s [⟨file⟩]`, now correctly + accounts for bytes copied during sequential collections. + ``base`` library ~~~~~~~~~~~~~~~~ diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 15aef3a9fc..0116d0033f 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -170,6 +170,9 @@ is requested it takes 1, when a SYNC_GC_PAR is requested it takes n_capabilities Clearly this is in need of some tidying up, but for now we tread carefully. We call is_par_gc() to see whether we are in a parallel or sequential collection. +If we are in a parallel collection we iterate over gc_threads, being careful to +account for idle caps. If we are in a sequential collection we deal only with +the thread local gct. Of course this is valid only inside GarbageCollect (). Omitting this check has led to issues such as #19147. @@ -647,7 +650,11 @@ GarbageCollect (uint32_t collect_gen, par_balanced_copied = (par_balanced_copied_acc - copied + other_active_threads / 2) / other_active_threads; + } else { copied += gct->copied; + any_work += gct->any_work; + scav_find_work += gct->scav_find_work; + max_n_todo_overflow += gct->max_n_todo_overflow; } } |