1. camlspotter
  2. spotlib

Commits

camlspotter  committed 0d5ef5c

with_time

  • Participants
  • Parent commits 5eabc67
  • Branches default

Comments (0)

Files changed (2)

File base.ml

View file
   | `Exn e -> finally (); raise e
 
 let with_time f v =
-  let open Unix in 
-  let start = Unix.times () in
+  let start = Unix.gettimeofday () in
   let res = f v in
-  let end_ = Unix.times () in
-  res, { tms_utime  = end_.tms_utime  -. start.tms_utime;
-         tms_stime  = end_.tms_stime  -. start.tms_stime;
-         tms_cutime = end_.tms_cutime -. start.tms_cutime;
-         tms_cstime = end_.tms_cstime -. start.tms_cstime; }
+  let end_ = Unix.gettimeofday () in
+  res, end_ -. start

File base.mli

View file
 
 val protect : ('a -> 'b) -> 'a -> finally: (unit -> unit) -> 'b
 
-val with_time : ('a -> 'b) -> 'a -> 'b * Unix.process_times
+val with_time : ('a -> 'b) -> 'a -> 'b * float
   (** simple profiling *)