If you need to know how many performance counters are supported by your Intel
CPU, you can use the cpuid command (cf. man 1 cpuid).
It is quite verbose as it triggers the x86 cpuid instruction which returns many information on the processor. Among them, there are details
about the Performance Monitoring Unit (PMU). By default, the command launches
the cpuid instruction on all the CPU cores. But if the cores are identical
you can limit the display to one core.
For example, here is how we list the information on the first CPU:
$ cpuid -1
[...]
Architecture Performance Monitoring Features (0xa/eax):
version ID = 0x3 (3)
number of counters per logical processor = 0x4 (4)
bit width of counter = 0x30 (48)
length of EBX bit vector = 0x7 (7)
Architecture Performance Monitoring Features (0xa/ebx):
core cycle event not available = false
instruction retired event not available = false
reference cycles event not available = false
last-level cache ref event not available = false
last-level cache miss event not avail = false
branch inst retired event not available = false
branch mispred retired event not avail = false
Architecture Performance Monitoring Features (0xa/edx):
number of fixed counters = 0x3 (3)
bit width of fixed counters = 0x30 (48)
anythread deprecation = false
[...]
In the above display, we can see that the PMU version is 3:
version ID = 0x3 (3)
There are 4 programmable counters per core:
number of counters per logical processor = 0x4 (4)
There are 3 fixed counters per core:
number of fixed counters = 0x3 (3)
The counters are all 48 bits long:
bit width of counter = 0x30 (48)
bit width of fixed counters = 0x30 (48)
The capabilities of the PMU are architecture specific. If you need additional details for your Intel PC/board, the first lines displayed by the previous command provide the CPU/architecture identification.
For example:
[...]
vendor_id = "GenuineIntel"
version information (1/eax):
processor type = primary processor (0)
family = 0x6 (6)
model = 0xa (10)
stepping id = 0x9 (9)
extended family = 0x0 (0)
extended model = 0x3 (3)
(family synth) = 0x6 (6)
(model synth) = 0x3a (58)
(simple synth) = Intel Core (unknown type) (Ivy Bridge E1/N0/L1/P0) {Sandy Bridge}, 22nm
[...]
With those information you can refer to the Intel documentation.