[GHC] #8504: Provide minor GC residency estimates

GHC ghc-devs at haskell.org
Tue Nov 5 07:50:59 UTC 2013


#8504: Provide minor GC residency estimates
-------------------------------------------+-------------------------------
       Reporter:  ezyang                   |             Owner:  simonmar
           Type:  feature request          |            Status:  new
       Priority:  lowest                   |         Milestone:
      Component:  Runtime System           |           Version:  7.7
       Keywords:  easy                     |  Operating System:
   Architecture:  Unknown/Multiple         |  Unknown/Multiple
     Difficulty:  Easy (less than 1 hour)  |   Type of failure:
     Blocked By:                           |  None/Unknown
Related Tickets:                           |         Test Case:
                                           |          Blocking:
-------------------------------------------+-------------------------------
 Currently, the residency statistics (e.g. max residency and current
 residency) are only updated when a major garbage collection occurs.  While
 this is the only way to ensure an accurate residency count, there are
 times when a residency estimate would be desirable, since only taking the
 sample on major GC can be somewhat low resolution. We already collect and
 report this information on verbose GC stats, so all that needs to be done
 is to expose it via GHC.Stats. Should be an easy patch, good for someone
 who wants to play around in the RTS.

 Here is a simple patch that switches residency to the inaccurate version:

 {{{
 diff --git a/rts/Stats.c b/rts/Stats.c
 index c19f23c..c71d0fb 100644
 --- a/rts/Stats.c
 +++ b/rts/Stats.c
 @@ -449,7 +449,6 @@ stat_endGC (Capability *cap, gc_thread *gct,
                            CAPSET_HEAP_DEFAULT,
                            mblocks_allocated * MBLOCK_SIZE_W *
 sizeof(W_));

 -       if (gen == RtsFlags.GcFlags.generations-1) { /* major GC? */
             if (live > max_residency) {
                 max_residency = live;
             }
 @@ -459,7 +458,6 @@ stat_endGC (Capability *cap, gc_thread *gct,
             traceEventHeapLive(cap,
                                CAPSET_HEAP_DEFAULT,
                                live * sizeof(W_));
 -       }

          if (slop > max_slop) max_slop = slop;
      }
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8504>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list