Skip to content

Commit

Permalink
Adding instruction handler to solving loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevendeo committed Oct 9, 2023
1 parent 5342be6 commit 9fc24e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/bin/common/solving_loop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,11 @@ let main () =
pp_reason_unknown st
| ":version" ->
print_std Fmt.string Version._version
| ":all-statistics"
| ":all-statistics" ->
if Options.get_profiling () then
Printer.print_std "%t" Profiling.print_get_statistics
else
Printer.print_smtlib_err "Profiling disactivated (try --profiling)"
| ":assertion-stack-levels" ->
unsupported_opt name
| _ ->
Expand Down
9 changes: 6 additions & 3 deletions src/lib/structures/profiling.ml
Original file line number Diff line number Diff line change
Expand Up @@ -709,14 +709,17 @@ let register_int_stat (key : string) (getter : unit -> int) =
register_stat key (fun () -> string_of_int (getter ()))

let register_float_stat (key : string) (getter : unit -> float) =
register_stat key (fun () -> string_of_float (getter ()))
register_stat
key
(fun () ->
Format.sprintf "%.9f" (getter ()))

let print_get_statistics fmt =
Format.fprintf fmt "(@[<v 0>";
Format.fprintf fmt "(@[<v 0>@,";
Hashtbl.iter
(fun key getter -> Format.fprintf fmt ":%s %s@," key (getter ()))
statistics_table;
Format.fprintf fmt ")@]"
Format.fprintf fmt "@])@,"

(* Now, registering the statistics we want in get-statistics. *)
let () =
Expand Down

0 comments on commit 9fc24e4

Please sign in to comment.