[project @ 1999-02-26 16:44:13 by simonm]
authorsimonm <unknown>
Fri, 26 Feb 1999 16:44:14 +0000 (16:44 +0000)
committersimonm <unknown>
Fri, 26 Feb 1999 16:44:14 +0000 (16:44 +0000)
Fix small stats bug in the -G1 case.

ghc/rts/Main.c
ghc/rts/Schedule.c
ghc/rts/Storage.c

index c363eb2..c286b98 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Main.c,v 1.3 1999/01/21 10:31:47 simonm Exp $
+ * $Id: Main.c,v 1.4 1999/02/26 16:44:13 simonm Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -68,6 +68,8 @@ int main(int argc, char *argv[])
     case Interrupted:
       /* carry on */
     }
+    /* run all threads */
+    run_all_threads();
     shutdownHaskell();
     stg_exit(EXIT_SUCCESS);
 }
index 0f54706..ccb6b74 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.10 1999/02/26 12:32:51 simonm Exp $
+ * $Id: Schedule.c,v 1.11 1999/02/26 16:44:13 simonm Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -315,6 +315,14 @@ void initScheduler(void)
   enteredCAFs = END_CAF_LIST;
 }
 
+void 
+run_all_threads ( void )
+{
+  while (run_queue_hd != END_TSO_QUEUE) {
+    schedule(run_queue_hd, NULL);
+  }
+}
+
 /* -----------------------------------------------------------------------------
    Main scheduling loop.
 
index 0ba8a5e..017e537 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Storage.c,v 1.14 1999/02/23 17:18:01 simonm Exp $
+ * $Id: Storage.c,v 1.15 1999/02/26 16:44:14 simonm Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -387,7 +387,7 @@ calcLive(void)
   step *step;
 
   if (RtsFlags.GcFlags.generations == 1) {
-    live = g0s0->to_blocks * BLOCK_SIZE_W + 
+    live = (g0s0->to_blocks - 1) * BLOCK_SIZE_W + 
       ((lnat)g0s0->hp_bd->free - (lnat)g0s0->hp_bd->start) / sizeof(W_);
     return live;
   }
@@ -402,7 +402,7 @@ calcLive(void)
       }
       step = &generations[g].steps[s];
       live += (step->n_blocks - 1) * BLOCK_SIZE_W +
-       ((lnat)step->hp_bd->free -(lnat)step->hp_bd->start) / sizeof(W_);
+       ((lnat)step->hp_bd->free - (lnat)step->hp_bd->start) / sizeof(W_);
     }
   }
   return live;