X-Git-Url: https://git.haskell.org/ghc.git/blobdiff_plain/39b5c1cbd8950755de400933cecca7b8deb4ffcd..733e845d0f66541a06415c6b420e51fc99eb9d95:/rts/Timer.c diff --git a/rts/Timer.c b/rts/Timer.c index c2c4caa..a8b0e20 100644 --- a/rts/Timer.c +++ b/rts/Timer.c @@ -8,7 +8,7 @@ /* * The interval timer is used for profiling and for context switching in the - * threaded build. + * threaded build. * * This file defines the platform-independent view of interval timing, relying * on platform-specific services to install and run the timers. @@ -45,7 +45,7 @@ handle_tick(int unused STG_UNUSED) if (RtsFlags.ConcFlags.ctxtSwitchTicks > 0) { ticks_to_ctxt_switch--; if (ticks_to_ctxt_switch <= 0) { - ticks_to_ctxt_switch = RtsFlags.ConcFlags.ctxtSwitchTicks; + ticks_to_ctxt_switch = RtsFlags.ConcFlags.ctxtSwitchTicks; contextSwitchAllCapabilities(); /* schedule a context switch */ } } @@ -72,9 +72,16 @@ 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 -#ifndef 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. +#ifdef PROFILING + if (!(RtsFlags.ProfFlags.doHeapProfile + || RtsFlags.CcFlags.doCostCentres)) { + stopTimer(); + } +#else stopTimer(); #endif } @@ -88,7 +95,7 @@ handle_tick(int unused STG_UNUSED) } // This global counter is used to allow multiple threads to stop the -// timer temporarily with a stopTimer()/startTimer() pair. If +// timer temporarily with a stopTimer()/startTimer() pair. If // timer_enabled == 0 timer is enabled // timer_disabled == N, N > 0 timer is disabled by N threads // When timer_enabled makes a transition to 0, we enable the timer, @@ -127,17 +134,9 @@ stopTimer(void) } void -exitTimer (rtsBool wait) +exitTimer (bool wait) { if (RtsFlags.MiscFlags.tickInterval != 0) { exitTicker(wait); } } - -// Local Variables: -// mode: C -// fill-column: 80 -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: