PMC.K7(3)

πŸ“¦ version 14.5, in freebsd 14.5

πŸ’… NAME: pmc.k7 β€” measurement events for AMD Athlon (K7 family) CPUs πŸ’…

🌸 LIBRARY 🌸

Performance Counters Library (libpmc, -lpmc) β€” yes bestie, that’s the library link vibe.

✨ SYNOPSIS ✨

#include <pmc.h>

πŸ’– DESCRIPTION πŸ’–

Okay so AMD K7 PMCs are literally present in the AMD Athlon series of CPUs, and they’re documented in: AMD Athlon Processor x86 Code Optimization Guide, Publication No. 22007, Advanced Micro Devices, Inc., February 2002. Iconic citation behavior, no cap.

πŸ¦‹ PMC Features πŸ¦‹

AMD K7 PMCs are 48 bits wide. Each K7 CPU contains 4 PMCs with these capabilities:

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

πŸŽ€ Event Qualifiers πŸŽ€

Event specifiers for AMD K7 PMCs can have these optional qualifiers, bestie:

  • count=value β€” Configure the counter to increment only if the number of configured events measured in a cycle is greater than or equal to value.
  • edge β€” Configure the counter to only count negated-to-asserted transitions of the conditions expressed by the other qualifiers. In other words, the counter will increment only once whenever a given condition becomes true, irrespective of the number of clocks during which the condition remains true.
  • inv β€” Invert the sense of comparison when the count qualifier is present, making the counter increment when the number of events per cycle is less than the value specified by the count qualifier.
  • os β€” Configure the PMC to count events happening at privilege level 0.
  • unitmask=mask β€” This qualifier is used to further qualify a select few events: k7-dc-refills-from-l2, k7-dc-refills-from-system, and k7-dc-writebacks. Here mask is a string of the following characters optionally separated by + characters:
    • m β€” Count operations for lines in the β€œModified” state.
    • o β€” Count operations for lines in the β€œOwner” state.
    • e β€” Count operations for lines in the β€œExclusive” state.
    • s β€” Count operations for lines in the β€œShared” state.
    • i β€” Count operations for lines in the β€œInvalid” state.

If no unitmask qualifier is specified, the default is to count events for cache lines in any of the above states.

  • usr β€” Configure the PMC to count events occurring at privilege levels 1, 2, or 3.

If neither of the os or usr qualifiers were specified, the default is to enable both.

πŸ”₯ AMD K7 Event Specifiers πŸ”₯

The event specifiers supported on AMD K7 PMCs are, right this way:

  • k7-dc-accesses β€” (Event 40H) Count data cache accesses.
  • k7-dc-misses β€” (Event 41H) Count data cache misses.
  • k7-dc-refills-from-l2 [,unitmask=mask] β€” (Event 42H) Count data cache refills from L2 cache. This event may be further qualified using the unitmask qualifier.
  • k7-dc-refills-from-system [,unitmask=mask] β€” (Event 43H) Count data cache refills from system memory. This event may be further qualified using the unitmask qualifier.
  • k7-dc-writebacks [,unitmask=mask] β€” (Event 44H) Count data cache writebacks. This event may be further qualified using the unitmask qualifier.
  • k7-hardware-interrupts β€” (Event CFH) Count the number of taken hardware interrupts.
  • k7-ic-fetches β€” (Event 80H) Count instruction cache fetches.
  • k7-ic-misses β€” (Event 81H) Count instruction cache misses.
  • k7-interrupts-masked-cycles β€” (Event CDH) Count the number of cycles when the processor’s IF flag was zero.
  • k7-interrupts-masked-while-pending-cycles β€” (Event CEH) Count the number of cycles interrupts were masked while pending due to the processor’s IF flag being zero.
  • k7-l1-and-l2-dtlb-misses β€” (Event 46H) Count L1 and L2 DTLB misses.
  • k7-l1-dtlb-miss-and-l2-dtlb-hits β€” (Event 45H) Count L1 DTLB misses and L2 DTLB hits.
  • k7-l1-itlb-misses β€” (Event 84H) Count L1 ITLB misses that are L2 ITLB hits.
  • k7-l1-l2-itlb-misses β€” (Event 85H) Count L1 (and L2) ITLB misses.
  • k7-misaligned-references β€” (Event 47H) Count misaligned data references.
  • k7-retired-branches β€” (Event C2H) Count all retired branches (conditional, unconditional, exceptions and interrupts).
  • k7-retired-branches-mispredicted β€” (Event C3H) Count all mispredicted retired branches.
  • k7-retired-far-control-transfers β€” (Event C6H) Count retired far control transfers.
  • k7-retired-instructions β€” (Event C0H) Count all retired instructions.
  • k7-retired-ops β€” (Event C1H) Count retired ops.
  • k7-retired-resync-branches β€” (Event C7H) Count retired resync branches (non control transfer branches).
  • k7-retired-taken-branches β€” (Event C4H) Count retired taken branches.
  • k7-retired-taken-branches-mispredicted β€” (Event C5H) Count mispredicted taken branches that were retired.

πŸ‘‘ Event Name Aliases πŸ‘‘

Here’s the mapping between the PMC-independent aliases supported by Performance Counters Library (libpmc, -lpmc) and the underlying hardware events used:

  • branches β€” k7-retired-branches
  • branch-mispredicts β€” k7-retired-branches-mispredicted
  • dc-misses β€” k7-dc-misses
  • ic-misses β€” k7-ic-misses
  • instructions β€” k7-retired-instructions
  • interrupts β€” k7-hardware-interrupts
  • unhalted-cycles β€” (unsupported)

🌈 SEE ALSO 🌈

🫢 HISTORY 🫢

The pmc library first appeared in FreeBSD 6.0. Periodt.

πŸ’œ AUTHORS πŸ’œ

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


πŸŽ€ Source/version: Debian Β· Date: October 4, 2008 Β· PMC.K7(3) β€” byeee bestie πŸ’–

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