-let () =
- let input = ref Paths_on_stdin in
- Arg.parse
- []
- (function
- | path when Sys.file_exists path ->
- (match !input with
- | Paths_on_stdin ->
- input := Root_paths [path]
- | Root_paths paths ->
- input := Root_paths (path :: paths)
+ let pt1_all = time_proc () in
+ let wt1_all = time_wall () in
+
+ M.report metrics
+ ~wall_time_all: (wt1_all -. wt0_all)
+ ~wall_time_group_by_size: (wt1_group_by_size -. wt0_group_by_size)
+ ~wall_time_group_by_head: (wt1_group_by_sample -. wt0_group_by_sample)
+ ~wall_time_group_by_digest:(wt1_group_by_digest -. wt0_group_by_digest)
+ ~proc_time_all: (pt1_all -. pt0_all)
+ ~proc_time_group_by_size: (pt1_group_by_size -. pt0_group_by_size)
+ ~proc_time_group_by_head: (pt1_group_by_sample -. pt0_group_by_sample)
+ ~proc_time_group_by_digest:(pt1_group_by_digest -. pt0_group_by_digest)
+
+let get_opt () : opt =
+ let assert_ test x msg =
+ if not (test x) then begin
+ eprintf "%s\n%!" msg;
+ exit 1
+ end
+ in
+ let assert_file_exists path =
+ assert_ Sys.file_exists path (sprintf "File does not exist: %S" path)
+ in
+ let assert_file_is_dir path =
+ assert_ Sys.is_directory path (sprintf "File is not a directory: %S" path)
+ in
+ let input = ref Stdin in
+ let output = ref Stdout in
+ let ignore = ref (fun _ -> false) in
+ let sample = ref 512 in
+ let njobs = ref 6 in
+ let input_delim_null = ref false in
+ let spec =
+ [ ( "-out"
+ , Arg.String (fun path ->
+ assert_file_exists path;
+ assert_file_is_dir path;
+ output := Directory path