X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=components%2Fextlib%2FhExtlib.ml;h=4296db49b668acde2ee35efc2aa87e0fe9f2018c;hb=859dbc6f3766828d1f7a4c5d794a98dca5381274;hp=5f96e0f84e7fad3237394a835e68dfafe1311b31;hpb=7f2444c2670cadafddd8785b687ef312158376b0;p=helm.git diff --git a/components/extlib/hExtlib.ml b/components/extlib/hExtlib.ml index 5f96e0f84..4296db49b 100644 --- a/components/extlib/hExtlib.ml +++ b/components/extlib/hExtlib.ml @@ -37,9 +37,11 @@ let profile ?(enable = true) = if profiling_enabled && enable then function s -> let total = ref 0.0 in + let calls = ref 0 in let profile f x = let before = Unix.gettimeofday () in try + incr calls; let res = f x in let after = Unix.gettimeofday () in total := !total +. (after -. before); @@ -52,9 +54,9 @@ let profile ?(enable = true) = in at_exit (fun () -> - if !profiling_printings () then + if !profiling_printings () && !total <> 0. then prerr_endline - ("!! TOTAL TIME SPENT IN " ^ s ^ ": " ^ string_of_float !total)); + ("!! TOTAL TIME SPENT IN " ^ s ^ " ("^string_of_int !calls^"): " ^ string_of_float !total)); { profile = profile } else function _ -> { profile = fun f x -> f x }