First commit of the f# source code.
[master-thesis.git] / Parasitemia / Parasitemia / Utils.fs
1 module Utils
2
3 open System.Diagnostics
4
5 let roundInt = int << round
6
7 let inline dprintfn fmt =
8 Printf.ksprintf System.Diagnostics.Debug.WriteLine fmt
9
10 let mutable log : (string -> unit) =
11 fun m -> ()
12
13 let logTime (m: string) (f: unit -> 'a) : 'a =
14 let sw = Stopwatch()
15 sw.Start()
16 let res = f ()
17 sw.Stop()
18 log <| sprintf "%A (time: %A ms)" m sw.ElapsedMilliseconds
19 res