GeezerVison is showing github.com — Configure alternative profiling signal · Issue #759 · async-profiler/async-profiler
Configure alternative profiling signal #759DescriptionBackground
Async-profiler heavily relies on POSIX signals. In perf_events and itimer modes, a profiling event triggers delivery of SIGPROF to a currently running thread. In wall mode, a thread being sampled receives SIGVTALRM. Async-profiler assumes the application does not use SIGPROF or SIGVTALRM for other purposes.
Furthermore, since a signal handler is a global property of a process, it is not possible to run two instances of async-profiler on the same process concurrently. For example, this can be helpful for doing some ad-hoc profiling with a custom configuration while continuous profiling is already running.
Proposal
Introduce new signal argument to override the default profiling signal(s). It can be used to configure continuous profiler to avoid conflict with an ad-hoc profiler.
E.g. -agentlib:asyncProfiler=start,event=cpu,signal=36 will force async-profiler use SIGRTMIN+2 instead of SIGPROF for CPU profiling.
To change both cpu and wall signals, we'll use syntax like signal=36/37. Reacted by Johannes Bechberger and Yonatan Goldschmidt Activityadded a commit that references this issue on Jul 4, 2023#759: Configure alternative profiling signal parttimenerd commented on Jul 12, 2023 Couldn't async-profiler detect this and choose other signals automatically? The underlying APIs seem to offer the possibility. apangin commented on Jul 12, 2023 CollaboratorAuthor More actions What it can detect automatically is whether a signal has a non-default handler. This does not yet tell if a signal is really used, but this could be sufficient in some cases. However, sometimes async-profiler needs to cooperate with an external process, e.g., system-wide eBPF profiling agent. In these cases, the signal should be set explicitly to be in line with what an external agent uses. parttimenerd commented on Jul 12, 2023
What it can detect automatically is whether a signal has a non-default handler.
And maybe warn the user about this fact.
However, sometimes async-profiler needs to cooperate with an external process, e.g., system-wide eBPF profiling agent. In these cases, the signal should be set explicitly to be in line with what an external agent uses.
But maybe we could by default make it choose its signals automatically and have a setting to set them explicitly. Or have a signal=auto option. apangin commented on Jul 14, 2023 CollaboratorAuthor More actions I'm not sure how important it is right now, but it's an interesting idea. parttimenerd commented on Jul 14, 2023 When I find time after working on my JEP, I might take a look into this :) added a commit that references this issue on Mar 16, 2024#759: Discover available profiling signal automatically apangin commented on Mar 16, 2024 CollaboratorAuthor More actions I pushed the fix to automatically find an available signal if the default one is already used.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|