Moving the CPUtimer declaration into cond_timeit should
authorpaulson
Fri, 18 Oct 1996 11:32:38 +0200
changeset 2101 5d44339454a4
parent 2100 4a299f5408b7
child 2102 41a667d2c3fa
Moving the CPUtimer declaration into cond_timeit should prevent the problems that caused exn TIME to be raised
src/Pure/NJ1xx.ML
--- a/src/Pure/NJ1xx.ML	Fri Oct 18 11:31:33 1996 +0200
+++ b/src/Pure/NJ1xx.ML	Fri Oct 18 11:32:38 1996 +0200
@@ -59,14 +59,13 @@
 
 (*** Timing functions ***)
 
-val CPUtimer = Timer.startCPUTimer();
-
 (*A conditional timing function: applies f to () and, if the flag is true,
   prints its runtime. *)
 fun cond_timeit flag f =
   if flag then
     let open Time  (*...for Time.toString, Time.+ and Time.- *)
-	val {gc=gct1,sys=syst1,usr=usrt1} = Timer.checkCPUTimer(CPUtimer);
+	val CPUtimer = Timer.startCPUTimer();
+        val {gc=gct1,sys=syst1,usr=usrt1} = Timer.checkCPUTimer(CPUtimer);
         val result = f();
         val {gc=gct2,sys=syst2,usr=usrt2} = Timer.checkCPUTimer(CPUtimer)
     in  print("User " ^ toString (usrt2-usrt1) ^