jonhoo / inferno

A Rust port of FlameGraph

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option for true "start" for nodes

Mark-Simulacrum opened this issue · 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

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

let frame = TimedFrame {
location: key,
start_time: frame_time.start_time,
end_time: time,
delta: frame_time.delta,
};

So it should be possible to feed user input directly into that. What we'd need first is #30 ( see also #164). I know @Licenser started experimenting over in #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 :)