PMC.K8(3)

NAME
pmc.k8 - measurement events for AMD Athlon 64 (K8 family) CPUs

LIBRARY
libpmc

SYNOPSIS
#include <pmc.h>

DESCRIPTION
AMD K8 PMCs are 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, April 2004, Advanced Micro Devices, Inc..

  PMC Features
AMD K8 PMCs are 48 bits wide. Each CPU contains 4 PMCs with the following capabilities:
Capability | Support
PMC_CAP_CASCADE |
PMC_CAP_EDGE | Yes
PMC_CAP_INTERRUPT | Yes
PMC_CAP_INVERT | Yes
PMC_CAP_READ | Yes
PMC_CAP_PRECISE |
PMC_CAP_SYSTEM | Yes
PMC_CAP_TAGGING |
PMC_CAP_THRESHOLD | Yes
PMC_CAP_USER | Yes
PMC_CAP_WRITE | Yes

  Event Qualifiers
Event specifiers for AMD K8 PMCs can have the following 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 the “count” qualifier is present, making the counter to increment when the number of events per cycle is less than the value specified by the “count” qualifier.

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 of the “os” or “usr” qualifiers were specified, the default is to enable both.

  AMD K8 Event Specifiers
The event specifiers supported on AMD K8 PMCs are:

k8-bu-cpu-clk-unhalted
    (Event 76H) Count the number of clock cycles when the CPU is not in the HLT or STPCLK states.

k8-bu-fill-request-l2-miss [,mask=qualifier]
    (Event 7EH) 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]
    (Event 7FH) 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]
    (Event 7DH) 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
    (Event 40H) Count data cache accesses including microcode scratch pad accesses.

k8-dc-copyback [,mask=qualifier]
    (Event 44H) 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]
    (Event 4CH) 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]
    (Event 4BH) 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
    (Event 45H) Count L1 DTLB misses that are L2 DTLB hits.

k8-dc-l1-dtlb-miss-and-l2-dtlb-miss
    (Event 46H) Count L1 DTLB misses that are also misses in the L2 DTLB.

k8-dc-microarchitectural-early-cancel-of-an-access
    (Event 49H) Count microarchitectural early cancels of data cache accesses.

k8-dc-microarchitectural-late-cancel-of-an-access
    (Event 48H) Count microarchitectural late cancels of data cache accesses.

k8-dc-misaligned-data-reference
    (Event 47H) Count misaligned data references.

k8-dc-miss
    (Event 41H) Count data cache misses.

k8-dc-one-bit-ecc-error [,mask=qualifier]
    (Event 4AH) 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]
    (Event 42H) 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]
    (Event 43H) 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
    (Event 01H) 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
    (Event 02H) 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]
    (Event 00H) 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 ops
    store-pipe-junk-ops
        Count junk ops in the store pipe.

    The default is to count all types of ops.

k8-fr-decoder-empty
    (Event D0H) Count cycles when there was nothing to dispatch (i.e., the decoder was empty).

k8-fr-dispatch-stall-for-segment-load
    (Event D4H) Count dispatch stalls for segment loads.

k8-fr-dispatch-stall-for-serialization
    (Event D3H) Count dispatch stalls for serialization.

k8-fr-dispatch-stall-from-branch-abort-to-retire
    (Event D2H) Count dispatch stalls from branch abort to retiral.

k8-fr-dispatch-stall-when-fpu-is-full
    (Event D7H) Count dispatch stalls when the FPU is full.

k8-fr-dispatch-stall-when-ls-is-full
    (Event D8H) Count dispatch stalls when the load/store unit is full.

k8-fr-dispatch-stall-when-reorder-buffer-is-full
    (Event D5H) Count dispatch stalls when the reorder buffer is full.

k8-fr-dispatch-stall-when-reservation-stations-are-full
    (Event D6H) Count dispatch stalls when reservation stations are full.

k8-fr-dispatch-stall-when-waiting-far-xfer-or-resync-branch-pending
    (Event DAH) Count 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) Count dispatch stalls when waiting for all to be quiet.

k8-fr-dispatch-stalls
    (Event D1H) Count all dispatch stalls.

k8-fr-fpu-exceptions [,mask=qualifier]
    (Event DBH) Count FPU exceptions. 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:

    sse-and-x87-microtraps
        Count SSE and x87 microtraps.
    sse-reclass-microfaults
        Count SSE reclass microfaults
    sse-retype-microfaults
        Count SSE retype microfaults
    x87-reclass-microfaults
        Count x87 reclass microfaults.

    The default is to count all types of exceptions.

