Builder_web.job_build_treemap: Implementing partitioning of Info tree

This commit is contained in:
rand00 2021-12-15 23:09:23 +01:00 committed by Reynir Björnsson
parent 79c40473b4
commit b8c40861f3

View file

@ -212,13 +212,28 @@ let add_routes datadir =
m "Error reading ELF file %a" Fpath.pp path))
>>= fun infos ->
let svg_html =
let info, excluded =
let size, info =
infos
|> Info.import
|> Info.diff_size
|> Info.diff_size_tree
in
(*> Note: this heuristic fails if one has all subtrees of equal size*)
let node_big_enough subtree =
match Info.(subtree.T.value.size) with
| None -> true
| Some subtree_size ->
let pct = Int64.(to_float subtree_size /. to_float size) in
pct > 0.05
in
info
|> Info.prefix_filename
|> Info.cut 2
|> Info.partition_subtrees node_big_enough
in
info
|> Treemap.of_tree
|> Treemap.to_html_with_scale ~binary_size
|> Treemap.to_html_with_scale ~binary_size (*goto add 'excluded' via some new param*)
|> Fmt.to_to_string (Tyxml.Html.pp ())
(* |> Treemap.svg
* |> Fmt.to_to_string (Tyxml.Svg.pp ()) *)