[commit: ghc] ghc-8.0: rts: Disable tick timer unless really needed (26a9f13)

git at git.haskell.org git at git.haskell.org
Mon Jan 25 21:45:44 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/26a9f13ca4f602749f0f00388a145badbf7c27dd/ghc

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

commit 26a9f13ca4f602749f0f00388a145badbf7c27dd
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Fri Jan 22 16:22:13 2016 +0100

    rts: Disable tick timer unless really needed
    
    Trac #9105 notes significant CPU usage by an otherwise idle process when
    compiled with profiling. The reason for this is that we keep the tick
    timer active in the profiling RTS even if profiling wasn't requested at
    runtime.
    
    If the user requests any sort of profiling then we need to keep the
    timer active to ensure that samples are collected.
    
    Test Plan: Validate, check CPU usage, ensure profiling still works
    
    Reviewers: simonmar, austin
    
    Reviewed By: simonmar, austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1822
    
    GHC Trac Issues: #9105
    
    (cherry picked from commit b01288d509b0f9e45f23ae48f2366f85f489089c)


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

26a9f13ca4f602749f0f00388a145badbf7c27dd
 rts/Timer.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/rts/Timer.c b/rts/Timer.c
index 99c09b0..bf7240b 100644
--- a/rts/Timer.c
+++ b/rts/Timer.c
@@ -72,10 +72,15 @@ handle_tick(int unused STG_UNUSED)
 #endif
           } else {
               recent_activity = ACTIVITY_DONE_GC;
-              // disable timer signals (see #1623, #5991)
-              // but only if we're not profiling
+              // disable timer signals (see #1623, #5991, #9105)
+              // but only if we're not profiling (e.g. passed -h or -p RTS
+              // flags). If we are profiling we need to keep the timer active
+              // so that samples continue to be collected.
 #ifndef PROFILING
-              stopTimer();
+              if (!(RtsFlags.ProfFlags.doHeapProfile
+                    || RtsFlags.CcFlags.doCostCentres)) {
+                  stopTimer();
+              }
 #endif
           }
       } else {



More information about the ghc-commits mailing list