inferno icon indicating copy to clipboard operation
inferno copied to clipboard

Option for true "start" for nodes

Open Mark-Simulacrum opened this issue 3 years ago • 1 comments

Currently, inferno, even in flame chart mode, doesn't really support passing in start time and end time (rather than just a count). This means that you can't get output like the chrome profiler tools -- note the gaps between some of the children nodes, rather than everything being left-aligned.

Ideally this would be an option of some sort, but I'm not sure how to best make it work with the string-based API...

Alternatively, inferno's SVG generation and such could be factored out such that it is called to arrange a tree of objects with explicit starts/stops and depths and it generates SVG and JS to deal with that. That would work too, and allow for much greater flexibility. It definitely feels like a harder project though :)

image

Mark-Simulacrum avatar Aug 09 '20 21:08 Mark-Simulacrum

Hmm, yeah, this'll be a challenge to add. inferno is very much built around what flamegraph does, and it is entirely focused on sample counts, not time. That said, inferno does ultimately compute a start and end time for each frame https://github.com/jonhoo/inferno/blob/432d653c8387389e47615d3100ffcc5baa3a14d2/src/flamegraph/merge.rs#L68-L73

So it should be possible to feed user input directly into that. What we'd need first is https://github.com/jonhoo/inferno/issues/30 ( see also https://github.com/jonhoo/inferno/issues/164). I know @Licenser started experimenting over in https://github.com/jonhoo/inferno/pull/98, but I don't think it got past the experimentation stage. @koute has also expressed interest in a library-based API (as opposed to a string-based one).

I'm pretty swamped these days, otherwise I'd be all over trying to build that library interface — it sounds like a fun challenge. Realistically, I probably won't be able to look at this much until November at the earliest. I'd be happy to try and guide a PR effort though! It may also be that @bcmyers, @jasonrhansen, or @AnderEnder can lend a hand — they also have a lot of experience with this codebase :)

jonhoo avatar Aug 10 '20 13:08 jonhoo