-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add support for profiling benchmarks using perf-record
#214
base: main
Are you sure you want to change the base?
Conversation
Add a hook that profiles benchmarks using `perf-record` when enabled
I will try to take a look at it by this weekend :) |
def exec_perf_cmd(self, cmd): | ||
self.ctl_fd.write(f"{cmd}\n") | ||
self.ctl_fd.flush() | ||
res = self.ack_fd.readline() |
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.
res = self.ack_fd.readline() | |
_ = self.ack_fd.readline() |
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.
It's for passing the CI
appended to the command line of perf-record, if provided. | ||
""" | ||
|
||
def mkfifo(self, tmpdir, basename): |
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.
nit: Can we move down mkfifo / exec_perf_cmd to under the dunder methods?
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.
Thanks for doing this. This is a tricky one to add a test and CI for -- I did test it locally and it "worked for me". I think for most purposes we can rely on bench_runner to ensure this doesn't bit rot.
Would you like to update the documentation for it? https://github.com/psf/pyperf/blob/f3131745472b108b95cd5e20733cdf4a20ec0a37/doc/run_benchmark.rst#specializer-statistics-pystats |
This PR adds support for profiling benchmarks using a
perf-record
hook.perf-record
is enabled only during benchmark execution by using perf's support for control fifos.For example, to collect stacks using DWARF debug information, one could run:
This should resolve #213.