Re: libperf: lack of interface

From: Peter Zijlstra
Date: Wed Sep 01 2021 - 05:59:17 EST


On Wed, Sep 01, 2021 at 09:45:10AM +0000, nakamura.shun@xxxxxxxxxxx wrote:
> Hello.
>
> I'm trying to change rdpmc test in perf_event_tests[1] to use libperf, but libperf doesn't have enough interfaces.
> Does anyone plan to implement any of these libperf features?
>
> - Interfaces that can run ioctl (PERF_EVENT_IOC_RESET) from userland
> - Interfaces that can run fcntl (SIGIO) from userland
>
> [1] https://github.com/deater/perf_event_tests/tree/master/tests/rdpmc

While IOC_RESET has it's uses, it really shouldn't be used in
combination with RDPMC, it destroys the whole 'dont do
syscalls'/performance thing.

The typical RDPMC usage is:

/* setup counter on self */

...

start = RDPMC
/* your code */
end = RDPMC
delta = end - start;

...

Nowhere do we need a reset...