Skip to content

Commit

Permalink
Print file total time in timelog2html
Browse files Browse the repository at this point in the history
  • Loading branch information
SkySkimmer committed Jan 8, 2025
1 parent 6f7cd27 commit cad00a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion dev/bench/htmloutput.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ let output ch ~vname ~data_files all_data =
let out fmt = Printf.fprintf ch fmt in
let ndata = Array.length data_files in

let totals = Array.fold_left (fun acc (_,data) ->
Array.map2 (fun acc d -> Q.add acc d.q) acc data)
(Array.make ndata Q.zero)
all_data
in

let maxq =
Array.fold_left (fun max (_,data) ->
Array.fold_left (fun max d ->
Expand Down Expand Up @@ -96,7 +102,10 @@ let () = out "<h1>Timings for %s</h1>\n" vname in
let () = out "<ol>\n" in

let () = data_files |> Array.iteri (fun i data_file ->
out "<li style=\"background-color: %s\">%s</li>\n" colors.(i) data_file)
out "<li style=\"background-color: %s\">%s (total time: %.3Gs)</li>\n"
colors.(i)
data_file
(Q.to_float totals.(i)))
in

let () = out "</ol>\n" in
Expand Down
4 changes: 2 additions & 2 deletions test-suite/misc/bench-render/result.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<body>
<h1>Timings for foo.v</h1>
<ol>
<li style="background-color: #F08080">foo.v.time1</li>
<li style="background-color: #EEE8AA">foo.v.time2</li>
<li style="background-color: #F08080">foo.v.time1 (total time: 3s)</li>
<li style="background-color: #EEE8AA">foo.v.time2 (total time: 2.5s)</li>
</ol>
<pre><div class="code" title="File: foo.v
Line: 1
Expand Down

0 comments on commit cad00a5

Please sign in to comment.