Attribute a binary's size to its OCaml modules and libraries
0

Configure Feed

Select the types of activity you want to include in your feed.

dissect: simplify report table rendering

+12 -11
+12 -11
lib/report.ml
··· 30 30 in 31 31 Fmt.pf ppf "%s@.@." (Console.Span.to_string (Console.Span.styled style msg)) 32 32 33 + let table_rows ~attributed ~bar_max ~bar_w buckets = 34 + List.map 35 + (fun (b : Weigh.bucket) -> 36 + [ 37 + b.label; 38 + human b.bytes; 39 + Fmt.str "%d%%" (pct ~whole:attributed b.bytes); 40 + Console.Bar.render ~width:bar_w ~pct:(pct ~whole:bar_max b.bytes) (); 41 + ]) 42 + buckets 43 + 33 44 let render ~ctx ?(top = 20) ppf (r : Weigh.report) = 34 45 let code = List.filter (fun b -> not (is_overhead b)) r.buckets in 35 46 let overhead = r.total - r.attributed in ··· 62 73 column ""; 63 74 ] 64 75 in 65 - let rows = 66 - List.map 67 - (fun (b : Weigh.bucket) -> 68 - [ 69 - b.label; 70 - human b.bytes; 71 - Fmt.str "%d%%" (pct ~whole:r.attributed b.bytes); 72 - Console.Bar.render ~width:bar_w ~pct:(pct ~whole:bar_max b.bytes) (); 73 - ]) 74 - rows_buckets 75 - in 76 + let rows = table_rows ~attributed:r.attributed ~bar_max ~bar_w rows_buckets in 76 77 let table = 77 78 Console.Table.of_string_rows ~border:Console.Border.rounded cols rows 78 79 in