Skip to content

Commit

Permalink
better reporting in benchmarks for killed runs
Browse files Browse the repository at this point in the history
  • Loading branch information
zapashcanon committed Jun 13, 2024
1 parent fbf5ec6 commit 609d53a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 17 deletions.
13 changes: 9 additions & 4 deletions bench/report/parse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,18 @@ let from_file file =
| [ "Other"; n; "in"; t1; t2; t3 ] ->
let* n = parse_int n in
let+ rusage = parse_time t1 t2 t3 in
Run_result.Other (n, rusage)
Run_result.Other (rusage, n)
| [ "Nothing"; "in"; t1; t2; t3 ] ->
let+ rusage = parse_time t1 t2 t3 in
Run_result.Nothing rusage
| [ "Killed"; "in"; t1; t2; t3 ] ->
let+ rusage = parse_time t1 t2 t3 in
Run_result.Killed rusage
| [ "Signaled"; n; "in"; t1; t2; t3 ] ->
let* rusage = parse_time t1 t2 t3 in
let+ n = parse_int n in
Run_result.Stopped (rusage, n)
| [ "Stopped"; n; "in"; t1; t2; t3 ] ->
let* rusage = parse_time t1 t2 t3 in
let+ n = parse_int n in
Run_result.Signaled (rusage, n)
| _ -> ksprintf error "malformed result: %S" result
in
{ Run.i; res; file }
Expand Down
8 changes: 7 additions & 1 deletion bench/report/run.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ type t =

let rusage { res; _ } =
match res with
| Run_result.Reached t | Timeout t | Nothing t | Killed t | Other (_, t) -> t
| Run_result.Reached t
| Timeout t
| Nothing t
| Signaled (t, _)
| Stopped (t, _)
| Other (t, _) ->
t

let clock run = (rusage run).clock

Expand Down
14 changes: 9 additions & 5 deletions bench/report/run_result.ml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
type t =
| Nothing of Rusage.t
| Killed of Rusage.t
| Signaled of Rusage.t * int
| Stopped of Rusage.t * int
| Reached of Rusage.t
| Timeout of Rusage.t
| Other of int * Rusage.t
| Other of Rusage.t * int

let is_nothing = function Nothing _ -> true | _ -> false

let is_killed = function Killed _ -> true | _ -> false
let is_killed = function Signaled _ | Stopped _ -> true | _ -> false

let is_reached = function Reached _ -> true | _ -> false

Expand All @@ -22,6 +23,9 @@ let pp fmt = function
Format.fprintf fmt "Nothing in %g %g %g" t.clock t.utime t.stime
| Reached t ->
Format.fprintf fmt "Reached in %g %g %g" t.clock t.utime t.stime
| Other (code, t) ->
| Other (t, code) ->
Format.fprintf fmt "Other %i in %g %g %g" code t.clock t.utime t.stime
| Killed t -> Format.fprintf fmt "Killed in %g %g %g" t.clock t.utime t.stime
| Signaled (t, code) ->
Format.fprintf fmt "Signaled %i in %g %g %g" code t.clock t.utime t.stime
| Stopped (t, code) ->
Format.fprintf fmt "Stopped %i in %g %g %g" code t.clock t.utime t.stime
5 changes: 3 additions & 2 deletions bench/report/run_result.mli
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
type t =
| Nothing of Rusage.t
| Killed of Rusage.t
| Signaled of Rusage.t * int
| Stopped of Rusage.t * int
| Reached of Rusage.t
| Timeout of Rusage.t
| Other of int * Rusage.t
| Other of Rusage.t * int

val is_nothing : t -> bool

Expand Down
5 changes: 3 additions & 2 deletions bench/report/runs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ let count_other runs =

let count_killed runs =
List.fold_left
(fun count r -> match r.Run.res with Killed _ -> succ count | _ -> count)
(fun count r ->
match r.Run.res with Signaled _ | Stopped _ -> succ count | _ -> count )
0 runs

let keep_nothing = List.filter Run.is_nothing
Expand Down Expand Up @@ -92,7 +93,7 @@ let pp_quick_results fmt results =
| Nothing _ -> incr nothing
| Reached _ -> incr reached
| Timeout _ -> incr timeout
| Killed _ -> incr killed
| Signaled _ | Stopped _ -> incr killed
| Other _ -> incr other )
results;
Format.fprintf fmt
Expand Down
7 changes: 4 additions & 3 deletions bench/tool/tool.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ let wait_pid =
| Owi _ ->
if code = 0 then Nothing rusage
else if code = 13 then Reached rusage
else Other (code, rusage)
else Other (rusage, code)
| Klee ->
if code = 0 then begin
let chan = open_in (Fpath.to_string dst_stderr) in
Expand All @@ -87,9 +87,10 @@ let wait_pid =
close_in chan;
if !has_found_error then Reached rusage else Nothing rusage
end
else Other (code, rusage)
else Other (rusage, code)
end
| WSIGNALED _ | WSTOPPED _ -> Killed rusage
| WSIGNALED n -> Signaled (rusage, n)
| WSTOPPED n -> Stopped (rusage, n)

let execvp ~output_dir tool file timeout =
let output_dir = Fpath.(output_dir / to_short_name tool) |> Fpath.to_string in
Expand Down

0 comments on commit 609d53a

Please sign in to comment.