diff options
author | Simon Marlow <marlowsd@gmail.com> | 2014-06-09 09:18:12 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2015-04-07 09:57:49 +0100 |
commit | a7ab161602aa0b5833d22c66e64eebb1d9275235 (patch) | |
tree | 22db09216cbd2165359d8add08b5cf4cdbf5041f /rts/Stats.c | |
parent | 72092904e0ac1725c05c0447e1efe7ab541faa95 (diff) | |
download | haskell-a7ab161602aa0b5833d22c66e64eebb1d9275235.tar.gz |
Replace hooks by callbacks in RtsConfig (#8785)
Summary:
Hooks rely on static linking semantics, and are broken by -Bsymbolic
which we need when using dynamic linking.
Test Plan: Built it
Reviewers: austin, hvr, tibbe
Differential Revision: https://phabricator.haskell.org/D8
Diffstat (limited to 'rts/Stats.c')
-rw-r--r-- | rts/Stats.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/rts/Stats.c b/rts/Stats.c index d5efaa2330..71cb29c3f7 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -9,6 +9,7 @@ #include "PosixSource.h" #include "Rts.h" +#include "RtsFlags.h" #include "RtsUtils.h" #include "Schedule.h" #include "Stats.h" @@ -249,6 +250,12 @@ stat_endExit(void) getProcessTimes(&end_exit_cpu, &end_exit_elapsed); } +void +stat_startGCSync (gc_thread *gct) +{ + gct->gc_sync_start_elapsed = getProcessElapsedTime(); +} + /* ----------------------------------------------------------------------------- Called at the beginning of each GC -------------------------------------------------------------------------- */ @@ -308,10 +315,11 @@ stat_endGC (Capability *cap, gc_thread *gct, W_ alloc; if (RtsFlags.GcFlags.giveStats != NO_GC_STATS || + rtsConfig.gcDoneHook != NULL || RtsFlags.ProfFlags.doHeapProfile) // heap profiling needs GC_tot_time { - Time cpu, elapsed, gc_cpu, gc_elapsed; + Time cpu, elapsed, gc_cpu, gc_elapsed, gc_sync_elapsed; // Has to be emitted while all caps stopped for GC, but before GC_END. // See trac.haskell.org/ThreadScope/wiki/RTSsummaryEvents @@ -341,6 +349,7 @@ stat_endGC (Capability *cap, gc_thread *gct, // timestamp as used in +RTS -s calculcations. traceEventGcEndAtT(cap, TimeToNS(elapsed - start_init_elapsed)); + gc_sync_elapsed = gct->gc_start_elapsed - gct->gc_sync_start_elapsed; gc_elapsed = elapsed - gct->gc_start_elapsed; gc_cpu = cpu - gct->gc_start_cpu; @@ -374,6 +383,21 @@ stat_endGC (Capability *cap, gc_thread *gct, statsFlush(); } + + if (rtsConfig.gcDoneHook != NULL) { + rtsConfig.gcDoneHook(gen, + alloc*sizeof(W_), + live*sizeof(W_), + copied*sizeof(W_), + par_max_copied * sizeof(W_), + mblocks_allocated * BLOCKS_PER_MBLOCK + * BLOCK_SIZE_W * sizeof(W_), + slop * sizeof(W_), + TimeToNS(gc_sync_elapsed), + TimeToNS(gc_elapsed), + TimeToNS(gc_cpu)); + } + GC_coll_cpu[gen] += gc_cpu; GC_coll_elapsed[gen] += gc_elapsed; if (GC_coll_max_pause[gen] < gc_elapsed) { |