Closed LukeLIN-web closed 1 year ago
You can use -r
to control the sampling rate, e.g py-spy record -r 5
for 5 HZ.
py-spy operates in blocking mode by default - where the application is paused during each sample taken. Therefore by design the app will take longer to run when profiled. Normally it shouldn't be "much longer" but only a bit - but this depends on the number of threads in your application. You can use --nonblocking
flag to have py-spy to run in non-blocking which should not affect the application at all (but might reduce the accuracy of the profile).
You can use
-r
to control the sampling rate, e.gpy-spy record -r 5
for 5 HZ.py-spy operates in blocking mode by default - where the application is paused during each sample taken. Therefore by design the app will take longer to run when profiled. Normally it shouldn't be "much longer" but only a bit - but this depends on the number of threads in your application. You can use
--nonblocking
flag to have py-spy to run in non-blocking which should not affect the application at all (but might reduce the accuracy of the profile).
Thank you!
When I run
py-spy record -o profile.svg -- python myprogram.py
It continuously showspy-spy> 347.19s behind in sampling results may be inaccurate. Try reducing the sampling rate
How can I do it? And running this command takes much longer thanpython myprogram.py
May you know why? Thank you for your time!