PMC.IAF(3)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… PMC.IAF(3) β€” Intel Fixed-Function Performance Counters, but make it cute

Okay so this is the PMC.IAF(3) page from the Library Functions Manual, and bestie, it's all about the Intel fixed-function performance counters. No cap, these things are iconic little hardware event trackers. Let's get into it. πŸŽ€


🌸 NAME

pmc.iaf β€” measurement events for Intel fixed function performance counters. Yes, that's the whole vibe. πŸ’–


πŸ“š LIBRARY

Performance Counters Library (libpmc, -lpmc) β€” link it and slay. ✨


🧚 SYNOPSIS

#include <pmc.h>

That's it. That's the whole include. Periodt. πŸ’…


πŸ”₯ DESCRIPTION

Intel fixed-function PMCs are literally built into CPUs that conform to version 2 or later of the Intel Performance Measurement Architecture. Each fixed-function PMC measures a specific hardware event β€” like, it has one job and it does it. The number of fixed-function PMCs implemented in a CPU can vary, because of course it can. πŸ™ˆ You can find out at runtime how many you've got by calling pmc_cpuinfo(3). Vibe check your CPU, bestie.

Intel fixed-function PMCs are documented in β€œVolume 3: System Programming Guide”, IA-32 Intel(R) Architecture Software Developer's Manual, Order Number 253669-027US, Intel Corporation, July 2008. Very official. Very PDF-core. πŸ“„

πŸ‘‘ PMC Capabilities

Fixed-function PMCs support the following capabilities:

  • PMC_CAP_CASCADE β€” No
  • PMC_CAP_EDGE β€” No
  • PMC_CAP_INTERRUPT β€” Yes
  • PMC_CAP_INVERT β€” No
  • PMC_CAP_READ β€” Yes
  • PMC_CAP_PRECISE β€” No
  • PMC_CAP_SYSTEM β€” Yes
  • PMC_CAP_TAGGING β€” No
  • PMC_CAP_THRESHOLD β€” No
  • PMC_CAP_USER β€” Yes
  • PMC_CAP_WRITE β€” Yes

So yeah: interrupt, read, system, user, and write are a yes. The rest are a hard no. She's selective. πŸ’…

🌈 Class Name Prefix

These PMCs are named using a class name prefix of iaf-. That's the little nametag they wear. 🏷️

πŸ¦‹ Event Qualifiers (Fixed Function PMCs)

These PMCs support the following modifiers:

  • os β€” Configure the PMC to count events occurring at ring level 0. (Kernel mode energy. πŸ‘‘)
  • usr β€” Configure the PMC to count events occurring at ring levels 1, 2 or 3. (User mode energy. 🫢)
  • anythread β€” (Atom CPUs) Configure the PMC to count events on all logical processors sharing a processor core. The default is to count events on the current logical processor. So if you're on an Atom CPU and you want the whole squad counted, this is your girl. 🧚

If neither of the os or usr qualifiers are specified, the default is to enable both. So like, both is the default. Very generous. πŸ’–

⭐ Event Specifiers (Fixed Function PMCs)

The fixed function PMCs are selectable using the following event names:

  • INSTR_RETIRED.ANY β€” (Fixed Function Counter 0) The number of instructions retired. They did their job, they retired, we love that for them. πŸ‘‘
  • CPU_CLK_UNHALTED.CORE β€” (Fixed Function Counter 1) The number of core cycles for which the core is not halted. Like, how many cycles did the core actually stay awake for. πŸ’€
  • CPU_CLK_UNHALTED.REF β€” (Fixed Function Counter 2) The number of reference cycles for which the core is not halted. Reference cycles stay awake too bestie. πŸ”₯

πŸ’œ EXAMPLES

To measure the number of core cycles for which the core was not halted, use the event specifier "iaf-cpu-clk-unhalted.core". That's like the literal baseline move. 🌸

To measure the number of user instructions retired, use the event specifier "iaf-instr-retired.any,usr". Add that usr and you're counting user-mode retirement. Gorge. ✨

To measure the number of user instructions retired on all logical processors in an Atom CPU, use the event specifier "iaf-instr-retired.any,usr,anythread". That's the Atom-specific squad-counting version. No cap. 🧚


🫢 SEE ALSO

pmc(3), pmc.amd(3), pmc.atom(3), pmc.core(3), pmc.core2(3), pmc.soft(3), pmc.tsc(3), pmc_cpuinfo(3), pmclog(3), hwpmc(4) β€” go read the whole friend group, iykyk. πŸ“šπŸ’–


πŸŽ€ HISTORY

The pmc library first appeared in FreeBSD 6.0. Oldie but goodie. πŸ‘‘


🌟 AUTHORS

The Performance Counters Library (libpmc, -lpmc) library was written by Joseph Koshy <jkoshy@FreeBSD.org>. We stan a legend. 🫢


πŸ’… That's the whole page bestie. Intel fixed-function PMCs, capabilities, qualifiers, event names, examples, references, history, authors β€” every detail is here. Don't skip the usr/os default, it's both. Periodt.

Debian Β· November 14, 2008 Β· PMC.IAF(3) β€” version/source and date, signed off cutely at the very end. πŸŽ€βœ¨

πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms