Monitoring different processes using PAPI_overflow

15 views
Skip to first unread message

Mariana Barros

unread,
May 13, 2025, 9:34:30 AMMay 13
to ptools-perfapi
Hello,
I am trying to monitor different processes running in the machine using PAPI_overflow. In order to do that, I list all the PIDs from the processes currently running, and, for each one, I create and add events to an eventset, set an overflow, and try to attach this eventset to the PID. However, even though the code compiles and runs without raising any errors, the overflows are only triggered for the monitoring process, and not for any other one. 

Does anyone know if it is possible to use PAPI_overflow to monitor different external processes? And if so, how should I proceed?

Thank you in advance.

Anthony Danalis

unread,
May 19, 2025, 12:21:04 PMMay 19
to Mariana Barros, ptools-perfapi
Hello,

Unfortunately, "PAPI can not be attached to thread or cpu if overflowing" (per papi.c:2900). Do you need to use overflow for your monitoring? Could you not sample the counters in a loop?

Thanks,
Anthony

--
You received this message because you are subscribed to the Google Groups "ptools-perfapi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ptools-perfap...@icl.utk.edu.
To view this discussion visit https://groups.google.com/a/icl.utk.edu/d/msgid/ptools-perfapi/ed0dd1a1-3c3d-40e4-93ac-37052e424ec9n%40icl.utk.edu.

Phil Mucci

unread,
Jun 12, 2025, 12:46:35 PMJun 12
to Anthony Danalis, Mariana Barros, ptools-perfapi
Hi all,

I may have written that line of code long ago - a time when we were maintaining our own kernel patch for the PMU available on the Pentium Pro - Linux was only 5 years old - and we did overflow / multiplexing in user space 😳

Today’s reality is that the Linux kernel perf subsystem supports third party overflow / profiling semantics. The latter is actually what you are after - you don’t want to be delivering a signal to a second process on every overflow - you want to read a buffer of addresses where overflow occurred (aka the perf sample buffer).

I’m going to wager there’s not a huge implementation lift should someone want to follow the code path through. 

If you want to just profile a code using PAPI, rather than writing your own infra, hpctoolkit could do what you are after.

Hope this helps,

On May 19, 2025, at 18:21, Anthony Danalis <adan...@icl.utk.edu> wrote:


Reply all
Reply to author
Forward
0 new messages