Both Instruments and iprofiler are able to use performance counters (PMCs) to monitor application performance. But, I would like to know whether there is an API to access PMCs from an application. In Linux this can be done, for instance, by calling sys_perf_event_open
, and then reading from the file descriptor returned by the syscall. Alternatively, libpfm can be used too.
For OS X, I have found the Intel Performance Counter Monitor. Unfortunately, it requires installing a kernel module. The module is not signed, and therefore it might not be straightforward to load it for end-users.
Given that both Instruments and iprofiler are actually able to access PMCs (without installing any kernel module), I wonder wether there is some (unlisted) API to access PMCs.