LIBPFM(3)

okay bestie, pull up a chair, we're doing the LIBPFM(3) page together πŸ’– β€” the one from the Linux Programmer's Manual. This one's all about Intel's Haswell-EP Power Controller Unit, and honestly? it's giving very specific, very niche, very slay.


✨ NAME ✨

libpfm_intel_hswep_unc_pcu β€” the support layer for the Intel Haswell-EP Power Controller Unit (PCU) uncore PMU. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <perfmon/pfmlib.h>

PMU name: hswep_unc_pcu PMU desc: Intel Haswell-EP PCU uncore PMU


🌸 DESCRIPTION 🌸

So the library supports the Intel Haswell Power Controller Unit uncore PMU. That's the whole vibe. πŸ’…

Heads up: this PMU model only exists on Haswell model 63. Nowhere else. If you're not on model 63, this is not your moment, bestie. 😭

πŸ’œ MODIFIERS πŸ’œ

These are the modifiers supported on the Intel Haswell PCU uncore PMU β€” collect them all like little charms:

  • e β€” turns on edge detection, aka count only when there's a state transition from zero occurrences of the event to at least one occurrence. It's a boolean modifier, and it must be paired with a threshold modifier (t) whose value is greater or equal to one. No solo flights. 🫢
  • t β€” sets the threshold value. When it's set to a non-zero value, the counter counts the number of HA cycles in which the number of occurrences of the event is greater or equal to the threshold. It's an integer modifier, values in the range [0:15]. 🎯
  • i β€” inverts the meaning of the threshold or edge filter. If it's set, the event counts when strictly less than N occurrences happen per cycle (assuming threshold is set to N). And when invert is set, the threshold must be a non-zero value, periodt. Also: if it's set and edge detection is set, the event counts when the event transitions from occurring to not occurring β€” a falling edge. Boolean modifier. πŸ’«
  • ff β€” enables frequency band filtering. This one applies only to the UNC_P_FREQ_BANDx_CYCLES events, where x is [0-3]. It expects an integer in the range [0-255]. That value gets read as a frequency to be multiplied by 100Mhz. So like, if the value is 32, then every cycle where the processor is running at 3.2GHz and more gets counted. πŸ”₯

🧚 Frequency band filtering 🧚

The page says there are 3 events that support frequency band filtering, namely UNC_P_FREQ_BAND0_CYCLES, UNC_P_FREQ_BAND1_CYCLES, UNC_P_FREQ_BAND2_CYCLES, UNC_P_FREQ_BAND3_CYCLES. (Yes bestie, that's four listed for a "3" β€” we report the text exactly as it's written, no editing the source, iykyk. πŸ™ˆ)

The frequency filter β€” the one you reach with the ff modifier β€” is stored into a PMU shared register that holds all 4 possible frequency bands, one per event. But here's the tea: the library generates the encoding for each event individually, because it processes events one at a time. So the caller or the underlying kernel interface may have to merge the band filter settings to program that filter register properly. Teamwork makes the dream work. 🌈


πŸ‘‘ AUTHORS πŸ‘‘

Stephane Eranian <eranian@gmail.com> β€” the icon, the legend, the moment. πŸ’–


and that's the whole page, no cap. ✨ mwah ✨ this came from the Linux Programmer's Manual, dated May, 2015, and it's the LIBPFM(3) page β€” so go forth, count your cycles, and stay hydrated. πŸ’…πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from