Perfctr is a software tool that allows the Linux kernel to access and use Performance-Monitoring Counters.
Perfctr aids in the creation of virtual PMCs for each Linux process. This creates the illusion of private PMCs unique to each process without interference from other processes in the system. These virtual PMCs have 64-bit precision, while processors presently only implement 32, 40, or 48-bit PMCs. To avoid the overhead of a system call, most machines allow the virtual PMCs to be sampled entirely in user-space.
Users can access the virtual PMCs and the global-mode or system-wide PMCs in a straightforward manner. To do so, the user needs to open /dev/perfctr and issue system calls through the resulting file descriptor. A user-space library is also included which provides a more high-level interface. The user-space library is accompanied by example programs that show how to use the driver and the library.
Additionally, perfctr supports a performance-counter overflow interrupt for Intel P4 and P6, and AMD K7 and K8 processors.
There are some limitations to using perfctr. First, kernels older than 2.4.16 are not supported. However, users can use the previous stable series, perfctr-2.4, if they must use an older kernel. Second, older kernels do not support AMD64 (x86-64), and the performance counters in hyper-threaded P4s/Xeons cannot be used. Third, application code compiled for perfctr-2.4 is not compatible with perfctr-2.6, and vice versa. Finally, this series does not support 2.6 kernels.
The perfctr package makes it possible to calculate aggregate event and cycle counts for sections of code, even though many x86-type processors use out-of-order execution causing difficulty in attributing exact event or cycle counts to individual instructions.
Centaur WinChip C6/2/3 support requires users to disable the TSC. Finally, the performance-counter interrupt facility requires SMP or uniprocessor APIC support with a reasonable non-buggy BIOS.
Perfctr offers a useful tool for users who want to monitor the performance of their system using virtual PMCs and simplified access to global-mode or system-wide PMCs.
Version 2.7.21.2: N/A