Lower level API to flamegraph renderer
stepancheg opened this issue · comments
Current API only accepts strings.
Would be helpful if it could accept something like:
struct Tree {
value_excluding_children: u64,
label: String,
subtrees: Vec<Tree>,
node_type: NodeType, // kernel, library, ...
...
}
When flamegraph is generated programmatically, converting to string and back makes code less type safe (e.g. strings may be not escaped correctly).
But eventually API could be evolved to provide more detailed information. In particular, in out setup we measure both number of bytes and number of chunks.
Such API can be extended to provide labels to nodes. So it would still take value_excluding_children
to compute width, but Tree
could have additional node like extra: String
which would be shown when clicked, and we could place number of chunks or any other text info into that extra
field.