aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/profile.ml
diff options
context:
space:
mode:
authorGravatar glondu <glondu@85f007b7-540e-0410-9357-904b9bb8a0f7>2010-07-02 12:54:57 +0000
committerGravatar glondu <glondu@85f007b7-540e-0410-9357-904b9bb8a0f7>2010-07-02 12:54:57 +0000
commitdacb4b76afe554f1a1e17d981bc98d9fc3a8e807 (patch)
tree0c6de9a4f3a7338f32f70520d9647e6f3a356497 /lib/profile.ml
parent2de4563cb6192e638df4172c725ec8814e6eb112 (diff)
Remove dependency to Unix from module Profile
Looking at the source code of Sys.time reveals that it is exactly what is computed by Profile.get_time. This can also be tested by evaluating: Sys.time () -. Unix.(let x = times () in x.tms_utime +. x.tms_stime);; in an OCaml toplevel with Unix. This allows to put Profile in grammar.cma without the dependency to unix.cma while preprocessing. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13233 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib/profile.ml')
-rw-r--r--lib/profile.ml8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/profile.ml b/lib/profile.ml
index d15447817..cde5ed599 100644
--- a/lib/profile.ml
+++ b/lib/profile.ml
@@ -15,8 +15,7 @@ let float_of_time t = float_of_int t /. 100.
let time_of_float f = int_of_float (f *. 100.)
let get_time () =
- let {Unix.tms_utime = ut;Unix.tms_stime = st} = Unix.times () in
- time_of_float (ut +. st)
+ time_of_float (Sys.time ())
(* Since ocaml 3.01, gc statistics are in float *)
let get_alloc () =
@@ -155,7 +154,10 @@ let merge_profile filename (curr_table, curr_outside, curr_total as new_data) =
(* Unix measure of time is approximative and shoitt delays are often
unperceivable; therefore, total times are measured in one (big)
step to avoid rounding errors and to get the best possible
- approximation *)
+ approximation.
+ Note: Sys.time is the same as:
+ Unix.(let x = times () in x.tms_utime +. x.tms_stime)
+ *)
(*
---------- start profile for f1