This is a lightweight hook-less framework for user space counting.
It doesn't attempt to do many of the both useful and generalisable things that hwpmc(4) does -- no sampling mode, no symbol resolution, etc -- so it's not a substitute in a general way to hwpmc(4).
For the things we're measuring in CHERI Project, the cost of context switching registers may be higher than the cost of what we are measuring.
In our benchmark workloads, we're interested in end-to-end resource use, so we often do want to include other expenses on the core into the results.
No virtualisation so one program at a time drives all counters use across the whole system. This also does nothing about interrupts.
This has to be run with cpuset(1) to ensure we configure counters, run program, and read results on the same core. The system also had to be idling to ensure the core does not take unrelated to the benchmark workloads.
This includes RISC-V SBI PMU driver.
Obtained from: CheriBSD