[commit: ghc] master: rts: Add --internal-counters RTS flag and several counters (2918abf)

git at git.haskell.org git at git.haskell.org
Mon Mar 19 16:37:34 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2918abf75594001deed51ee252a05b146f844489/ghc

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

commit 2918abf75594001deed51ee252a05b146f844489
Author: Douglas Wilson <douglas.wilson at gmail.com>
Date:   Mon Mar 19 11:55:37 2018 -0400

    rts: Add --internal-counters RTS flag and several counters
    
    The existing internal counters:
    * gc_alloc_block_sync
    * whitehole_spin
    * gen[g].sync
    * gen[1].sync
    
    are now not shown in the -s report unless --internal-counters is also passed.
    
    If --internal-counters is passed we now show the counters above, reformatted, as
    well as several other counters. In particular, we now count the yieldThread()
    calls that SpinLocks do as well as their spins.
    
    The added counters are:
    * gc_spin (spin and yield)
    * mut_spin (spin and yield)
    * whitehole_threadPaused (spin only)
    * whitehole_executeMessage (spin only)
    * whitehole_lockClosure (spin only)
    * waitForGcThreadsd (spin and yield)
    
    As well as the following, which are not SpinLock-like things:
    * any_work
    * do_work
    * scav_find_work
    
    See the Note for descriptions of what these counters are.
    
    We add busy_wait_nops in these loops along with the counter increment where it
    was absent.
    
    Old internal counters output:
    ```
    gc_alloc_block_sync: 0
    whitehole_gc_spin: 0
    gen[0].sync: 0
    gen[1].sync: 0
    ```
    
    New internal counters output:
    ```
    Internal Counters:
                                               Spins        Yields
        gc_alloc_block_sync                      323             0
        gc_spin                              9016713           752
        mut_spin                            57360944         47716
        whitehole_gc                               0           n/a
        whitehole_threadPaused                     0           n/a
        whitehole_executeMessage                   0           n/a
        whitehole_lockClosure                      0             0
        waitForGcThreads                           2           415
        gen[0].sync                                6             0
        gen[1].sync                                1             0
    
        any_work                                2017
        no_work                                 2014
        scav_find_work                          1004
    ```
    
    Test Plan:
    ./validate
    
    Check it builds with #define PROF_SPIN removed from includes/rts/Config.h
    
    Reviewers: bgamari, erikd, simonmar, hvr
    
    Reviewed By: simonmar
    
    Subscribers: rwbarton, thomie, carter
    
    GHC Trac Issues: #3553, #9221
    
    Differential Revision: https://phabricator.haskell.org/D4302


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

2918abf75594001deed51ee252a05b146f844489
 docs/users_guide/runtime_control.rst        |   6 +-
 includes/RtsAPI.h                           |  24 ++++
 includes/rts/Flags.h                        |   1 +
 includes/rts/SpinLock.h                     |   5 +-
 includes/rts/storage/GC.h                   |   2 +-
 libraries/base/GHC/RTS/Flags.hsc            |   3 +
 rts/Messages.c                              |   3 +
 rts/Messages.h                              |   4 +
 rts/RtsFlags.c                              |   6 +
 rts/SMPClosureOps.h                         |  12 ++
 rts/Stats.c                                 | 189 ++++++++++++++++++++++++++--
 rts/Stats.h                                 |   5 +-
 rts/StgMiscClosures.cmm                     |  10 ++
 rts/ThreadPaused.c                          |   4 +
 rts/ThreadPaused.h                          |   8 ++
 rts/sm/Evac.c                               |   9 +-
 rts/sm/GC.c                                 |  71 ++++++++---
 rts/sm/GC.h                                 |   2 +
 testsuite/tests/rts/InternalCounters.stdout |   1 +
 testsuite/tests/rts/Makefile                |  19 +--
 testsuite/tests/rts/all.T                   |   2 +
 21 files changed, 346 insertions(+), 40 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 2918abf75594001deed51ee252a05b146f844489


More information about the ghc-commits mailing list