-
Notifications
You must be signed in to change notification settings - Fork 3
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 sampling interval #9
Comments
So, just to wrap my head around this. we'd have a "Probe" running every | --- Nothing for |
That's exactly right. |
from a concept POV I think this is fine. It sounds easy enough to implement and I'd be curious to see if we can produce reasonably similar results. import random
def some_gil():
for i in range(10000):
# On my machine the allocation of that KiB takes about 10-20us so
# this sleep is about the same order of magnitude
# Sleeping a bit more or allocating a bit more data will shift the GIL-measure in either
# direction but the random sleep will make the measurement a bit harder
time.sleep(random.random() / 100_000)
b"1" * 1024**2 |
I was thinking about this implementation.
As we have it now, it needs to continuously poll at a fairly high rate (1ms) to get a reliable feel for how busy the GIL is when compared with
py-spy
.Now I think if we have two intervals, a
sampling interval
and apolling interval
. It won't need to poll continuously for the life of the monitoring but rather poll at the (potentially) high interval only forsampling interval
example: it polls at 1ms intervals for 10ms sampling intervals.I'd assume the same numerator used (time taken to get the GIL after requested) over instead of global time, but sum of polling intervals ought to give a pretty similar result but shouldn't be as taxing on programs.
cc @fjetter
The text was updated successfully, but these errors were encountered: