Merge branch 'handle-stdout'
[SXSI/xpathcomp.git] / src / utils.ml
index 2cb3c41..7e3bb4b 100644 (file)
@@ -82,32 +82,33 @@ module Timing =
            om, nm))
           (infinity, 0., 0., 0, h, h) l
       in
-      Logger.verbose fmt "@[%s%s: [" sub msg;
-      Format.pp_open_vbox fmt (2 + String.length msg + String.length sub);
-      if len <= 1 then
-      Logger.verbose fmt
-        "@\n\
-| Time        :   %fms@\n\
-| Memory before:  %a@\n\
-| Memory after:   %a@\n]@]@]@\n"
-        tmin
-        System.pr_mem_status memo
-        System.pr_mem_status memn
+      Logger.start_msg fmt "[Stats] ";
+      Logger.msg fmt "%s %s:@\n    @[<v 0>[" sub msg;
+      begin
+        if len <= 1 then
+        Logger.msg fmt
+          "@\n\
+| Time:           %fms@\n"
+          tmin
       else
-      Logger.verbose fmt
-        "@\n\
+        Logger.msg fmt
+          "@\n\
 | Number of runs: %i@\n\
 | Average time:   %fms@\n\
 | Minimum time:   %fms@\n\
-| Maximum time:   %fms@\n\
-| Memory before:  %a@\n\
-| Memory after:   %a@\n]@]@]@\n"
-        len
-        (ttotal /. (float_of_int len))
-        tmin
-        tmax
+| Maximum time:   %fms@\n"
+          len
+          (ttotal /. (float_of_int len))
+          tmin
+          tmax
+
+      end;
+      Logger.msg fmt
+"| Memory before:  %a@\n\
+| Memory after:   %a@\n]@]"
         System.pr_mem_status memo
-        System.pr_mem_status memn
+        System.pr_mem_status memn;
+      Logger.end_msg fmt "\n\n"
 
 
 let time f ?(count=1) ?(msg="") x =
@@ -138,7 +139,7 @@ let time f ?(count=1) ?(msg="") x =
     Queue.clear _t_queue;
     List.iter (fun msg' ->
       let sub =
-        if msg' <> msg then "> " else "= "
+        if msg' <> msg then "+" else "="
       in
       display_result Format.err_formatter msg' sub (get_timing msg')) pr_stack;
   end;