2 import "JavaBuiltin" as Java
4 import "Logging" as LOGGER
6 importJava "java.lang.System" where
7 nanoTime :: () -> <Proc> Long
10 Executes the expression and returns the result
11 together with execution time in seconds.
13 time :: (<e> a) -> <Proc,e> (a,Double)
15 beginTime = nanoTime ()
18 (result, Java.l2d (endTime-beginTime) * 1e-9)
20 reportTime :: (<e> a) -> <e> a
21 reportTime f = runProc do
22 beginTime = nanoTime ()
25 time = Java.l2d (endTime-beginTime) * 1e-9
26 LOGGER.info "time \(time) s"
29 reportTimeM :: String -> (<e> a) -> <e> a
30 reportTimeM task f = runProc do
31 beginTime = nanoTime ()
34 time = Java.l2d (endTime-beginTime) * 1e-9
35 LOGGER.info "\(task): \(time) s"
39 Prints the given text and returns
42 trace :: String -> a -> a
43 trace text value = runProc do
48 Prints the given value and returns
51 traceShow :: Show a => a -> b -> b
52 traceShow p v = trace (show p) v