PMC.AMD(3)
π PMC.AMD(3) β measurement events for AMD Athlon 64 (K8 family) CPUs
Library Functions Manual Β· yes bestie, weβre in the manual-page era
π«Ά NAME π«Ά
pmc.amd, pmc.k8 β measurement events for AMD Athlon 64 (K8 family) CPUs.
π LIBRARY π
Performance Counters Library (libpmc, -lpmc)
β¨ SYNOPSIS β¨
#include <pmc.h>
π DESCRIPTION π
Okay so, AMD K8 PMCs are literally present in the AMD Athlon64 and AMD Opteron series of CPUs. They are documented in the BIOS and Kernel Developer's Guide for the AMD Athlon(tm) 64 and AMD Opteron Processors, Publication No. 26094, Advanced Micro Devices, Inc., April 2004.
πΈ PMC Features πΈ
AMD K8 PMCs are 48 bits wide. Each CPU contains 4 PMCs with these capabilities:
PMC_CAP_CASCADEβ NoPMC_CAP_EDGEβ YesPMC_CAP_INTERRUPTβ YesPMC_CAP_INVERTβ YesPMC_CAP_READβ YesPMC_CAP_PRECISEβ NoPMC_CAP_SYSTEMβ YesPMC_CAP_TAGGINGβ NoPMC_CAP_THRESHOLDβ YesPMC_CAP_USERβ YesPMC_CAP_WRITEβ Yes
π Event Qualifiers π
Event specifiers for AMD K8 PMCs can have these optional qualifiers:
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 fields. 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 thecountqualifier is present, making the counter increment when the number of events per cycle is less than the value specified by thecountqualifier.mask=qualifierβ Many event specifiers for AMD K8 PMCs need to be additionally qualified using a mask qualifier. These additional qualifiers are event-specific and are documented along with their associated event specifiers below.osβ Configure the PMC to count events happening at privilege level 0.usrβ Configure the PMC to count events occurring at privilege levels 1, 2 or 3.
If neither theosnorusrqualifier is specified, the default is to enable both. Periodt.
π AMD K8 Event Specifiers π
The event specifiers supported on AMD K8 PMCs are:
k8-bu-cpu-clk-unhaltedβ (Event76H) Count the number of clock cycles when the CPU is not in theHLTorSTPCLKstates.k8-bu-fill-request-l2[,mask=qualifier]β (Event7EH) Count fill requests that missed in the L2 cache. This event may be further qualified using qualifier, which is a'+'separated set of the following keywords:dc-fillβ Count data cache fill requests.ic-fillβ Count instruction cache fill requests.tlb-reloadβ Count TLB reloads.
The default is to count all types of requests.
k8-bu-fill-into-l2[,mask=qualifier]β (Event7FH) The number of lines written to and from the L2 cache. The event may be further qualified by using qualifier, which is a'+'separated set of the following keywords:dirty-l2-victimβ Count lines written into L2 cache due to victim writebacks from the Icache or Dcache, TLB page table walks or hardware data prefetches.victim-from-l2β Count writebacks of dirty lines from L2 to the system.
k8-bu-internal-l2-request[,mask=qualifier]β (Event7DH) Count internally generated requests to the L2 cache. This event may be further qualified using qualifier, which is a'+'separated set of the following keywords:cancelledβ Count cancelled requests.dc-fillβ Count data cache fill requests.ic-fillβ Count instruction cache fill requests.tag-snoopβ Count tag snoop requests.tlb-reloadβ Count TLB reloads.
The default is to count all types of requests.
k8-dc-accessβ (Event40H) Count data cache accesses including microcode scratch pad accesses.k8-dc-copyback[,mask=qualifier]β (Event44H) Count data cache copyback operations. This event may be further qualified using qualifier, which is a'+'separated set of the following keywords:exclusiveβ Count operations for lines in the βexclusiveβ state.invalidβ Count operations for lines in the βinvalidβ state.modifiedβ Count operations for lines in the βmodifiedβ state.ownerβ Count operations for lines in the βownerβ state.sharedβ Count operations for lines in the βsharedβ state.
The default is to count operations for lines in all the above states.
k8-dc-dcache-accesses-by-locks[,mask=qualifier]β (Event4CH) Count data cache accesses by lock instructions. This event is only available on processors of revision C or later vintage. This event may be further qualified using qualifier, which is a'+'separated set of the following keywords:accessesβ Count data cache accesses by lock instructions.missesβ Count data cache misses by lock instructions.
The default is to count all accesses.
k8-dc-dispatched-prefetch-instructions[,mask=qualifier]β (Event4BH) Count the number of dispatched prefetch instructions. This event may be further qualified using qualifier, which is a'+'separated set of the following keywords:loadβ Count load operations.ntaβ Count non-temporal operations.storeβ Count store operations.
The default is to count all operations.
k8-dc-l1-dtlb-miss-and-l2-dtlb-hitβ (Event45H) Count L1 DTLB misses that are L2 DTLB hits.k8-dc-l1-dtlb-miss-and-l2-dtlb-missβ (Event46H) Count L1 DTLB misses that are also misses in the L2 DTLB.k8-dc-microarchitectural-early-cancel-of-an-accessβ (Event49H) Count microarchitectural early cancels of data cache accesses.k8-dc-microarchitectural-late-cancel-of-an-accessβ (Event48H) Count microarchitectural late cancels of data cache accesses.k8-dc-misaligned-data-referenceβ (Event47H) Count misaligned data references.k8-dc-missβ (Event41H) Count data cache misses.k8-dc-one-bit-ecc-error[,mask=qualifier]β (Event4AH) Count one bit ECC errors found by the scrubber. This event may be further qualified using qualifier, which is a'+'separated set of the following keywords:scrubberβ Count scrubber detected errors.piggybackβ Count piggyback scrubber errors.
The default is to count both kinds of errors.
k8-dc-refill-from-l2[,mask=qualifier]β (Event42H) Count data cache refills from L2 cache. This event may be further qualified using qualifier, which is a'+'separated set of the following keywords:exclusiveβ Count operations for lines in the βexclusiveβ state.invalidβ Count operations for lines in the βinvalidβ state.modifiedβ Count operations for lines in the βmodifiedβ state.ownerβ Count operations for lines in the βownerβ state.sharedβ Count operations for lines in the βsharedβ state.
The default is to count operations for lines in all the above states.
k8-dc-refill-from-system[,mask=qualifier]β (Event43H) Count data cache refills from system memory. This event may be further qualified using qualifier, which is a'+'separated set of the following keywords:exclusiveβ Count operations for lines in the βexclusiveβ state.invalidβ Count operations for lines in the βinvalidβ state.modifiedβ Count operations for lines in the βmodifiedβ state.ownerβ Count operations for lines in the βownerβ state.sharedβ Count operations for lines in the βsharedβ state.
The default is to count operations for lines in all the above states.
k8-fp-cycles-with-no-fpu-ops-retiredβ (Event01H) Count cycles when no FPU ops were retired. This event is supported in revision B and later CPUs.k8-fp-dispatched-fpu-fast-flag-opsβ (Event02H) Count dispatched FPU ops that use the fast flag interface. This event is supported in revision B and later CPUs.k8-fp-dispatched-fpu-ops[,mask=qualifier]β (Event00H) Count the number of dispatched FPU ops. This event is supported in revision B and later CPUs. This event may be further qualified using qualifier, which is a'+'separated set of the following keywords:add-pipe-excluding-junk-opsβ Count add pipe ops excluding junk ops.add-pipe-junk-opsβ Count junk ops in the add pipe.multiply-pipe-excluding-junk-opsβ Count multiply pipe ops excluding junk ops.multiply-pipe-junk-opsβ Count junk ops in the multiply pipe.store-pipe-excluding-junk-opsβ Count store pipe ops excluding junk opsstore-pipe-junk-opsβ Count junk ops in the store pipe.
The default is to count all types of ops.
k8-fr-decoder-emptyβ (EventD0H) Count cycles when there was nothing to dispatch (i.e., the decoder was empty).k8-fr-dispatch-stall-for-segment-loadβ (EventD4H) Count dispatch stalls for segment loads.k8-fr-dispatch-stall-for-serializationβ (EventD3H) Count dispatch stalls for serialization.k8-fr-dispatch-stall-from-branch-abort-to-retireβ (EventD2H) Count dispatch stalls from branch abort to retiral.k8-fr-dispatch-stall-when-fpu-is-fullβ (EventD7H) Count dispatch stalls when the FPU is full.k8-fr-dispatch-stall-when-ls-is-fullβ (EventD8H) Count dispatch stalls when the load/store unit is full.k8-fr-dispatch-stall-when-reorder-buffer-is-fullβ (Event D5H) Counts dispatch stalls when the reorder buffer is full.k8-fr-dispatch-stall-when-reservation-stations-are-fullβ (Event D6H) Counts dispatch stalls when the reservation stations are full.k8-fr-dispatch-stall-when-waiting-far-xfer-or-resync-branch-pendingβ (Event DAH) Counts dispatch stalls when a far control transfer or a resync branch is pending.k8-fr-dispatch-stall-when-waiting-for-all-to-be-quietβ (Event D9H) Counts dispatch stalls when waiting for everything to be quiet. π¦k8-fr-dispatch-stallsβ (Event D1H) Counts all the dispatch stalls. The catch-all, the main character of stalls.k8-fr-fpu-exceptions [,mask=qualifier]β (Event DBH) Counts FPU exceptions. π This event is supported in revision B and later CPUs. You can qualify it further withqualifier, which is a+-separated set of these keywords:sse-and-x87-microtrapsβ Counts SSE and x87 microtraps.sse-reclass-microfaultsβ Counts SSE reclass microfaults.sse-retype-microfaultsβ Counts SSE retype microfaults.x87-reclass-microfaultsβ Counts x87 reclass microfaults.
Default behavior? Count all types of exceptions. All of them. π
k8-fr-interrupts-masked-cyclesβ (Event CDH) Counts cycles when interrupts were masked (that's when the CPU RFLAGS field IF was zero, iykyk).k8-fr-interrupts-masked-while-pending-cyclesβ (Event CEH) Counts cycles while interrupts were masked and pending β literally the cycles when INTR was asserted while the CPU RFLAGS field IF was zero. πk8-fr-number-of-breakpoints-for-dr0β (Event DCH) Counts the number of breakpoints for DR0.k8-fr-number-of-breakpoints-for-dr1β (Event DDH) Counts the number of breakpoints for DR1.k8-fr-number-of-breakpoints-for-dr2β (Event DEH) Counts the number of breakpoints for DR2.k8-fr-number-of-breakpoints-for-dr3β (Event DFH) Counts the number of breakpoints for DR3. The whole squad, accounted for. π«Άk8-fr-retired-branchesβ (Event C2H) Counts retired branches, exceptions and interrupts included.k8-fr-retired-branches-mispredictedβ (Event C3H) Counts mispredicted retired branches. Oops. πk8-fr-retired-far-control-transfersβ (Event C6H) Counts retired far control transfers, which are always mispredicted β no guessing required, they just are.k8-fr-retired-fastpath-double-op-instructions [,mask=qualifier]β (Event CCH) Counts retired fastpath double op instructions. Supported in revision B and later CPUs. Qualify it withqualifier, a+-separated set of these keywords:low-op-pos-0β Counts instructions with the low op in position 0.low-op-pos-1β Counts instructions with the low op in position 1.low-op-pos-2β Counts instructions with the low op in position 2.
Default is to count all types of instructions. β¨
k8-fr-retired-fpu-instructions [,mask=qualifier]β (Event CBH) Counts retired FPU instructions. Supported in revision B and later CPUs.qualifieris a+-separated set of:mmx-3dnowβ Counts MMX and 3DNow! instructions.packed-sse-sse2β Counts packed SSE and SSE2 instructions.scalar-sse-sse2β Counts scalar SSE and SSE2 instructions.x87β Counts x87 instructions.
Default: all types of instructions. The whole buffet. π
k8-fr-retired-near-returnsβ (Event C8H) Counts retired near returns.k8-fr-retired-near-returns-mispredictedβ (Event C9H) Counts mispredicted near returns.k8-fr-retired-resyncsβ (Event C7H) Counts retired resyncs (those are non-control transfer branches, fyi).k8-fr-retired-taken-branchesβ (Event C4H) Counts retired taken branches.k8-fr-retired-taken-branches-mispredictedβ (Event C5H) Counts retired taken branches that were mispredicted.k8-fr-retired-taken-branches-mispredicted-by-addr-miscompareβ (Event CAH) Counts retired taken branches that were mispredicted only due to an address miscompare. Precise queen behavior. πk8-fr-retired-taken-hardware-interruptsβ (Event CFH) Counts retired taken hardware interrupts.k8-fr-retired-uopsβ (Event C1H) Counts retired uops.k8-fr-retired-x86-instructionsβ (Event C0H) Counts retired x86 instructions, exceptions and interrupts included.k8-ic-fetchβ (Event 80H) Counts instruction cache fetches.k8-ic-instruction-fetch-stallβ (Event 87H) Counts cycles in stalls due to instruction fetch.k8-ic-l1-itlb-miss-and-l2-itlb-hitβ (Event 84H) Counts L1 ITLB misses that are L2 ITLB hits.k8-ic-l1-itlb-miss-and-l2-itlb-missβ (Event 85H) Counts ITLB misses that miss in both L1 and L2 ITLBs. Down bad in both levels. πk8-ic-microarchitectural-resync-by-snoopβ (Event 86H) Counts microarchitectural resyncs caused by snoops.k8-ic-missβ (Event 81H) Counts instruction cache misses.k8-ic-refill-from-l2β (Event 82H) Counts instruction cache refills from L2 cache.k8-ic-refill-from-systemβ (Event 83H) Counts instruction cache refills from system memory.k8-ic-return-stack-hitsβ (Event 88H) Counts hits to the return stack.k8-ic-return-stack-overflowβ (Event 89H) Counts overflows of the return stack. It's giving full. πk8-ls-buffer2-fullβ (Event 23H) Counts load/store buffer2 full events.k8-ls-locked-operation [,mask=qualifier]β (Event 24H) Counts locked operations. For revision C and later CPUs, these qualifiers are supported:cycles-in-requestβ Counts the number of cycles in the lock request/grant stage.cycles-to-completeβ Counts the number of cycles a lock takes to complete once it is non-speculative and is the older load/store operation.locked-instructionsβ Counts the number of lock instructions executed.
Default is to count the number of lock instructions executed. Solid choice ngl.
k8-ls-microarchitectural-late-cancelβ (Event 25H) Counts microarchitectural late cancels of operations in the load/store unit.k8-ls-microarchitectural-resync-by-self-modifying-codeβ (Event 21H) Counts microarchitectural resyncs caused by self-modifying code. Chaos code. π₯k8-ls-microarchitectural-resync-by-snoopβ (Event 22H) Counts microarchitectural resyncs caused by snoops.k8-ls-retired-cflush-instructionsβ (Event 26H) Counts retired CFLUSH instructions.k8-ls-retired-cpuid-instructionsβ (Event 27H) Counts retired CPUID instructions.k8-ls-segment-register-load [,mask=qualifier]β (Event 20H) Counts segment register loads. Qualify it withqualifier, a+-separated set of:csβ Counts CS register loads.dsβ Counts DS register loads.esβ Counts ES register loads.fsβ Counts FS register loads.gsβ Counts GS register loads.ssβ Counts SS register loads.
Default: counts all types of loads. β¨
k8-nb-ht-bus0-bandwidth [,mask=qualifier]k8-nb-ht-bus1-bandwidth [,mask=qualifier]k8-nb-ht-bus2-bandwidth [,mask=qualifier]β (Events F6H, F7H and F8H respectively) Counts events on the HyperTransport(tm) buses. Qualify these withqualifier, a+-separated set of:buffer-releaseβ Counts buffer release messages sent.commandβ Counts command messages sent.dataβ Counts data messages sent.nopβ Counts nop messages sent.
Default: counts all types of messages. π
k8-nb-memory-controller-bypass-saturation [,mask=qualifier]β (Event E4H) Counts memory controller bypass counter saturation events.qualifieris a+-separated set of:dram-controller-interface-bypassβ Counts DRAM controller interface bypass.dram-controller-queue-bypassβ Counts DRAM controller queue bypass.memory-controller-hi-pri-bypassβ Counts memory controller high priority bypasses.memory-controller-lo-pri-bypassβ Counts memory controller low priority bypasses.
k8-nb-memory-controller-dram-slots-missedβ (Event E2H) Counts memory controller DRAM command slots missed (in MemClks).k8-nb-memory-controller-page-access-event [,mask=qualifier]β (Event E0H) Counts memory controller page access events.qualifieris a+-separated set of:page-conflictβ Counts page conflicts.page-hitβ Counts page hits.page-missβ Counts page misses.
Default: counts all types of events. π
k8-nb-memory-controller-page-table-overflowβ (Event E1H) Counts memory control page table overflow events.k8-nb-memory-controller-turnaround [,mask=qualifier]β (Event E3H) Counts memory control turnaround events.qualifieris a+-separated set of:dimm-turnaroundβ Counts DIMM turnarounds.read-to-write-turnaroundβ Counts read to write turnarounds.write-to-read-turnaroundβ Counts write to read turnarounds.
Default: counts all types of events. She rotates. π
k8-nb-probe-result [,mask=qualifier]β (Event ECH) Counts probe events.qualifieris a+-separated set of:probe-hitβ Counts all probe hits.probe-hit-dirty-no-memory-cancelβ Counts probe hits without memory cancels.probe-hit-dirty-with-memory-cancelβ Counts probe hits with memory cancels.probe-missβ Counts probe misses.
k8-nb-sized-commands[,mask=qualifier] β (Event EBH) counts the sized commands being issued. π You can get extra picky with this one by passing aqualifier, which is literally just a set of the keywords below glued together with+:nonpostwrszbytenonpostwrszdwordpostwrszbytepostwrszdwordrdszbyterdszdwordrdmodwr
If you don't specify anything? The default is to count all the types of commands. Main character energy: everything gets counted, no cap. β¨
π¦ Event Name Aliases π¦
okay so this next bit is lowkey iconic π β here's the mapping between the PMC-independent aliases that Performance Counters Library (libpmc, -lpmc) supports and the actual underlying hardware events they point at. It's giving translator bestie fr fr:
branchesβk8-fr-retired-taken-branchesbranch-mispredictsβk8-fr-retired-taken-branches-mispredicteddc-missesβk8-dc-missic-missesβk8-ic-missinstructionsβk8-fr-retired-x86-instructionsinterruptsβk8-fr-taken-hardware-interruptsunhalted-cyclesβk8-bu-cpu-clk-unhalted
Like, you can use the cute short alias OR the full hardware name β either way you're slaying. π«Ά
π SEE ALSO π
go read these next, bestie, they're all part of the squad π:
π HISTORY π
The pmc library first appeared in FreeBSD 6.0. a whole era. an icon. β
π AUTHORS π
The Performance Counters Library (libpmc, -lpmc) library was written by Joseph Koshy <jkoshy@FreeBSD.org>. shoutout to the legend, we stan π«‘π
and that's a wrap on the whole page, bestie π this was the Debian build, dated June 24, 2023, and it's the PMC.AMD(3) manual β go forth and profile with main character energy, mwah π
π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 2003-2008 Joseph Koshy. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms