-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
start/stop profiling programmatically while target program is running #125
Comments
In principle, this is doable. That said, can you be more specific about the kind of profiling results you are looking to enable/disable? If it's pure CPU profiling (e.g., breakdown of CPU time by Python/native/system, on a per-line basis), Scalene imposes quite low overhead (this mode is enabled via |
I'm interested in CPU profiling primarily. Even if the overhead is low enough that I can enable it in production, I still don't want it to profile the entire duration of my job. The load varies with time and I'd like to run profiling for the periods of my choosing. |
+1 to this request. I'd love this feature also. Even for non prod workloads, it looks like I have to run the whole program and have it exit gracefully (only interested in CPU profiling) |
For your use case, @mangleddata, Scalene already has a feature that outputs profiles every so many seconds:
So, for example, you could say
and a new (CPU-only) profile would be written into the file |
@guoshimin We are considering enabling this via signals, so that you could invoke |
Much nicer approach now in a branch: https://github.com/plasma-umass/scalene/tree/signal-profiling From
|
This has now been merged. Note that this feature does not yet support |
Sorry just saw the update. I believe this will work nicely for our use case. Thanks! |
Great! Please report your findings (if successful!) here: #58 |
Is it possible that this could work with a program that has been started without For example, I'd like to run a Python script with
Then I'd like to be able to access the report from |
No, it is not possible. Scalene - as it is currently designed - needs to launch the Python program being profiled. |
Is your feature request related to a problem? Please describe.
I'd like to use scalene to profile production workloads. I can't easily reproduce the production load pattern offline, so I can't just run
scalene myprog
offline. I can't start my job asscalene myprog
in production either, because 1) I don't want to incur the overhead, and 2) I don't want it to profile from the start of program - I only want to profile specific periods and I want to see the report without stopping my job.Describe the solution you'd like
A way to start and stop profiling, and produce reports programmatically from my program. I don't mind modifying my program.
Describe alternatives you've considered
I tried py-spy which allows attaching to a running process, but the results don't look plausible. I would like to get cross validation from scalene.
Additional context
The text was updated successfully, but these errors were encountered: