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

Full color support #32

Merged
merged 77 commits into from
Feb 21, 2019
Merged

Full color support #32

merged 77 commits into from
Feb 21, 2019

Conversation

JordiChauzi
Copy link
Collaborator

Adds support for #20 and for most of #18.

Supports:

  • --cp (with the palette.map file being compatible with the flamegraph.pl version)
  • --hash
  • --colors COLORS

The hack for chain graphs is not in this PR.
It requires (I think) to change the borrowed input: &str in the frames function to an owned String, because we would need to modify some lines (the ones where we need to apply the hack). I was not so sure about making that change before any review.

JordiChauzi and others added 2 commits February 3, 2019 18:43
Not yet done:
- Testing & Benchmarking
- Hack for chain graphs
@jonhoo
Copy link
Owner

jonhoo commented Feb 4, 2019

That's awesome! Give me a little while to walk through the patch and make comments as I go :)

src/bin/flamegraph.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
src/flamegraph/color.rs Outdated Show resolved Hide resolved
@JordiChauzi
Copy link
Collaborator Author

clippy seems to be angry with the from_sorted_lines function:
warning: the function has a cyclomatic complexity of 29

I am okay with splitting the function up into smaller ones. The attributes management seems like a good start ?

@JordiChauzi
Copy link
Collaborator Author

While writing the integration test, I found one of the difference with flamegraph that we talked about before:
./flamegraph/flamegraph.pl flamegraph/test/results/perf-js-stacks-01-collapsed-all.txt --hash --colors js --bgcolors green
will not produce the same output as inferno with the same arguments.

The difference in pictures.

In js::resolve, we select the green palette if the name is composed of empty spaces. In flamegraph.pl, it is only if the name is composed of a single empty space.

Are we still sure that we want a different behavior ?

@JordiChauzi
Copy link
Collaborator Author

I added an integration test. I have another test ready for the consistent palette feature, but because we cannot currently choose the path of the palette file, it is not possible to integrate it for now...

@jonhoo
Copy link
Owner

jonhoo commented Feb 20, 2019

Ah, good catch with the integration test! I think the test we actually want is:

if !func.is_empty() && func.trim().is_empty() {

<title>uv__async_io (2 samples, 100.00%)</title><rect x="10.0" y="245" width="1180.0" height="15.0" fill="rgb(223,84,84)" rx="2" ry="2" />
<text x="13.00" y="255.5" >uv__async_io</text>
<title>uv__io_poll (2 samples, 100.00%)</title><rect x="10.0" y="261" width="1180.0" height="15.0" fill="rgb(223,84,84)" rx="2" ry="2" />
<text x="13.00" y="271.5" >uv__io_poll</text>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I follow why this file had to change in this way as a result of this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't know. Same command line, same output (at least visually...)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's pretty disturbing, because this changes locations, not just colors... Could just have been merging changes from master though I suppose.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually only change the svg element layout... I thought it could be because I'm juggling between multiple flamegraph.pl, but some options (--bgcolors) are not available on the version we point at in the inferno repo, so I could not have use the wrong version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flamegraph.pl output does not seem stable ? I generated js-perl.svg again, and I have other diffs...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, I wonder if this is because it uses a map to keep attributes, and iteration over the map is probably non-deterministic :/

Separately, feel free to do update the flamegraph submodule!

@jonhoo
Copy link
Owner

jonhoo commented Feb 21, 2019

@JordiChauzi are there any further TODOs for this PR now?

@JordiChauzi
Copy link
Collaborator Author

@JordiChauzi are there any further TODOs for this PR now?

I don't think so !

We can always do the following tasks in other PRs:

  • handle the chain palette
  • add more code coverage
  • split up the from_sorted_lines function to reduce complexity

@jonhoo
Copy link
Owner

jonhoo commented Feb 21, 2019

Looks excellent! Time to merge :D Thank you, and great work 🎉

@jonhoo jonhoo merged commit c74e8b9 into jonhoo:master Feb 21, 2019
This was referenced Feb 21, 2019
jonhoo added a commit that referenced this pull request Feb 21, 2019
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

Successfully merging this pull request may close these issues.

None yet

4 participants