From f5605a5a2ea4a4707c9bec48048d730f0f56dae2 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Sun, 8 Jul 2007 19:44:23 +0000 Subject: [PATCH] Fix the +RTS -V0 option introduced recently; it didn't work at all, now it does. Also, I documented it. +RTS -V0 disables the internal RTS timer completely, which is useful for repeatable debugginng. --- docs/users_guide/runtime_control.xml | 8 ++++++++ rts/Makefile | 2 +- rts/RtsFlags.c | 24 ++++++++++++++++++------ rts/Timer.c | 4 +++- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/docs/users_guide/runtime_control.xml b/docs/users_guide/runtime_control.xml index e89f340..95365ba 100644 --- a/docs/users_guide/runtime_control.xml +++ b/docs/users_guide/runtime_control.xml @@ -108,6 +108,14 @@ the or options. However, setting is required in order to increase the resolution of the time profiler. + + Using a value of zero disables the RTS clock + completetly, and has the effect of disabling timers that + depend on it: the context switch timer and the heap profiling + timer. Context switches will still happen, but + deterministically and at a rate much faster than normal. + Disabling the interval timer is useful for debugging, because + it eliminates a source of non-determinism at runtime. diff --git a/rts/Makefile b/rts/Makefile index 2c5dcc4..8d39ed0 100644 --- a/rts/Makefile +++ b/rts/Makefile @@ -330,7 +330,7 @@ sm/Compact_HC_OPTS += -optc-finline-limit=2500 SRC_CC_OPTS += -fno-strict-aliasing # Cmm must be compiled via-C for now, because the NCG can't handle loops -SRC_HC_OPTS += -fvia-C +# SRC_HC_OPTS += -fvia-C # We *want* type-checking of hand-written cmm. SRC_HC_OPTS += -dcmm-lint diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 0ab1399..9dd6b19 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1244,13 +1244,20 @@ error = rtsTrue; } } - // Determine what tick interval we should use for the RTS timer - // by taking the shortest of the various intervals that we need to - // monitor. - if (RtsFlags.MiscFlags.tickInterval <= 0) { + if (RtsFlags.MiscFlags.tickInterval < 0) { RtsFlags.MiscFlags.tickInterval = 50; } + // If the master timer is disabled, turn off the other timers. + if (RtsFlags.MiscFlags.tickInterval == 0) { + RtsFlags.ConcFlags.ctxtSwitchTime = 0; + RtsFlags.GcFlags.idleGCDelayTime = 0; + RtsFlags.ProfFlags.profileInterval = 0; + } + + // Determine what tick interval we should use for the RTS timer + // by taking the shortest of the various intervals that we need to + // monitor. if (RtsFlags.ConcFlags.ctxtSwitchTime > 0) { RtsFlags.MiscFlags.tickInterval = stg_min(RtsFlags.ConcFlags.ctxtSwitchTime, @@ -1277,8 +1284,13 @@ error = rtsTrue; RtsFlags.ConcFlags.ctxtSwitchTicks = 0; } - RtsFlags.ProfFlags.profileIntervalTicks = - RtsFlags.ProfFlags.profileInterval / RtsFlags.MiscFlags.tickInterval; + if (RtsFlags.ProfFlags.profileInterval > 0) { + RtsFlags.ProfFlags.profileIntervalTicks = + RtsFlags.ProfFlags.profileInterval / + RtsFlags.MiscFlags.tickInterval; + } else { + RtsFlags.ProfFlags.profileIntervalTicks = 0; + } if (error) { const char **p; diff --git a/rts/Timer.c b/rts/Timer.c index 0e0b538..586991a 100644 --- a/rts/Timer.c +++ b/rts/Timer.c @@ -93,5 +93,7 @@ startTimer(void) void stopTimer(void) { - stopTicker(); + if (RtsFlags.MiscFlags.tickInterval != 0) { + stopTicker(); + } } -- 1.7.10.4