diff --git a/sledge/report/sledge_report.ml b/sledge/report/sledge_report.ml index b73f1c558..1e2ba542c 100644 --- a/sledge/report/sledge_report.ml +++ b/sledge/report/sledge_report.ml @@ -284,13 +284,13 @@ let write_html ranges rows chan = system
(sec) Δ
Δ%%
- alloc
(MB) + alloc
(bytes) Δ
Δ%%
- promo
(MB) + promo
(bytes) Δ
Δ%%
- peak
(MB) + peak
(bytes) Δ
Δ%%
Status @@ -315,20 +315,41 @@ let write_html ranges rows chan = align=\"right\">%12.3f\n" t in + let mem ppf w = + Printf.fprintf ppf + "%s\n" + Core_kernel.Byte_units.(to_string_short (of_megabytes w)) + in let nondelta ppf t = Printf.fprintf ppf "%12.3f\n" t in + let nondelta_mem ppf w = + Printf.fprintf ppf "%s\n" + Core_kernel.Byte_units.(to_string_short (of_megabytes w)) + in let delta max pct t ppf d = let r = 100. *. d /. t in Printf.fprintf ppf "%12.3f\n\ - %12.2f%%\n" - (color max d) d (color pct r) r + %12.0f%%\n" + (color max d) d (color pct r) + (Base.Float.round_decimal ~decimal_digits:2 r) + in + let delta_mem max pct w ppf d = + let r = if Float.(d < 0.000001) then 0. else 100. *. d /. w in + Printf.fprintf ppf + "%s\n\ + %12.0f%%\n" + (color max d) + Core_kernel.Byte_units.(to_string_short (of_megabytes d)) + (color pct r) + (Base.Float.round_decimal ~decimal_digits:2 r) in let timed = delta ranges.max_time ranges.pct_time in - let allocd = delta ranges.max_alloc ranges.pct_alloc in - let promod = delta ranges.max_promo ranges.pct_promo in - let peakd = delta ranges.max_peak ranges.pct_peak in + let allocd = delta_mem ranges.max_alloc ranges.pct_alloc in + let promod = delta_mem ranges.max_promo ranges.pct_promo in + let peakd = delta_mem ranges.max_peak ranges.pct_peak in let pf_status ppf s = let status_to_string = Format.asprintf "%a" Report.pp_status in Printf.fprintf ppf "%s" (String.take 50 (status_to_string s)) @@ -391,21 +412,22 @@ let write_html ranges rows chan = { allocated= allocated_delta ; promoted= promoted_delta ; peak_size= peak_size_delta } ) -> - pf "%a%a%a%a%a%a" time allocated (allocd allocated) - allocated_delta time promoted (promod promoted) promoted_delta - time peak_size (peakd peak_size) peak_size_delta + pf "%a%a%a%a%a%a" mem allocated (allocd allocated) allocated_delta + mem promoted (promod promoted) promoted_delta mem peak_size + (peakd peak_size) peak_size_delta | Some {allocated; promoted; peak_size}, None -> pf "%a\n\ %a\n\ %a\n" - time allocated time promoted time peak_size + mem allocated mem promoted mem peak_size | None, Some {allocated; promoted; peak_size} -> pf "%a\n\ %a\n\ %a\n" - nondelta allocated nondelta promoted nondelta peak_size + nondelta_mem allocated nondelta_mem promoted nondelta_mem + peak_size | None, None -> pf "