-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimetest.ml
29 lines (23 loc) · 895 Bytes
/
timetest.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(**************************************************************)
(*************** Unit Test For Time Modules *******************)
(**************************************************************)
open Misc.Ops
let rec repeat f n = if n > 0 then (f (); repeat f (n-1))
let pause_1_sec () = repeat (fun () -> ()) 112516096
let pause_n_sec n = repeat pause_1_sec n
let rec sim n c b t =
if n > 0 then begin
let id = "downtick "^(string_of_int n) in
let _ = Printf.printf "%s \n" id in
Timer.log_event t (Some id);
Tagtime.time ("pause",[id]) pause_n_sec b;
sim (n-1) c (c*b) t
end
let sim n c b t =
sim n c b t;
Timer.log_event t None
let c = try Sys.argv.(1) |> int_of_string with _ -> 1
let _ = Timer.create "boo"
>> (fun t -> Tagtime.time ("sim", []) (sim 4 c 1) t)
|> Format.printf "%a" Timer.print
let _ = Tagtime.dump "timetest.stat"