perfmon2: pfmon AMD X86-64 processor documentation
perfmon2
   the hardware-based performance monitoring interface for Linux
 
Pfmon AMD x86-64 processor documentation

This page describes the AMD X86-64 processor specific features of pfmon.

Table of contents for AMD X86-64 processor
  1. Introduction
  2. Command line options
  3. Event counter mask
  4. Event inverse mask
  5. Event edge mask
  6. References
To go back to top level documentation click here.
1. Introduction

Pfmon provides access to ALL the AMD X86-64 specific features while running in 64-bit mode. There is no support for 32-bit mode.

The following features are supported:

  • 4 counters
  • Event counter mask
  • Event inverse mask
  • Event edge mask

2. Command line options

The AMD X86-64 processor specific options of pfmon are as follows:

--counter-mask=msk1,msk2,...set event counter mask (0,1,2,3)
--inv-mask=i1,i2,...set event inverse counter mask (y/n,0/1)
--edge-mask=e1,e2,...set event edge detect (y/n,0/1)

3. Event counter mask

Each counter supports a threshold value below which the occurrences of an event are not counted. If the threshold is set to n, then the counter is incremented by 1 only if there are more than n occurrences of the event per cycle.

Pfmon supports this threshold mechanism with the --counter-mask option which is used as follows:

   $ pfmon --us-c -eRETIRED_INSTRUCTIONS ls /dev/null
   /dev/null
   214,855 RETIRED_INSTRUCTIONS

This counts the total number of instructions retired for the command ls while executing at the user level. Now we want to count the number of times two or more instructions are retired per cycle:

   $ pfmon --us-c -eRETIRED_INSTRUCTIONS --counter-mask=2 ls /dev/null
   /dev/null
   67,221 RETIRED_INSTRUCTIONS

Here two or more instructions where retired 67,221 times.

When this option is not specified the counter mask is set to zero, i.e., each occurrence increments the counter. Possible values for the mask are 1, 2, 3, and 0. The --counter-mask option can be used to set the counter masks of multiple events:

   $ pfmon --us-c -eRETIRED_INSTRUCTIONS,RETIRED_UOPS --counter-mask=2,1 ls /dev/null

This filtering can be inverted using the --inv-mask option.

4. Event inverse mask

It is possible to invert the filtering done by the event counter mask with the --inv-mask option. In this case, the counter is incremented each time the number of occurrences of the event is less than or equal to the threshold. Here is an example:

5. Event edge mask

Edge detection, instead of default level detection, can be enabled, per-event, with the --edge-mask. The true/false value can be expressed with either 0/1 or y/n or any combination thereof.

6. References

Further documentation of performance monitoring for the AMD x86-64 processors is available in this document.