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

Configure CPUs for profiling #481

Open
pveentjer opened this issue Oct 22, 2021 · 3 comments
Open

Configure CPUs for profiling #481

pveentjer opened this issue Oct 22, 2021 · 3 comments

Comments

@pveentjer
Copy link

pveentjer commented Oct 22, 2021

It is possible to configure particular CPU's for profiling?

With perf I frequently check what a particular CPU is doing by passing an -C <cpu>.

Does async-profiler has such an ability? I could not find anything in the documentation.

If it doesn't have this capability, I would not mind picking up this task.

@apangin
Copy link
Collaborator

apangin commented Oct 22, 2021

Async-profiler currently does not support CPU selection.
It's easy to add support for profiling one specific CPU. Profiling a subset of CPUs is not that trivial though, since it does not fit the existing event-per-thread architecture.

What is a use case for such an option? I can't imagine how -C can be helpful, unless threads are pinned to a particular CPU. But if they are pinned, you can as well profile selected threads rather than selected CPUs.

@pveentjer
Copy link
Author

pveentjer commented Oct 23, 2021

The use case is that I want to see what is happening on a single core without knowing which threads are running.

If I see an imbalance in the CPU load between CPUs, I just want to have a quick peek. Normally I use 'perf top' for that, but it doesn't work for Java applications.

Not all architectures have pinned threads and even when threads are pinned, there can always be threads (e.g. GC) that are not pinned. So I want to see what is running on a single CPU without being too specific. Otherwise I'm at risk of filtering out relevant profiling info and chasing down the wrong problem.

I already had a look at the implementation. Passing a CPU would be simple. But indeed, let the logic work over multiple CPUs is a bit more complicated.

The key question is: will you accept a feature where the CPU(s) is configured for profiling?

@apangin
Copy link
Collaborator

apangin commented Oct 23, 2021

I don't mind adding an option for profiling only one selected CPU, as the change is rather small and straightforward.
Extending the feature to multiple CPUs isn't worth complication though.

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