k8-fr-interrupts-masked-cycles
    (Event CDH) Count cycles when interrupts were masked (by CPU RFLAGS field IF was zero).

k8-fr-interrupts-masked-while-pending-cycles
    (Event CEH) Count cycles while interrupts were masked while pending (i.e., cycles when INTR was asserted while CPU RFLAGS field IF was zero).

k8-fr-number-of-breakpoints-for-dr0
    (Event DCH) Count the number of breakpoints for DR0.

k8-fr-number-of-breakpoints-for-dr1
    (Event DDH) Count the number of breakpoints for DR1.

k8-fr-number-of-breakpoints-for-dr2
    (Event DEH) Count the number of breakpoints for DR2.

k8-fr-number-of-breakpoints-for-dr3
    (Event DFH) Count the number of breakpoints for DR3.

k8-fr-retired-branches
    (Event C2H) Count retired branches including exceptions and interrupts.

k8-fr-retired-branches-mispredicted
    (Event C3H) Count mispredicted retired branches.

k8-fr-retired-far-control-transfers
    (Event C6H) Count retired far control transfers (which are always mispredicted).

k8-fr-retired-fastpath-double-op-instructions [,mask=qualifier]
    (Event CCH) Count retired fastpath double op instructions. 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:

    low-op-pos-0
        Count instructions with the low op in position 0.
    low-op-pos-1
        Count instructions with the low op in position 1.
    low-op-pos-2
        Count instructions with the low op in position 2.

    The default is to count all types of instructions.

k8-fr-retired-fpu-instructions [,mask=qualifier]
    (Event CBH) Count retired FPU instructions. 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:

    mmx-3dnow
        Count MMX and 3DNow! instructions.
    packed-sse-sse2
        Count packed SSE and SSE2 instructions.
    scalar-sse-sse2
        Count scalar SSE and SSE2 instructions
    x87 Count x87 instructions.

    The default is to count all types of instructions.

k8-fr-retired-near-returns
    (Event C8H) Count retired near returns.

k8-fr-retired-near-returns-mispredicted
    (Event C9H) Count mispredicted near returns.

k8-fr-retired-resyncs
    (Event C7H) Count retired resyncs (non-control transfer branches).

k8-fr-retired-taken-branches
    (Event C4H) Count retired taken branches.

k8-fr-retired-taken-branches-mispredicted
    (Event C5H) Count retired taken branches that were mispredicted.

k8-fr-retired-taken-branches-mispredicted-by-addr-miscompare
    (Event CAH) Count retired taken branches that were mispredicted only due to an address miscompare.

k8-fr-retired-taken-hardware-interrupts
    (Event CFH) Count retired taken hardware interrupts.

k8-fr-retired-uops
    (Event C1H) Count retired uops.

k8-fr-retired-x86-instructions
    (Event C0H) Count retired x86 instructions including exceptions and interrupts.

k8-ic-fetch
    (Event 80H) Count instruction cache fetches.

k8-ic-instruction-fetch-stall
    (Event 87H) Count cycles in stalls due to instruction fetch.

k8-ic-l1-itlb-miss-and-l2-itlb-hit
    (Event 84H) Count L1 ITLB misses that are L2 ITLB hits.

k8-ic-l1-itlb-miss-and-l2-itlb-miss
    (Event 85H) Count ITLB misses that miss in both L1 and L2 ITLBs.

k8-ic-microarchitectural-resync-by-snoop
    (Event 86H) Count microarchitectural resyncs caused by snoops.

k8-ic-miss
    (Event 81H) Count instruction cache misses.

k8-ic-refill-from-l2
    (Event 82H) Count instruction cache refills from L2 cache.

k8-ic-refill-from-system
    (Event 83H) Count instruction cache refills from system memory.

k8-ic-return-stack-hits
    (Event 88H) Count hits to the return stack.

k8-ic-return-stack-overflow
    (Event 89H) Count overflows of the return stack.

k8-ls-buffer2-full
    (Event 23H) Count load/store buffer2 full events.

k8-ls-locked-operation [,mask=qualifier]
    (Event 24H) Count locked operations. For revision C and later CPUs, the following qualifiers are supported:

    cycles-in-request
        Count the number of cycles in the lock request/grant stage.
    cycles-to-complete
        Count the number of cycles a lock takes to complete once it is non-speculative and is the older load/store operation.
    locked-instructions
        Count the number of lock instructions executed.

    The default is to count the number of lock instructions executed.

