Skip to content

Commit

Permalink
Format cache_information output
Browse files Browse the repository at this point in the history
  • Loading branch information
3Rafal committed Dec 5, 2023
1 parent d3ec88e commit 6e276fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/kernel/mpipeline.ml
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,13 @@ let timing_information t = [
]

let cache_information t =
let fmt_bool hit = if hit then "hit" else "miss" in
let phase = ("phase", [
"reader" , !(t.reader_cache_hit);
"ppx" , !(t.ppx_cache_hit);
]) in
let cmt = ("cmt", Cmt_cache.get_cache_stats ()) in
let cmi = ("cmi", Cmi_cache.get_cache_stats ()) in
"reader" , fmt_bool !(t.reader_cache_hit);
"ppx" , fmt_bool !(t.ppx_cache_hit);
]) in
let fmt_file (filename, hit) = (filename, fmt_bool hit) in
let cmt = ("cmt", List.map ~f:fmt_file (Cmt_cache.get_cache_stats ())) in
let cmi = ("cmi", List.map ~f:fmt_file (Cmi_cache.get_cache_stats ())) in
let () = Cmt_cache.clear_cache_stats (); Cmi_cache.clear_cache_stats () in
[phase; cmt; cmi]
2 changes: 1 addition & 1 deletion src/kernel/mpipeline.mli
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ val typer_result : t -> Mtyper.result
val typer_errors : t -> exn list

val timing_information : t -> (string * float) list
val cache_information : t -> (string * (string * bool) list) list
val cache_information : t -> (string * (string * string) list) list

0 comments on commit 6e276fc

Please sign in to comment.