LIBPFM(3)

πŸ“¦
version 4.14.1 Β· 2 versions
  • 4.14.1 Β· arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 4.11.1+git32-gd0b85fb Β· ubuntu jammy
, in arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– LIBPFM(3) β€” the libpfm_intel_wsm glow-up πŸ’–

okay bestie, sit down, hydrate, and let me tell you about libpfm_intel_wsm β€” straight out of the Linux Programmer's Manual, section 3, and yes she's serving library energy. This is the page that spills all the tea on support for the Intel Westmere core PMU. πŸ¦‹


✨ NAME ✨

libpfm_intel_wsm β€” support for Intel Westmere core PMU. that's it, that's the whole name, no notes. πŸ’…


🌸 SYNOPSIS 🌸

#include <perfmon/pfmlib.h>

and also, because she's got TWO personas (main character and main character's hotter cousin):

PMU name: wsm
PMU desc: Intel Westmere
PMU name: wsm_dp
PMU desc: Intel Westmere DP

πŸ‘‘ DESCRIPTION πŸ‘‘

So the library supports the Intel Westmere core PMU. πŸŽ€

lowkey important caveat, bestie: this PMU model only covers each core's PMU, and not the socket level PMU. That one is provided separately, okay? don't come for me. 😭

Support is provided for the Intel Core i7 and Core i5 processors β€” that's models 37, 44. iconic lineup fr fr.


πŸ’… MODIFIERS πŸ’…

The following modifiers are supported on Intel Westmere processors β€” these are the little seasonings you sprinkle on your event, and each one is a whole vibe:

  • u β€” measure at user level, which includes privilege levels 1, 2, 3. This corresponds to PFM_PLM3. She's a boolean modifier. ✨
  • k β€” measure at kernel level, which includes privilege level 0. This corresponds to PFM_PLM0. Also a boolean modifier. 🫢
  • i β€” invert the meaning of the event. The counter will now count cycles in which the event is not occurring. Boolean modifier. it's giving "opposite day" energy πŸ™ˆ
  • e β€” enable edge detection, i.e. count only when there is 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 will count 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. two for the price of one, slay πŸ’œ
  • ldlat β€” pass a latency threshold to the MEM_INST_RETIRED:LATENCY_ABOVE_THRESHOLD event. This is an integer attribute that must be in the range [1:65535]. It is required for this event. πŸ‘‘
🚨 heads up babes: note that the event must be used with precise sampling (PEBS). no PEBS, no party. don't skip this one, it's not optional. 😀

πŸ”₯ OFFCORE_RESPONSE events πŸ”₯

okay this part is the drama section, buckle up.

The library is able to encode the OFFCORE_RESPONSE_0 and OFFCORE_RESPONSE_1 events. Those are special events because they, each, need a second MSR (0x1a6 and 0x1a7 respectively) to be programmed for the event to count properly. So yes β€” two values are necessary for each event. πŸ’€

  • The first value can be programmed on any of the generic counters.
  • The second value goes into the dedicated MSR (0x1a6 or 0x1a7).

The OFFCORE_RESPONSE events are exposed as normal events with several umasks, and those umasks are divided into two groups: request and response. The user must provide at least one umask from each group. For instance, OFFCORE_RESPONSE_0:ANY_DATA:LOCAL_DRAM. like, you gotta show up with one from each side, it's a potluck. 🧚

When using pfm_get_event_encoding(), two 64-bit values are returned:

  • the first value corresponds to what needs to be programmed into any of the generic counters;
  • the second value must be programmed into the corresponding dedicated MSR (0x1a6 or 0x1a7).

When using an OS-specific encoding routine, the way the event is encoded is OS specific. Refer to the corresponding man page for more information. iykyk 🌈


🌟 AUTHORS 🌟

  • Stephane Eranian <eranian@gmail.com> β€” the icon, the legend, the blueprint πŸ‘‘

and that's the whole page, bestie. this one dropped September, 2009, it's LIBPFM(3) from the Linux Programmer's Manual, and honestly? timeless. periodt. πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from