k8-ls-microarchitectural-late-cancel
    (Event 25H) Count microarchitectural late cancels of operations in the load/store unit.

k8-ls-microarchitectural-resync-by-self-modifying-code
    (Event 21H) Count microarchitectural resyncs caused by self-modifying code.

k8-ls-microarchitectural-resync-by-snoop
    (Event 22H) Count microarchitectural resyncs caused by snoops.

k8-ls-retired-cflush-instructions
    (Event 26H) Count retired CFLUSH instructions.

k8-ls-retired-cpuid-instructions
    (Event 27H) Count retired CPUID instructions.

k8-ls-segment-register-load [,mask=qualifier]
    (Event 20H) Count segment register loads. This event may be further qualified using qualifier, which is a ‘+’ separated set of the following keywords:
    cs  Count CS register loads.
    ds  Count DS register loads.
    es  Count ES register loads.
    fs  Count FS register loads.
    gs  Count GS register loads.
    ss  Count SS register loads.

    The default is to count 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) Count events on the HyperTransport(tm) buses. These events may be further qualified using qualifier, which is a ‘+’ separated set of the following keywords:

    buffer-release
        Count buffer release messages sent.
    command
        Count command messages sent.
    data
        Count data messages sent.
    nop Count nop messages sent.

    The default is to count all types of messages.

k8-nb-memory-controller-bypass-saturation [,mask=qualifier]
    (Event E4H) Count memory controller bypass counter saturation events. This event may be further qualified using qualifier, which is a ‘+’ separated set of the following keywords:

    dram-controller-interface-bypass
        Count DRAM controller interface bypass.
    dram-controller-queue-bypass
        Count DRAM controller queue bypass.
    memory-controller-hi-pri-bypass
        Count memory controller high priority bypasses.
    memory-controller-lo-pri-bypass
        Count memory controller low priority bypasses.

k8-nb-memory-controller-dram-slots-missed
    (Event E2H) Count memory controller DRAM command slots missed (in MemClks).

k8-nb-memory-controller-page-access-event [,mask=qualifier]
    (Event E0H) Count memory controller page access events. This event may be further qualified using qualifier, which is a ‘+’ separated set of the following keywords:

    page-conflict
        Count page conflicts.
    page-hit
        Count page hits.
    page-miss
        Count page misses.

    The default is to count all types of events.

k8-nb-memory-controller-page-table-overflow
    (Event E1H) Count memory control page table overflow events.

k8-nb-memory-controller-turnaround [,mask=qualifier]
    (Event E3H) Count memory control turnaround events. This event may be further qualified using qualifier, which is a ‘+’ separated set of the following keywords:

    dimm-turnaround
        Count DIMM turnarounds.
    read-to-write-turnaround
        Count read to write turnarounds.
    write-to-read-turnaround
        Count write to read turnarounds.

    The default is to count all types of events.

k8-nb-probe-result [,mask=qualifier]
    (Event ECH) Count probe events. This event may be further qualified using qualifier, which is a ‘+’ separated set of the following keywords:

    probe-hit
        Count all probe hits.
    probe-hit-dirty-no-memory-cancel
        Count probe hits without memory cancels.
    probe-hit-dirty-with-memory-cancel
        Count probe hits with memory cancels.
    probe-miss
        Count probe misses.

k8-nb-sized-commands [,mask=qualifier]
    (Event EBH) Count sized commands issued. This event may be further qualified using qualifier, which is a ‘+’ separated set of the following keywords:

    nonpostwrszbyte
    nonpostwrszdword
    postwrszbyte
    postwrszdword
    rdszbyte
    rdszdword
    rdmodwr

    The default is to count all types of commands.

  Event Name Aliases
The following table shows the mapping between the PMC-independent aliases supported by libpmc and the underlying hardware events used.
Alias | Event
branches | k8-fr-retired-taken-branches
branch-mispredicts | k8-fr-retired-taken-branches-mispredicted
dc-misses | k8-dc-miss
ic-misses | k8-ic-miss
instructions | k8-fr-retired-x86-instructions
interrupts | k8-fr-taken-hardware-interrupts
unhalted-cycles | k8-bu-cpu-clk-unhalted

SEE ALSO
pmc(3), pmc.atom(3), pmc.core(3), pmc.core2(3), pmc.iaf(3), pmc.k7(3), pmc.soft(3), pmc.tsc(3), pmclog(3), hwpmc(4)

HISTORY
The pmc library first appeared in FreeBSD 6.0.

AUTHORS
The libpmc library was written by Joseph Koshy <jkoshy@FreeBSD.org>.