Performance Counter Usage

Performance counters can be accessed in multiple ways, normally through a higher-level tool. For This work, we chose to directly use Linux's built-in performance counter calls, which we place at strategic locations in the source code of VMS. The reasons for this choice and details of how to use the calls is in the perf_event usage. It references this design document from the Linux source tree: Design document describing the details of performance counters in the Linux kernel. The PDF should be read before trying to use the visualization system, in order to understand what can go wrong.

The most common reason for perf counters not working are:

  • Kernel has to be compiled with CONFIG_PERF_COUNTERS=y (which is the default for recent kernels)
  • /proc/sys/kernel/perf_event_paranoid must contain 1 (the most common reason the calls fail)

To check the CONFIG_PERF_COUNTERS compiler switch,

  • execute uname -r to print the kernel release and look for the corresponding config file in the /boot directory
  • execute this to check the switch: cat /boot/config-uname output | grep CONFIG_PERF_COUNTERS
  • It may also work to do this: gzip -cd /proc/config.gz | grep CONFIG_PERF_COUNTERS

To check the perf_event_paranoid file, execute: cat /proc/sys/kernel/perf_event_paranoid (it should print out "-1"). To change it, you need root priveleges, then just use vi or any other text editor, and put a "-1" all by itself on the first line of the file.

Here are some pages from a site by a developer on the PAPI project. The site has a fairly complete discussion of all things related to Linux performance counter usage: