Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flamechart reversing is ... unexpected #236

Open
itamarst opened this issue Apr 7, 2022 · 1 comment
Open

Flamechart reversing is ... unexpected #236

itamarst opened this issue Apr 7, 2022 · 1 comment

Comments

@itamarst
Copy link
Contributor

itamarst commented Apr 7, 2022

Consider the following profiling report:

a 1
b 2
c 3
this 5
is 4
a 3
test 2

Per https://docs.rs/inferno/latest/inferno/flamegraph/struct.Options.html#structfield.flame_chart, the input will be "reversed". And indeed, the resulting SVG has frames in the reverse order "test, a, is, this, c, b, a":

output.svg

The question is, why is this in reverse order? Given time in standard charts virtually always goes from left to right, you would expect the ordering in the flamechart to match that of the input file and go from left to right, i.e. "a, b, c, this, is, a, test" in this example.

I can easily enough emit my input lines in reverse order, but this seems wrong, and will confuse anyone who uses the feature for the first time.

@jonhoo
Copy link
Owner

jonhoo commented Apr 10, 2022

I believe this was done purely to match the behavior of the original flamegraph implementation. @AnderEnder may be able to shed more light though, as they originally contributed #125.

As for why the original flamegraph does this, my guess would be it's because of scrolling. By having the most recent time to the left, you can see what last happened, and thus is most likely to be relevant, without having to scroll far right. Whether that's a good reason I'm not so sure, but 🤷 I'm not opposed to changing this either if we decide non-reversed just overall makes more sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants