[commit: ghc] master: Overhaul GC stats (24e6594)

git at git.haskell.org git at git.haskell.org
Tue Dec 6 20:06:39 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/24e6594cc7890babe69b8ba122d171affabad2d1/ghc

>---------------------------------------------------------------

commit 24e6594cc7890babe69b8ba122d171affabad2d1
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Fri Nov 25 16:45:43 2016 +0000

    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


>---------------------------------------------------------------

24e6594cc7890babe69b8ba122d171affabad2d1
 includes/Rts.h               |  33 +---
 includes/RtsAPI.h            | 115 +++++++++++-
 includes/rts/Time.h          |  43 +++++
 includes/rts/storage/GC.h    |  55 ------
 libraries/base/GHC/Stats.hsc | 260 +++++++++++++++++++------
 rts/RtsSymbols.c             |   4 +-
 rts/Stats.c                  | 437 +++++++++++++++++++++----------------------
 rts/Stats.h                  |   2 +-
 rts/sm/GC.c                  |   7 +-
 rts/sm/Storage.c             |  22 +++
 rts/sm/Storage.h             |   4 +-
 11 files changed, 598 insertions(+), 384 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 24e6594cc7890babe69b8ba122d171affabad2d1


More information about the ghc-commits mailing list