-
Notifications
You must be signed in to change notification settings - Fork 55
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
How do you profile applications that use multiprocessing? #179
Comments
Oh, additionally, I think that if you attach This is easy enough to work around (fork, then attach profiler, rather then attach, and then fork), but it might be a decent idea to have the multiple-enable checking code to see if the value of (I'm guessing a bit here, since I don't have a stand-alone test case to validate my assumptions, and how |
I'd be interested if you have any further code on this, I'm facing the same issue when using multi-processing. |
I wound up finding https://github.com/benfred/py-spy to be pretty handy, albeit it only works for cpython (I use mostly pypy3 these days). You can attach it to any running python process, so I'd just attach it to the python process using the most CPU, and have a look-see. It's not ideal, but it'd enough to get a rough idea where stuff is. Writing a extension that hooks Actually, https://github.com/uber/pyflame claims it supports multithreading, so that's another avenue to investigate. |
Thanks for the feedback, I've also been using py-spy, with the same issue concerning pypy ;-) I've tried pyflame and although is supports multi-thread (like vmprof and py-spy) it does not help with multi-process : forked are completely invisible to it. |
@PierreRust So how do you solve this problem later? I have no idea about this. |
I have a very, very parallelized project, that uses python multiprocessing extensively.
Is there a canonical way to use vmprof for profiling applications that have more then one process? Right now, you only get the main thread profile data.
I wonder if there's a way to monkey patch multiprocessing to install the profiler in all created processes.
Also, is there a way to join multiple profile output files? It'd be ideal if you could have one file writer process that aggregated all the sampled process at runtime, but I can also see having each thread dump it's own profile log file, that then gets aggregated once your application has completed.
The text was updated successfully, but these errors were encountered: