diff options
author | Alex Auvolat <alex.auvolat@ansys.com> | 2014-06-30 17:43:06 +0200 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ansys.com> | 2014-06-30 17:43:06 +0200 |
commit | 88ecd2d5f2b27a09060313fd29fd087b92e6166e (patch) | |
tree | f7412fb04f42e7d3a2b2c719c4f472b7ce620034 /libs/util.ml | |
parent | c1e4836cd21b5707af927a916350e82c9fa7de11 (diff) | |
download | scade-analyzer-88ecd2d5f2b27a09060313fd29fd087b92e6166e.tar.gz scade-analyzer-88ecd2d5f2b27a09060313fd29fd087b92e6166e.zip |
Implement chaotic iterations on EDDs. Global widening is missing.
Diffstat (limited to 'libs/util.ml')
-rw-r--r-- | libs/util.ml | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/util.ml b/libs/util.ml index 443fb1e..88b916f 100644 --- a/libs/util.ml +++ b/libs/util.ml @@ -1,3 +1,5 @@ +open Unix + (* Small things *) let ord_couple (a, b) = if a < b then a, b else b, a @@ -77,3 +79,22 @@ let uid = let c = ref 0 in fun () -> c := !c + 1; string_of_int !c + +(* Time heavy functions *) + +let times_k : (string, float) Hashtbl.t = Hashtbl.create 10 + +let time id f = + let t0 = Unix.times () in + let result = f () in + let t1 = Unix.times () in + let t = t1.tms_utime -. t0.tms_utime in + let r = try Hashtbl.find times_k id with _ -> 0. in + Hashtbl.replace times_k id (r +. t); + result + +let show_times () = + Format.printf "Times:@."; + Hashtbl.iter + (fun id t -> Format.printf "%s: %f@." id t) + times_k |