-
Notifications
You must be signed in to change notification settings - Fork 435
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
Duration seems to depend on the number of processes, not seconds. Or on threads... #33
Comments
Weird. Setting the duration flag seems to work appropiately for me:
I'm wondering if what's happening here is that we're sampling slower than 1K times a second for some reason, and it isn't keeping up. I'm going to add some code to detect if this happens and write out an error message in this case. Can you try again with setting a lower rate just to verify? Maybe |
At high rates, it's quite possible that we won't be able to sample the python process fast enough. This could lead to inaccurate results, and also might lead to issues like #33 . Fix by warning if we aren't keeping up in sampling. Also tweak the default sampling rate to be lower (200). While I can sample at around 10K samples a second on any machine I've tested this should help here too.
The 0.1.6 release has code to warn if we aren't sampling fast enough - which I think was the issue here |
I made an update and now get the warning on the sample rate 1000 like this |
thanks for letting me know! It's weird that the max sampling rate is so low for your system (I have no problem on most machines up to 10K samples a second), but I'm glad the problem is sorted out. |
I'm testing the flamegraph for a minute on PID 502 calling
py-spy -p 502 -d 60 -f /tmp/flame
on a Linux CentOS 5 machine,
I get a progress bar that only moves slowly.
I'm using the default sample rate of 1000.
It seems that duration seconds doesn't consider cases where
there's less samples than the maximum defined. Or see 2nd
theory below...
Output:
Sampling process 1000 times a second for 60 seconds
████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 60000/60000
Wrote flame graph '/tmp/flame'. Samples: 60000 Errors: 0
Also in this scenario, the flamegraph might be wrong/confusing,
The generated svg file has a first line
Function all: (255,466 samples 100%)
Which is inconsistent with the collected 60000 samples.
The next line shows " /main.py:25)" at 59999 samples
and the rest at "_bootstrap" (threading.py:884) 195,457 samples,
so it's possible that the default 1000 samples a second are taken,
but those from threads don't count towards the duration.
The job ran about 4 minutes, so that would work out.
The text was updated successfully, but these errors were encountered: