PYTHON-5404 - Add docs for profiling execution#2402
PYTHON-5404 - Add docs for profiling execution#2402NoahStapp merged 4 commits intomongodb:masterfrom
Conversation
tools/generate_flamegraph.py
Outdated
| import sys | ||
|
|
||
|
|
||
| def main(): |
There was a problem hiding this comment.
Is it worth having this file at all? We're adding 60 lines of code to change this:
pip install py-spy
py-spy record -o output.svg -- <path/to/script>
into:
pip install py-spy
just flamegraph <--output_name=profile> <--sample_rate=2000> <path/to/script>
Can we just pass all the args to py-spy record and call it a day? It already has a default value with sample_rate so all we really save here is the -o profile.svg which I'm not sure is worth this extra file. The just flamegraph approach is also inflexible since it doesn't allow passing arbitrary options to py-spy record.
There was a problem hiding this comment.
Good point. I like the conciseness of just flamegraph, but we're already requiring enough args and manual steps that we don't save much at all by having it. Just including docs on how to run py-spy should be sufficient here.
CONTRIBUTING.md
Outdated
| 2. Inside your test script, perform any required setup and then loop over the code you want to profile for improved sampling | ||
| 3. Run the `flamegraph` justfile target to generate a `.svg` file containing the flame graph: | ||
| ```bash | ||
| just flamegraph <output_name=profile> <sample_rate=2000> <path/to/script> |
There was a problem hiding this comment.
Should we even add this to just? Since we already need to install py-spy manually why not document the py-spy command to run without just.
|
Thanks! |
No description provided.