jonhoo / inferno

A Rust port of FlameGraph

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Color diffusion mode gives less useful results in flamechart mode

itamarst opened this issue · comments

Consider the following profiling result:

bottleneck 20
interlude 20
bottleneck 20
interlude 20
bottleneck 20

In flamegraph mode with --colordiffusion, the bottleneck is darker red, since it is 60% of time spent vs 40%:

Screenshot from 2022-10-30 08-57-01

In flamechart mode, however, the segments all have the same red saturation:

Screenshot from 2022-10-30 08-57-30

Insofar as the goal of the color mode is to highlight more significant parts of the code, this is wrong: the relative saturation should be the same as in the flamegraph. Just because the bottleneck is chopped up doesn't mean it has ceased to be the bottleneck, it should still be redder.

I agree, although I also suspect this'll be quite tricky to fix in chart mode. You'd need a sort of two-pass thing where we first scan for how expensive each function is in aggregate (by basically doing a non-chart plot and now drawing it), and then carrying that information forward into chart mode.

Yeah, or a trie-like thing.