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

Programmatically start/stop py-spy recording #652

Open
michaeleisel opened this issue Feb 8, 2024 · 1 comment
Open

Programmatically start/stop py-spy recording #652

michaeleisel opened this issue Feb 8, 2024 · 1 comment

Comments

@michaeleisel
Copy link

I want to run a py-spy profiling, e.g. py-spy record -o /tmp/py_flamegraph.svg --idle python3 ${file}, but only profile a certain piece of the code, because the code before and after it adds noise in the flamegraph. I could use attach to a running pid, but it's cumbersome and tricky to ensure that I attach and detach at the appropriate times. Instead, I'd like something simple like:

py_spy.begin_recording()
# code
py_spy.end_recording()

and maybe a flag for the CLI telling it not to automatically begin, but rather to let the profiling begin programmatically

@flying-sheep
Copy link

flying-sheep commented Apr 30, 2024

Yeah, that would be great! But please use the search function: #531

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

No branches or pull requests

2 participants