From: Claudio Sacerdoti Coen Date: Fri, 24 Mar 2006 15:36:03 +0000 (+0000) Subject: Legend for profiling printed iff something is profiled. X-Git-Tag: 0.4.95@7852~1568 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=1afc33fa6997763d76e420cfdf9956208806b95c;p=helm.git Legend for profiling printed iff something is profiled. --- diff --git a/components/extlib/hExtlib.ml b/components/extlib/hExtlib.ml index ded11b9fe..cf43e15a0 100644 --- a/components/extlib/hExtlib.ml +++ b/components/extlib/hExtlib.ml @@ -29,8 +29,10 @@ let profiling_enabled = ComponentsConf.profiling +let something_profiled = ref false + let _ = - if profiling_enabled then + if !something_profiled then at_exit (fun _ -> prerr_endline (Printf.sprintf "!! %-39s %6s %9s %9s %9s" @@ -66,9 +68,12 @@ let profile ?(enable = true) s = at_exit (fun () -> if !profiling_printings s && !total <> 0. then + begin + something_profiled := true; prerr_endline (Printf.sprintf "!! %-39s %6d %9.4f %9.4f %9.4f" - s !calls !total !max (!total /. (float_of_int !calls)))); + s !calls !total !max (!total /. (float_of_int !calls))) + end); { profile = profile } else { profile = fun f x -> f x }