LIBPFM(3)
π LIBPFM(3) π
okay bestie, come sit with me, we're reading a Linux Programmer's Manual page, section 3, and it's about libpfm_intel_skl β that's the library's support for the Intel SkyLake core PMU. yeah. it's giving "niche but iconic" and I'm obsessed. π
β¨ NAME β¨
libpfm_intel_skl β support for Intel SkyLake core PMU π¦
πΈ SYNOPSIS πΈ
#include <perfmon/pfmlib.h>
PMU name: skl
PMU desc: Intel SkyLake
π« DESCRIPTION π«
So the library supports the Intel SkyLake core PMU. no cap. but β and this is the part everyone skips and then gets confused β this PMU model only covers each core's PMU, it does not cover the socket level PMU. okay? core only. don't come for me.
On SkyLake, the number of generic counters depends on the Hyperthreading (HT) mode. π§΅
counters are available. The pfm_get_pmu_info() function returns the maximum number of generic counters in num_cntrs.
ngl that middle line really just trails off like that in the original, bestie β I'm not gonna invent facts to fill the silence. moving on! π
π MODIFIERS π
The following modifiers are supported on Intel SkyLake processors:
uβ measure at user level, which includes privilege levels 1, 2, 3. this corresponds toPFM_PLM3. it's a boolean modifier. βkβ measure at kernel level, which includes privilege level 0. this corresponds toPFM_PLM0. boolean modifier. βiβ invert the meaning of the event. the counter will now count cycles in which the event is not occurring. boolean modifier. πeβ enable edge detection, i.e., count only when there's a state transition from no occurrence of the event to at least one occurrence. β οΈ this modifier must be combined with a counter mask modifier (m) with a value greater or equal to one. boolean modifier.cβ set the counter mask value. the mask acts as a threshold: the counter counts the number of cycles in which the number of occurrences of the event is greater or equal to the threshold. this is an integer modifier with values in the range[0:255]. π’tβ measure on both threads at the same time, assuming hyper-threading is enabled. boolean modifier. π§΅π§΅ldlatβ pass a latency threshold to theMEM_TRANS_RETIRED:LOAD_LATENCYevent. this is an integer attribute that must be in the range[1:65535]. it is required for this event. β οΈ note that the event must be used with precise sampling (PEBS).intxβ monitor the event only when executing inside a transactional memory region (in tx). the event does not count otherwise. this is a boolean modifier. default value is0.intxcpβ do not count occurrences of the event when they're inside an aborted transactional memory region. boolean modifier. default value is0.fe_thresβ this modifier is for theFRONTEND_RETIREDevent only. it defines the period in core cycles after which theIDQ_*_BUBBLESumask counts. it acts as a threshold, i.e., at least a period of N core cycles where the frontend did not deliver X uops. it can only be used with theIDQ_*_BUBBLESumasks. if not specified, the default threshold value is 1 cycle. the valid values are in[1-4095]. β±οΈ
π OFFCORE_RESPONSE events π
Intel SkyLake provides two offcore_response events. their names are OFFCORE_RESPONSE_0 and OFFCORE_RESPONSE_1. π
These events need special treatment in the performance monitoring infrastructure, because each event uses an extra register to store some settings. so likeβ¦ if multiple offcore_response events are being monitored at the same time, the kernel needs to manage the sharing of that extra register. sharing is caring, but it's also a whole situation. π
The offcore_response events are exposed as normal events by the library. the extra settings are exposed as regular umasks. the library takes care of encoding the events according to the underlying kernel interface. π
On Intel SkyLake, the umasks are divided into three categories: request, supplier and snoop. the user must provide at least one umask for each category. the categories are shown in the umask descriptions. ποΈ
There's also the special response umask called ANY_RESPONSE. when this umask is used, it overrides any supplier and snoop umasks. in other words, users can specify either ANY_RESPONSE OR any combination of supplier + snoops. that's the rule, periodt. π
In case no supplier or snoop is specified, the library defaults to using ANY_RESPONSE.
For instance, the following are valid event selections:
OFFCORE_RESPONSE_0:DMND_DATA_RD:ANY_RESPONSE
OFFCORE_RESPONSE_0:ANY_REQUEST
OFFCORE_RESPONSE_0:ANY_RFO:LLC_HITM:SNOOP_ANY
But the following are illegal:
OFFCORE_RESPONSE_0:ANY_RFO:LLC_HITM:ANY_RESPONSE
OFFCORE_RESPONSE_0:ANY_RFO:LLC_HITM:SNOOP_ANY:ANY_RESPONSE
do not do the illegal ones, bestie. I'm serious. π«
π«Ά AUTHORS π«Ά
Stephane Eranian <eranian@gmail.com> β the main character who wrote this. π
okay that's the whole page!! and a cute lil sign-off for you: this was August, 2015 energy, it lives in LIBPFM(3), and it's part of the Linux Programmer's Manual β go forth and count some events, bestie, you're gonna slay. πβ¨ππ¦
π¦ where this page comes from
- arch rolling: libpfm 4.14.1-1 Β· MIT
- centos-stream 10: libpfm-devel 4.14.1-1.el10 Β· MIT
- centos-stream 9: libpfm-devel 4.14.1-1.el9 Β· MIT
- centos-stream 9: libpfm-devel 4.14.1-1.el9 Β· MIT
- debian bookworm: libpfm4-dev 4.13.0-1 Β· MIT
- debian trixie: libpfm4-dev 4.13.0+git99-gc5587f9-1 Β· MIT
- fedora 43: libpfm-devel 4.13.0-16.fc43 Β· MIT
- fedora 43: libpfm-devel 4.13.0-16.fc43 Β· MIT
- fedora 43: libpfm-devel 4.13.0-20.fc43
- fedora 43: libpfm-devel 4.13.0-20.fc43
- fedora 43: libpfm-devel 4.14.1-2.fc43 Β· MIT
- fedora 43: libpfm-devel 4.14.1-2.fc43 Β· MIT
- fedora 44: libpfm-devel 4.13.0-19.fc44 Β· MIT
- fedora 44: libpfm-devel 4.13.0-19.fc44 Β· MIT
- fedora 44: libpfm-devel 4.13.0-20.fc44
- fedora 44: libpfm-devel 4.13.0-20.fc44
- fedora 44: libpfm-devel 4.14.1-2.fc44 Β· MIT
- fedora 44: libpfm-devel 4.14.1-2.fc44 Β· MIT
- nixos 26.05: papi 7.2.0
- nixpkgs unstable: libpfm 4.14.1
- nixpkgs unstable: papi 7.2.0
- opensuse-leap 16.0: libpfm-devel 4.13.0-160000.3.1 Β· MIT
- ubuntu noble: libpfm4-dev 4.13.0+git32-g0d4ed0e-1 Β· MIT
- ubuntu noble: libpfm4-dev 4.13.0+git32-g0d4ed0e-1ubuntu0.1 Β· MIT
- ubuntu questing: libpfm4-dev 4.13.0+git99-gc5587f9-1
- ubuntu resolute: libpfm4-dev 4.13.0+git106-g3e4031b-1 Β· MIT
- ubuntu resolute: libpfm4-dev 4.13.0+git106-g3e4031b-1ubuntu0.1 Β· MIT
- ubuntu stonking: libpfm4-dev 4.13.0+git106-g3e4031b-1ubuntu1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms