-
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
The meaning of the "samples" count #365
Comments
seems to be enough, perhaps my naming could be improved haha ( |
Jongy
added a commit
to Jongy/py-spy
that referenced
this issue
Mar 21, 2021
This number is more useful for the user (as opposed to "the number of sampling intervals", which we had until now). It matches the meaning of "samples" in other profiling tools, e.g flamegraphs, Linux's "perf", and others. We do not account samples whose recording is skipped: that is, GIL-less samples if --gil is given, idle samples unless --idle is given. Closes: benfred#365
benfred
pushed a commit
that referenced
this issue
Mar 22, 2021
This number is more useful for the user (as opposed to "the number of sampling intervals", which we had until now). It matches the meaning of "samples" in other profiling tools, e.g flamegraphs, Linux's "perf", and others. We do not account samples whose recording is skipped: that is, GIL-less samples if --gil is given, idle samples unless --idle is given. Closes: #365
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Let's say I'm running
py-spy record -o output -f raw --gil -d 3 -r 10 ...
on an idle process. When done, py-spy will print happily:But reading the
output
file, it's actually empty. So why did it tell me it has 30 samples?And on the other hand - should I run a multithreaded app, this time passing
--idle
, I'll get a graph with >30 samples.In the "flamegraphs"/"stackcollapses" jargon, a sample is a single stack from a single thread. Linux's
perf
also uses "samples" this way. py-spy uses "samples" for "iterations of the profiling loop" - which is a number simply decided byduration * rate
.I think we should consider changing it, to be on-par with the naming used in other profilers. This "samples" count is misleading - it's not what you see after the profiling is done.
I thought it'd be a simple fix as:
but that doesn't work out-of-the-box because we use the samples count to stop when reaching
max_samples
. So it'd require a few more changes I guess, which I'll happily do and open a PR, just tell me if you like this change @benfred .The text was updated successfully, but these errors were encountered: