Fix in filenames during bench log parsing

This commit is contained in:
Guillaume Bury 2014-11-20 20:38:19 +01:00
parent d52c6d7965
commit be4ce92d08
3 changed files with 18 additions and 5 deletions

View file

@ -135,6 +135,12 @@ let print_diff_short s1 s2 =
| [] -> () | [] -> ()
| l -> Format.printf "WARNING : %d incoherence@\n" (List.length l) | l -> Format.printf "WARNING : %d incoherence@\n" (List.length l)
let print_full h =
let aux f pb =
()
in
Hashtbl.iter aux h
(* Main function *) (* Main function *)
let main () = let main () =
Arg.parse args anon usage; Arg.parse args anon usage;

View file

@ -67,6 +67,10 @@ type pb = {
pb_time : float; pb_time : float;
} }
let str_cut s start len =
try String.sub s start len
with Invalid_argument _ -> ""
let status_of_lines f = function let status_of_lines f = function
| ["Sat"] -> Sat | ["Sat"] -> Sat
| ["Unsat"] -> Unsat | ["Unsat"] -> Unsat
@ -77,7 +81,7 @@ let status_of_lines f = function
List.iter (fun s -> Format.printf "%s@." s) l; List.iter (fun s -> Format.printf "%s@." s) l;
raise (Unknown_status (f, l)) raise (Unknown_status (f, l))
let parse_raw f = let parse_raw base f =
let f_in = open_in f in let f_in = open_in f in
let f_lines = ref [] in let f_lines = ref [] in
begin try begin try
@ -92,14 +96,18 @@ let parse_raw f =
| [] -> raise (Empty_raw f) | [] -> raise (Empty_raw f)
| s :: r -> | s :: r ->
let st = status_of_lines f (List.rev r) in let st = status_of_lines f (List.rev r) in
{ pb_name = f; pb_st = st; pb_time = float_of_string s } assert (str_cut f 0 (String.length base) = base);
let file_name = String.sub f (String.length base) (String.length f - String.length base) in
{ pb_name = file_name; pb_st = st; pb_time = float_of_string s }
let parse_commit root = let parse_commit root =
let l = list_dir_files_rec (Filename.concat root "raw") in let s = Filename.concat root "raw" in
let l = list_dir_files_rec s in
let res = Hashtbl.create (List.length l) in let res = Hashtbl.create (List.length l) in
List.iter (fun f -> List.iter (fun f ->
try try
Hashtbl.add res f (parse_raw f) let pb = parse_raw s f in
Hashtbl.add res pb.pb_name pb
with Empty_raw _ | Unknown_status _ -> () with Empty_raw _ | Unknown_status _ -> ()
) l; ) l;
res res

View file

@ -11,5 +11,4 @@ val last_commit : unit -> string
type status = Sat | Unsat | Timeout | Spaceout type status = Sat | Unsat | Timeout | Spaceout
type pb = { pb_name : string; pb_st : status; pb_time : float; } type pb = { pb_name : string; pb_st : status; pb_time : float; }
val parse_raw : string -> pb
val parse_commit : string -> (string, pb) Hashtbl.t val parse_commit : string -> (string, pb) Hashtbl.t