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

Improve flamegraph profiling instructions #12521

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Sep 18, 2024

Which issue does this PR close?

Related to #11682

Rationale for this change

While working on #12092 I found myself needing to make flamegraphs and the instructions were a bit lackign.

I also made a short (5 min) video to help this process along https://youtu.be/2z11xtYw_xs that I wanted to link as well

What changes are included in this PR?

Update the flamegraph creation cookbook. Here is how it looks rendered:

Screenshot 2024-09-18 at 9 31 15 AM

Are these changes tested?

I tested them locally

Are there any user-facing changes?

Better docs

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Sep 18, 2024
@alamb
Copy link
Contributor Author

alamb commented Sep 18, 2024

FYI @Rachelint

@Rachelint
Copy link
Contributor

Nice! I am double checking the steps in docs in my local.

echo "select * from table;" >> test.sql
sudo dtrace -c './target/debug/datafusion-cli -f test.sql' -o out.stacks -n 'profile-997 /execname == "datafusion-cli"/ { @[ustack(100)] = count(); }'
/tmp/fg/FlameGraph/stackcollapse.pl out.stacks | /tmp/fg/FlameGraph/flamegraph.pl > flamegraph.svg
CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root --unit-test datafusion -- dataframe::tests::test_array_agg
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we disable lto when profiling?
Seems it makes a small difference to flamegraph, and will lead to very very long building time...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I personally don't change the build settings when profiling -- it seems to work just fine for me

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally don't change the build settings when profiling -- it seems to work just fine for me

OK, the setting may be not something matters.

Copy link
Contributor

@Rachelint Rachelint left a comment

Choose a reason for hiding this comment

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

🚀 LGTM.
I try it following the instructions, and it works well.

@Rachelint
Copy link
Contributor

Thanks @alamb

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

great thanks @alamb

@comphead comphead merged commit 21e35ee into apache:main Sep 18, 2024
5 checks passed
@alamb
Copy link
Contributor Author

alamb commented Sep 19, 2024

Thank you @Rachelint and @comphead

@alamb alamb deleted the alamb/profiling_docs branch September 19, 2024 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants