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
YJIT: Let yjit_perf.py support perf with Python disabled #10246
Conversation
Can you explain a bit more how this works? With this script, you still need the Can you update the documentation in |
doc/yjit/yjit.md
Outdated
#### Using perf without Python support | ||
|
||
`misc/yjit_perf.py` also has an extra interface to support `perf` without Python support. | ||
You need to run `perf script` (instead of `perf script -s`) first, and feed the output to `misc/yjit_perf.py`. | ||
|
||
This interface exists primarily for production environments. You can run `perf script` in production, | ||
export the output locally, and run the script using it. | ||
|
||
```bash | ||
# Install perf | ||
apt-get install linux-tools-common linux-tools-generic linux-tools-`uname -r` | ||
|
||
# [Optional] Allow running perf without sudo | ||
echo 0 | sudo tee /proc/sys/kernel/kptr_restrict | ||
echo -1 | sudo tee /proc/sys/kernel/perf_event_paranoid | ||
|
||
# Profile Ruby with --yjit-perf=codegen | ||
cd ../yjit-bench | ||
PERF=record ruby --yjit-perf=codegen -Iharness-perf benchmarks/lobsters/benchmark.rb | ||
|
||
# Aggregate results | ||
perf script > /tmp/perf.txt | ||
../ruby/misc/yjit_perf.py /tmp/perf.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming that this works just as well, maybe we should only give the instructions assuming people are using perf without Python support. Less confusing if we only provide one workflow that works everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I updated the document that way in 2abcd19. I still left the instructions to build perf from source in case we want to develop a new feature using something we currently don't parse but is available in the original perf events.
The point is that we can separate the machine to be profiled and the one to aggregate the results can be separated. The profiling target machine still needs perf tool. But it no longer requires perf with Python scripting (because Python is used only for aggregation).
Correct. The example output of
done 1d5c851 |
* YJIT: Let yjit_perf.py support perf with Python disabled * Update yjit.md about perf * Recommend the extra interface by default
Many Linux distributions don't enable Python scripting in
perf
by default.perf
in our production environment didn't have that either. We could change our production image to manually buildperf
to fix the problem too, but it's a lot of work to do it everywhere.This PR proposes to add an alternative way to run our perf script. It adds an extra interface to parse the output of
perf script
to obviate Python scripting support in production environments. With this PR, we can use this script like this:production$ perf script > /tmp/perf.txt local$ scp production:/tmp/perf.txt /tmp/perf.txt local$ misc/yjit_perf.py /tmp/perf.txt