summaryrefslogtreecommitdiff
path: root/rts/sm/GC.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2016-11-25 16:45:43 +0000
committerSimon Marlow <marlowsd@gmail.com>2016-12-06 15:25:50 +0000
commit24e6594cc7890babe69b8ba122d171affabad2d1 (patch)
tree0efef02a3e03787e9e6ee9822cb20efc7d48fec5 /rts/sm/GC.c
parenteec02ab7c8433465cc8d6be0a8889e7c6a222fb0 (diff)
downloadhaskell-24e6594cc7890babe69b8ba122d171affabad2d1.tar.gz
Overhaul GC stats
Summary: Visible API changes: * The C struct `GCDetails` gives the stats about a single GC. This is passed to the `gcDone()` callback if one is set via the RtsConfig. (previously we just passed a collection of values, so this is more extensible, at the expense of breaking the existing API) * `RTSStats` gives cumulative stats since the start of the program, and includes the `GCDetails` for the most recent GC. This struct can be obtained via `getRTSStats()` (the old `getGCStats()` has been removed, and `getGCStatsEnabled()` has been renamed to `getRTSStatsEnabled()`) Improvements: * The per-GC stats and cumulative stats are now cleanly separated. * Inside the RTS we have a top-level `RTSStats` struct to keep all our stats in, previously this was just a collection of strangely-named variables. This struct is mostly just copied in `getRTSStats()`, so the implementation of that function is a lot shorter. * Types are more consistent. We use a uint64_t byte count for all memory values, and Time for all time values. * Names are more consistent. We use a suffix `_bytes` for all byte counts and `_ns` for all time values. * We now collect information about the amount of memory in large objects and compact objects in `GCDetails`. (the latter was the reason I started doing this patch but it seems to have ballooned a bit!) * I fixed a bug in the calculation of the elapsed MUT time, and added an ASSERT to stop the calculations going wrong in the future. For now I kept the Haskell API in `GHC.Stats` the same, by impedence-matching with the new API. We could either break that API and make it match the C API more closely, or we could add a new API and deprecate the old one. Opinions welcome. This stuff is very easy to get wrong, and it's hard to test. Reviews welcome! Test Plan: manual testing validate Reviewers: bgamari, niteria, austin, ezyang, hvr, erikd, rwbarton, Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2756
Diffstat (limited to 'rts/sm/GC.c')
-rw-r--r--rts/sm/GC.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index ea80d6dec1..c41c9791dc 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -187,7 +187,7 @@ GarbageCollect (uint32_t collect_gen,
{
bdescr *bd;
generation *gen;
- StgWord live_blocks, live_words, par_max_copied, par_tot_copied;
+ StgWord live_blocks, live_words, par_max_copied;
#if defined(THREADED_RTS)
gc_thread *saved_gct;
#endif
@@ -459,7 +459,6 @@ GarbageCollect (uint32_t collect_gen,
copied = 0;
par_max_copied = 0;
- par_tot_copied = 0;
{
uint32_t i;
for (i=0; i < n_gc_threads; i++) {
@@ -474,10 +473,8 @@ GarbageCollect (uint32_t collect_gen,
copied += gc_threads[i]->copied;
par_max_copied = stg_max(gc_threads[i]->copied, par_max_copied);
}
- par_tot_copied = copied;
if (n_gc_threads == 1) {
par_max_copied = 0;
- par_tot_copied = 0;
}
}
@@ -773,7 +770,7 @@ GarbageCollect (uint32_t collect_gen,
// ok, GC over: tell the stats department what happened.
stat_endGC(cap, gct, live_words, copied,
live_blocks * BLOCK_SIZE_W - live_words /* slop */,
- N, n_gc_threads, par_max_copied, par_tot_copied);
+ N, n_gc_threads, par_max_copied);
#if defined(RTS_USER_SIGNALS)
if (RtsFlags.MiscFlags.install_signal_handlers) {