]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic/cicUtil.ml
aded prifiler factory
[helm.git] / helm / ocaml / cic / cicUtil.ml
index 289d6d9838595eeafb59c7c9624a0fea6dd97015..81055e68178099bd41523c9e870b07d83be84194 100644 (file)
@@ -290,3 +290,18 @@ let rec mk_rels howmany from =
   | 0 -> []
   | _ -> (Cic.Rel (howmany + from)) :: (mk_rels (howmany-1) from)
 
+let profile =
+ function s ->
+  let total = ref 0.0 in
+  let profile f x =
+   let before = Unix.gettimeofday () in
+   let res = f x in
+   let after = Unix.gettimeofday () in
+    total := !total +. (after -. before);
+    res
+  in
+  at_exit
+   (fun () ->
+     print_endline
+      ("!! TOTAL TIME SPENT IN " ^ s ^ ": " ^ string_of_float !total));
+  profile