1 .\" Copyright (c) 2003-2008 Joseph Koshy. All rights reserved.
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\" notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\" notice, this list of conditions and the following disclaimer in the
10 .\" documentation and/or other materials provided with the distribution.
12 .\" This software is provided by Joseph Koshy ``as is'' and
13 .\" any express or implied warranties, including, but not limited to, the
14 .\" implied warranties of merchantability and fitness for a particular purpose
15 .\" are disclaimed. in no event shall Joseph Koshy be liable
16 .\" for any direct, indirect, incidental, special, exemplary, or consequential
17 .\" damages (including, but not limited to, procurement of substitute goods
18 .\" or services; loss of use, data, or profits; or business interruption)
19 .\" however caused and on any theory of liability, whether in contract, strict
20 .\" liability, or tort (including negligence or otherwise) arising in any way
21 .\" out of the use of this software, even if advised of the possibility of
31 .Nd measurement events for
40 AMD K7 PMCs are present in the
42 series of CPUs and are documented in:
44 .%B "AMD Athlon Processor x86 Code Optimization Guide"
45 .%N "Publication No. 22007"
47 .%Q "Advanced Micro Devices, Inc."
50 AMD K7 PMCs are 48 bits wide.
51 Each K7 CPU contains 4 PMCs with the following capabilities:
52 .Bl -column "PMC_CAP_INTERRUPT" "Support"
53 .It Em Capability Ta Em Support
54 .It PMC_CAP_CASCADE Ta \&No
55 .It PMC_CAP_EDGE Ta Yes
56 .It PMC_CAP_INTERRUPT Ta Yes
57 .It PMC_CAP_INVERT Ta Yes
58 .It PMC_CAP_READ Ta Yes
59 .It PMC_CAP_PRECISE Ta \&No
60 .It PMC_CAP_SYSTEM Ta Yes
61 .It PMC_CAP_TAGGING Ta \&No
62 .It PMC_CAP_THRESHOLD Ta Yes
63 .It PMC_CAP_USER Ta Yes
64 .It PMC_CAP_WRITE Ta Yes
68 Event specifiers for AMD K7 PMCs can have the following optional
70 .Bl -tag -width indent
71 .It Li count= Ns Ar value
72 Configure the counter to increment only if the number of configured
73 events measured in a cycle is greater than or equal to
76 Configure the counter to only count negated-to-asserted transitions
77 of the conditions expressed by the other qualifiers.
78 In other words, the counter will increment only once whenever a given
79 condition becomes true, irrespective of the number of clocks during
80 which the condition remains true.
82 Invert the sense of comparison when the
84 qualifier is present, making the counter to increment when the
85 number of events per cycle is less than the value specified by
90 Configure the PMC to count events happening at privilege level 0.
91 .It Li unitmask= Ns Ar mask
92 This qualifier is used to further qualify a select few events,
93 .Dq Li k7-dc-refills-from-l2 ,
94 .Dq Li k7-dc-refills-from-system
96 .Dq Li k7-dc-writebacks .
99 is a string of the following characters optionally separated by
103 .Bl -tag -width indent -compact
105 Count operations for lines in the
109 Count operations for lines in the
113 Count operations for lines in the
117 Count operations for lines in the
121 Count operations for lines in the
128 qualifier is specified, the default is to count events for caches
129 lines in any of the above states.
131 Configure the PMC to count events occurring at privilege levels 1, 2
139 qualifiers were specified, the default is to enable both.
140 .Ss AMD K7 Event Specifiers
141 The event specifiers supported on AMD K7 PMCs are:
142 .Bl -tag -width indent
143 .It Li k7-dc-accesses
145 Count data cache accesses.
148 Count data cache misses.
149 .It Li k7-dc-refills-from-l2 Op Li ,unitmask= Ns Ar mask
151 Count data cache refills from L2 cache.
152 This event may be further qualified using the
155 .It Li k7-dc-refills-from-system Op Li ,unitmask= Ns Ar mask
157 Count data cache refills from system memory.
158 This event may be further qualified using the
161 .It Li k7-dc-writebacks Op Li ,unitmask= Ns Ar mask
163 Count data cache writebacks.
164 This event may be further qualified using the
167 .It Li k7-hardware-interrupts
169 Count the number of taken hardware interrupts.
172 Count instruction cache fetches.
175 Count instruction cache misses.
176 .It Li k7-interrupts-masked-cycles
178 Count the number of cycles when the processor's
181 .It Li k7-interrupts-masked-while-pending-cycles
183 Count the number of cycles interrupts were masked while pending due
187 .It Li k7-l1-and-l2-dtlb-misses
189 Count L1 and L2 DTLB misses.
190 .It Li k7-l1-dtlb-miss-and-l2-dtlb-hits
192 Count L1 DTLB misses and L2 DTLB hits.
193 .It Li k7-l1-itlb-misses
195 Count L1 ITLB misses that are L2 ITLB hits.
196 .It Li k7-l1-l2-itlb-misses
198 Count L1 (and L2) ITLB misses.
199 .It Li k7-misaligned-references
201 Count misaligned data references.
202 .It Li k7-retired-branches
204 Count all retired branches (conditional, unconditional, exceptions
206 .It Li k7-retired-branches-mispredicted
208 Count all mispredicted retired branches.
209 .It Li k7-retired-far-control-transfers
211 Count retired far control transfers.
212 .It Li k7-retired-instructions
214 Count all retired instructions.
215 .It Li k7-retired-ops
218 .It Li k7-retired-resync-branches
220 Count retired resync branches (non control transfer branches).
221 .It Li k7-retired-taken-branches
223 Count retired taken branches.
224 .It Li k7-retired-taken-branches-mispredicted
226 Count mispredicted taken branches that were retired.
228 .Ss Event Name Aliases
229 The following table shows the mapping between the PMC-independent
232 and the underlying hardware events used.
233 .Bl -column "branch-mispredicts" "Description"
234 .It Em Alias Ta Em Event
235 .It Li branches Ta Li k7-retired-branches
236 .It Li branch-mispredicts Ta Li k7-retired-branches-mispredicted
237 .It Li dc-misses Ta Li k7-dc-misses
238 .It Li ic-misses Ta Li k7-ic-misses
239 .It Li instructions Ta Li k7-retired-instructions
240 .It Li interrupts Ta Li k7-hardware-interrupts
241 .It Li unhalted-cycles Ta (unsupported)
259 library first appeared in
264 library was written by
266 .Aq jkoshy@FreeBSD.org .