Commits

Sebastien Mondet committed 94b129d

Improve information display and add -name option

Comments (0)

Files changed (1)

   count
 
     
-let do_bench repetitions buffer_sizes files =
-  Lwt_io.printf "{section|Benchmark}\n\
-                 {b|Started On %s}{p}\n" Time.(now () |! to_string)
+let do_bench exp_name repetitions buffer_sizes files =
+  Lwt_io.printf "{section|Benchmark %S}\n\
+                 {b|Started On %s}{p}\n" exp_name Time.(now () |! to_string)
   >>= fun () ->
-  Lwt_io.printf "Info: {list|\n\
+  Lwt_io.printf "{section 2|Info} {list|\n\
                  {*} Repetitions: %d\n\
                  {*} Buffer-sizes: %s\n\
                  {*} Files: {br} %s\n\
   Lwt_unix.system "df -hT ." >>= fun _ ->
   Lwt_io.printf "{end}{p}\n{t|$ uname -a}{code}\n" >>= fun () ->
   Lwt_unix.system "uname -a" >>= fun _ ->
-  Lwt_io.printf "{end}{p}\n" >>= fun () ->
+  Lwt_io.printf "{end}{p}{t|Lwt_sys.have `libev = %b}\n" (Lwt_sys.have `libev)
+  >>= fun () ->
+  Lwt_io.printf "{section 2|Count Reads}\n" >>= fun () ->
   Lwt_list.iter_s (fun file ->
-    Lwt_io.printf "{b|File:} {t|%s}\n\
+    Lwt_io.file_length file >>= fun file_lgth64 ->
+    Lwt_io.printf "{b|File:} {t|%s} (%Ld B)\n\
                    {begin table 3}\n\
-                   {c h|Experiment}{c h|{#} Reads} {c h|Time (Avg.)}\n" file
+                   {c h|Experiment}{c h|{#} Reads} {c h|Time (Avg.)}\n"
+      file file_lgth64
     >>= fun () ->
     Lwt_list.map_s (fun buffer_size ->
       let reads = ref 0 in
     ) buffer_sizes
     >>= fun lwt_io_results ->
     Lwt_list.iter_s (fun (bufs, reads, time) ->
-      Lwt_io.printf "{c|Lwt_io (%d B)} {c|%d} {c|%f (%f)}\n"
+      Lwt_io.printf "{c|Biocaml_fastq + Lwt_io (buf: %d B)} {c|%d} {c|%f (%f)}\n"
         bufs reads time (time /. float repetitions))
       lwt_io_results
     >>= fun () ->
     let start = Time.now () in
     iteration repetitions >>= fun () ->
     let time = Time.(diff (now ()) start) |! Core.Span.to_float in
-    Lwt_io.printf "{c|{t|File.lines_of |> Enum.hard_count}} {c|%d} {c|%f (%f)}\n"
+    Lwt_io.printf "{c|{t|File.lines_of |> Enum.hard_count / 4}} {c|%d} {c|%f (%f)}\n"
       !reads time (time /. float repetitions)
     >>= fun () ->
     Lwt_io.printf "{end}{p}\n"
   let repetitions = ref 1 in
   let buffer_sizes = ref [1024] in
   let filenames = ref [] in
+  let exp_name = ref "" in
   let options = [
+    ("-name", Arg.Set_string exp_name, "<name>\n\tGive a name to the benchmark");
     ("-buffer-sizes", Arg.String (fun s ->
       buffer_sizes :=
         List.map (String.split ~on:',' s) Int.of_string),
   if !filenames = [] then
     eprintf "Nothing to do\n"
   else
-    Lwt_main.run (do_bench !repetitions !buffer_sizes !filenames)
+    Lwt_main.run (do_bench !exp_name !repetitions !buffer_sizes !filenames)