test program: -gc option to print GC stats

This commit is contained in:
Simon Cruanes 2014-11-04 20:37:00 +01:00
parent 30e372d302
commit 3107fc4755

View file

@ -9,7 +9,6 @@ let file = ref ""
let p_assign = ref false
let time_limit = ref 300.
let size_limit = ref 1000_000_000.
;;
let int_arg r arg =
let l = String.length arg in
@ -32,7 +31,11 @@ let int_arg r arg =
| '0'..'9' -> r := float_of_string arg
| _ -> raise (Arg.Bad "bad numeric argument")
with Failure "float_of_string" -> raise (Arg.Bad "bad numeric argument")
;;
let setup_gc_stat () =
at_exit (fun () ->
Gc.print_stat stdout;
)
let input_file = fun s -> file := s
let usage = "Usage : main [options] <file>"
@ -45,6 +48,8 @@ let argspec = Arg.align [
"<s>[kMGT] Sets the size limit for the sat solver";
"-model", Arg.Set p_assign,
"Outputs the boolean model found if sat";
"-gc", Arg.Unit setup_gc_stat,
"Outputs statistics about the GC";
]
(* Limits alarm *)
@ -86,7 +91,7 @@ let main () =
Arg.usage argspec usage;
exit 2
end;
let al = Gc.create_alarm check in
ignore(Gc.create_alarm check);
(* Interesting stuff happening *)
let cnf = get_cnf () in
@ -98,8 +103,8 @@ let main () =
print_assign Format.std_formatter ()
| S.Unsat ->
Format.printf "Unsat@."
;;
let () =
try
main ()
with