src/Tools/Compute_Oracle/report.ML
author wenzelm
Sat, 25 Jul 2009 18:02:43 +0200
changeset 32193 c314b4836031
parent 30187 b92b3375e919
child 32740 9dd0a2f83429
permissions -rw-r--r--
basic method application: avoid Position.setmp_thread_data_seq, which destroys transaction context; Method.Basic: no position;

structure Report =
struct

local

    val report_depth = ref 0
    fun space n = if n <= 0 then "" else (space (n-1))^" "
    fun report_space () = space (!report_depth)

in

fun timeit f =
    let
	val t1 = start_timing ()
	val x = f ()
	val t2 = #message (end_timing t1)
	val _ = writeln ((report_space ()) ^ "--> "^t2)
    in
	x	
    end

fun report s f = 
let
    val _ = writeln ((report_space ())^s)
    val _ = report_depth := !report_depth + 1
    val x = timeit f
    val _ = report_depth := !report_depth - 1
in
    x
end

end
end