I have read source code of gperftools(https://github.com/gperftools/gperftools/blob/f7c6fb6c8e99d6b1b725e5994373bcd19ffdf8fd/src/profile-handler.cc#:~:text=sevp.sigev_notify_thread_id%20%3D%20syscall(SYS_gettid)%3B).
static void StartLinuxThreadTimer(int timer_type, int signal_number,
int32 frequency, pthread_key_t timer_key) {
int rv;
struct sigevent sevp;
timer_t timerid;
struct itimerspec its;
memset(&sevp, 0, sizeof(sevp));
sevp.sigev_notify = SIGEV_THREAD_ID;
**sevp.sigev_notify_thread_id = syscall(SYS_gettid);**
sevp.sigev_signo = signal_number;
clockid_t clock = CLOCK_THREAD_CPUTIME_ID;
// other code
}
the above code shows that SIGPROF will only be handled by the current thread which called ProfilerStart function. So how does gperftools get cpu profiling of other threads?
I have read source code and googling my problem.