Fix the +RTS -V0 option introduced recently; it didn't work at all, now it does.
authorSimon Marlow <simonmar@microsoft.com>
Sun, 8 Jul 2007 19:44:23 +0000 (19:44 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Sun, 8 Jul 2007 19:44:23 +0000 (19:44 +0000)
Also, I documented it.  +RTS -V0 disables the internal RTS timer
completely, which is useful for repeatable debugginng.

docs/users_guide/runtime_control.xml
rts/Makefile
rts/RtsFlags.c
rts/Timer.c

index e89f340..95365ba 100644 (file)
          the <option>-C</option> or <option>-i</option> options.
          However, setting <option>-V</option> is required in order to
          increase the resolution of the time profiler.</para>
+
+         <para>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.</para>
        </listitem>
      </varlistentry>
 
index 2c5dcc4..8d39ed0 100644 (file)
@@ -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 
index 0ab1399..9dd6b19 100644 (file)
@@ -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;
index 0e0b538..586991a 100644 (file)
@@ -93,5 +93,7 @@ startTimer(void)
 void
 stopTimer(void)
 {
-  stopTicker();
+  if (RtsFlags.MiscFlags.tickInterval != 0) {
+      stopTicker();
+  }
 }