Skip to content
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

Filtering based on thread name. #746

Open
eliphatfs opened this issue Feb 4, 2025 · 1 comment
Open

Filtering based on thread name. #746

eliphatfs opened this issue Feb 4, 2025 · 1 comment

Comments

@eliphatfs
Copy link

I'm using py-spy to profile a PyTorch program. It has a lot of threads.
I also care about the native stack traces on the main and the collation thread (--native).

The thing is py-spy can't keep up with so many threads. It shows messages like

py-spy> 1.66s behind in sampling, results may be inaccurate. Try reducing the sampling rate
py-spy> 1.81s behind in sampling, results may be inaccurate. Try reducing the sampling rate
py-spy> 2.13s behind in sampling, results may be inaccurate. Try reducing the sampling rate

I need a great bit of sampling rate (at least 40-50) for the profile to be helpful to analyze the performance, so I cannot reduce the sampling rate too much.

Thus, I want to propose a feature to be able to filter based on thread names, ignoring these queue feeder threads so py-spy only need to sample the threads that we care about. Most threads are multi-processing utility threads (QueueFeeder). It would be better if we can also control more fine-grained behaviors of the sampler, like selectively enabling --native for some threads (since the maximum sampling rate py-spy is able to keep up with dropped from ~80 to ~20 when enabling native).

@olejorgenb
Copy link

Ref: #559 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants