]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - lib/libpmc/pmc.3
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / lib / libpmc / pmc.3
1 .\" Copyright (c) 2003-2006 Joseph Koshy.  All rights reserved.
2 .\"
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
5 .\" are met:
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.
11 .\"
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
22 .\" such damage.
23 .\"
24 .\" $FreeBSD$
25 .\"
26 .Dd February 25, 2006
27 .Os
28 .Dt PMC 3
29 .Sh NAME
30 .Nm pmc_allocate ,
31 .Nm pmc_attach ,
32 .Nm pmc_capabilities ,
33 .Nm pmc_configure_logfile ,
34 .Nm pmc_cpuinfo ,
35 .Nm pmc_detach ,
36 .Nm pmc_disable ,
37 .Nm pmc_enable ,
38 .Nm pmc_event_names_of_class ,
39 .Nm pmc_flush_logfile ,
40 .Nm pmc_get_driver_stats ,
41 .Nm pmc_get_msr ,
42 .Nm pmc_init ,
43 .Nm pmc_name_of_capability ,
44 .Nm pmc_name_of_class ,
45 .Nm pmc_name_of_cputype ,
46 .Nm pmc_name_of_event ,
47 .Nm pmc_name_of_mode ,
48 .Nm pmc_name_of_state ,
49 .Nm pmc_ncpu ,
50 .Nm pmc_npmc ,
51 .Nm pmc_pmcinfo ,
52 .Nm pmc_read ,
53 .Nm pmc_release ,
54 .Nm pmc_rw ,
55 .Nm pmc_set ,
56 .Nm pmc_start ,
57 .Nm pmc_stop ,
58 .Nm pmc_width ,
59 .Nm pmc_write ,
60 .Nm pmc_writelog
61 .Nd programming API for using hardware performance monitoring counters
62 .Sh LIBRARY
63 .Lb libpmc
64 .Sh SYNOPSIS
65 .In pmc.h
66 .Ft int
67 .Fo pmc_allocate
68 .Fa "const char *eventspecifier"
69 .Fa "enum pmc_mode mode"
70 .Fa "uint32_t flags"
71 .Fa "int cpu"
72 .Fa "pmc_id_t *pmcid"
73 .Fc
74 .Ft int
75 .Fn pmc_attach "pmc_id_t pmcid" "pid_t pid"
76 .Ft int
77 .Fn pmc_capabilities "pmc_id_t pmc" "uint32_t *caps"
78 .Ft int
79 .Fn pmc_configure_logfile "int fd"
80 .Ft int
81 .Fn pmc_cpuinfo "const struct pmc_cpuinfo **cpu_info"
82 .Ft int
83 .Fn pmc_detach "pmc_id_t pmcid" "pid_t pid"
84 .Ft int
85 .Fn pmc_disable "int cpu" "int pmc"
86 .Ft int
87 .Fn pmc_enable "int cpu" "int pmc"
88 .Ft int
89 .Fo pmc_event_names_of_class
90 .Fa "enum pmc_class cl"
91 .Fa "const char ***eventnames"
92 .Fa "int *nevents"
93 .Fc
94 .Ft int
95 .Fn pmc_flush_logfile void
96 .Ft int
97 .Fn pmc_get_driver_stats "struct pmc_driverstats *gms"
98 .Ft int
99 .Fn pmc_get_msr "pmc_id_t pmc" "uint32_t *msr"
100 .Ft int
101 .Fn pmc_init void
102 .Ft "const char *"
103 .Fn pmc_name_of_capability "enum pmc_caps pc"
104 .Ft "const char *"
105 .Fn pmc_name_of_class "enum pmc_class pc"
106 .Ft "const char *"
107 .Fn pmc_name_of_cputype "enum pmc_cputype ct"
108 .Ft "const char *"
109 .Fn pmc_name_of_disposition "enum pmc_disp pd"
110 .Ft "const char *"
111 .Fn pmc_name_of_event "enum pmc_event pe"
112 .Ft "const char *"
113 .Fn pmc_name_of_mode "enum pmc_mode pm"
114 .Ft "const char *"
115 .Fn pmc_name_of_state "enum pmc_state ps"
116 .Ft int
117 .Fn pmc_ncpu void
118 .Ft int
119 .Fn pmc_npmc "int cpu"
120 .Ft int
121 .Fn pmc_pmcinfo "int cpu" "struct pmc_pmcinfo **pmc_info"
122 .Ft int
123 .Fn pmc_read "pmc_id_t pmc" "pmc_value_t *value"
124 .Ft int
125 .Fn pmc_release "pmc_id_t pmc"
126 .Ft int
127 .Fn pmc_rw "pmc_id_t pmc" "pmc_value_t newvalue" "pmc_value_t *oldvaluep"
128 .Ft int
129 .Fn pmc_set "pmc_id_t pmc" "pmc_value_t value"
130 .Ft int
131 .Fn pmc_start "pmc_id_t pmc"
132 .Ft int
133 .Fn pmc_stop "pmc_id_t pmc"
134 .Ft int
135 .Fn pmc_write "pmc_id_t pmc" "pmc_value_t value"
136 .Ft int
137 .Fn pmc_writelog "uint32_t userdata"
138 .Ft int
139 .Fn pmc_width "pmc_id_t pmc" "uint32_t *width"
140 .Sh DESCRIPTION
141 These functions implement a high-level library for using the
142 system's hardware performance counters.
143 .Pp
144 PMCs are allocated using
145 .Fn pmc_allocate ,
146 released using
147 .Fn pmc_release
148 and read using
149 .Fn pmc_read .
150 Allocated PMCs may be started or stopped at any time using
151 .Fn pmc_start
152 and
153 .Fn pmc_stop
154 respectively.
155 An allocated PMC may be of
156 .Dq global
157 scope, meaning that the PMC measures system-wide events, or
158 .Dq process-private
159 scope, meaning that the PMC only counts hardware events when
160 the allocating process (or, optionally, its children)
161 are active.
162 .Pp
163 PMCs may further be in
164 .Dq "counting mode" ,
165 or in
166 .Dq "sampling mode" .
167 Sampling mode PMCs deliver an interrupt to the CPU after
168 a configured number of hardware events have been seen.
169 A process-private sampling mode PMC will cause its owner
170 process to get periodic
171 .Dv SIGPROF
172 interrupts, while a global sampling mode PMC is used to
173 do system-wide statistical sampling (see
174 .Xr hwpmc 4 ) .
175 The sampling rate desired of a sampling-mode PMC is set using
176 .Fn pmc_set .
177 Counting mode PMCs do not interrupt the CPU; their values
178 can be read using
179 .Fn pmc_read .
180 .Pp
181 System-wide statistical sampling is configured by allocating
182 at least one sampling mode PMC with
183 global scope, and when a log file is configured using
184 .Fn pmc_configure_logfile .
185 The
186 .Xr hwpmc 4
187 driver manages system-wide statistical sampling; for more
188 information please see
189 .Xr hwpmc 4 .
190 .Ss Application Programming Interface
191 The function
192 .Fn pmc_init
193 initializes the
194 .Nm pmc
195 library.
196 This function must be called first, before any of the other
197 functions in the library.
198 .Pp
199 The function
200 .Fn pmc_allocate
201 allocates a counter that counts the events named by
202 .Fa eventspecifier ,
203 and writes the allocated counter ID to
204 .Fa *pmcid .
205 Argument
206 .Fa eventspecifier
207 comprises an PMC event name followed by an optional comma separated
208 list of keywords and qualifiers.
209 The allowed syntax for
210 .Fa eventspecifier
211 is processor architecture specific and is listed in section
212 .Sx "EVENT SPECIFIERS"
213 below.
214 The desired PMC mode is specified by
215 .Fa mode ,
216 and any mode specific modifiers are specified using
217 .Fa flags .
218 The
219 .Fa cpu
220 argument is the value
221 .Dv PMC_CPU_ANY ,
222 or names the CPU the allocation is to be on.
223 Requesting a specific CPU only makes sense for global PMCs;
224 process-private PMC allocations should always specify
225 .Dv PMC_CPU_ANY .
226 .Pp
227 By default, a PMC configured in process-virtual counting mode is set up
228 to profile its owner process.
229 The function
230 .Fn pmc_attach
231 may be used to attach the PMC to a different process.
232 It
233 needs to be called before the counter is first started
234 with
235 .Fn pmc_start .
236 The function
237 .Fn pmc_detach
238 may be used to detach a PMC from a process it was attached to
239 using a prior call to
240 .Fn pmc_attach .
241 .Pp
242 The function
243 .Fn pmc_release
244 releases a PMC previously allocated with
245 .Fn pmc_allocate .
246 This function call implicitly detaches the PMC from all its target
247 processes.
248 .Pp
249 An allocated PMC may be started and stopped using
250 .Fn pmc_start
251 and
252 .Fn pmc_stop
253 respectively.
254 .Pp
255 The current value of a PMC may be read with
256 .Fn pmc_read
257 and written using
258 .Fn pmc_write ,
259 provided the underlying hardware supports these operations on
260 the allocated PMC.
261 The read and write operation may be combined using
262 .Fn pmc_rw .
263 .Pp
264 The function
265 .Fn pmc_capabilities
266 sets argument
267 .Fa caps
268 to a bitmask of capabilities supported by the PMC denoted by
269 argument
270 .Fa pmc .
271 The function
272 .Fn pmc_width
273 sets argument
274 .Fa width
275 to the width of the PMC denoted by argument
276 .Fa pmc .
277 .Pp
278 The
279 .Fn pmc_configure_logfile
280 function causes the
281 .Xr hwpmc 4
282 driver to log performance data to file corresponding
283 to the process' file handle
284 .Fa fd .
285 If argument
286 .Fa fd
287 is \-1, then any previously configured logging is reset
288 and all data queued to be written are discarded.
289 .Pp
290 The
291 .Fn pmc_flush_logfile
292 function will send all data queued inside the
293 .Xr hwpmc 4
294 driver to the configured log file before returning.
295 The
296 .Fn pmc_writelog
297 function will append a log entry containing the argument
298 .Fa userdata
299 to the log file.
300 .Pp
301 The function
302 .Fn pmc_set
303 configures a sampling PMC
304 .Fa pmc
305 to interrupt every
306 .Fa value
307 events.
308 For counting PMCs,
309 .Fn pmc_set
310 sets the initial value of the PMC to
311 .Fa value .
312 .Pp
313 The function
314 .Fn pmc_get_driver_statistics
315 copies a snapshot of the usage statistics maintained by
316 .Xr hwpmc 4
317 into the memory area pointed to by argument
318 .Fa gms .
319 .Ss Signal Handling Requirements
320 Applications using PMCs are required to handle the following signals:
321 .Bl -tag -width indent
322 .It Dv SIGBUS
323 When the
324 .Xr hwpmc 4
325 module is unloaded using
326 .Xr kldunload 8 ,
327 processes that have PMCs allocated to them will be sent a
328 .Dv SIGBUS
329 signal.
330 .It Dv SIGIO
331 The
332 .Xr hwpmc 4
333 driver will send a PMC owning process a
334 .Dv SIGIO
335 signal if:
336 .Bl -bullet
337 .It
338 If any process-mode PMC allocated by it loses all its
339 target processes.
340 .It
341 If the driver encounters an error when writing log data to a
342 configured log file.
343 This error may be retrieved by a subsequent call to
344 .Fn pmc_flush_logfile .
345 .El
346 .El
347 .Ss Convenience Functions
348 The function
349 .Fn pmc_ncpu
350 returns the number of CPUs present in the system.
351 .Pp
352 The function
353 .Fn pmc_npmc
354 returns the number of PMCs supported on CPU
355 .Fa cpu .
356 The function
357 .Fn pmc_cpuinfo
358 sets argument
359 .Fa cpu_info
360 to point to an internal structure with information about the system's CPUs.
361 The caller should not
362 .Fn free
363 this pointer value.
364 Function
365 .Fn pmc_pmcinfo
366 returns information about the current state of CPU
367 .Fa cpu Ns 's
368 PMCs.
369 This function sets argument
370 .Fa *pmc_info
371 to point to a memory area allocated with
372 .Xr calloc 3 .
373 The caller is expected to
374 .Fn free
375 the area when done.
376 .Pp
377 The functions
378 .Fn pmc_name_of_capability ,
379 .Fn pmc_name_of_class ,
380 .Fn pmc_name_of_cputype ,
381 .Fn pmc_name_of_disposition ,
382 .Fn pmc_name_of_event ,
383 .Fn pmc_name_of_mode
384 and
385 .Fn pmc_name_of_state
386 are useful for code wanting to print error messages.
387 They return
388 .Vt "const char *"
389 pointers to human-readable representations of their arguments.
390 These return values should not be freed using
391 .Xr free 3 .
392 .Pp
393 The function
394 .Fn pmc_event_names_of_class
395 returns a list of event names supported by a given PMC class
396 .Fa cl .
397 On successful return, an array of
398 .Vt "const char *"
399 pointers to the names of valid events supported by class
400 .Fa cl
401 is allocated by the library using
402 .Xr malloc 3 ,
403 and a pointer to this array is returned in the location pointed to by
404 .Fa eventnames .
405 The number of pointers allocated is returned in the location pointed
406 to by
407 .Fa nevents .
408 .Ss Administration
409 Individual PMCs may be enabled or disabled on a given CPU using
410 .Fn pmc_enable
411 and
412 .Fn pmc_disable
413 respectively.
414 For these functions,
415 .Fa cpu
416 is the CPU number, and
417 .Fa pmc
418 is the index of the PMC to be operated on.
419 Only the super-user is allowed to enable and disable PMCs.
420 .Ss x86 Architecture Specific API
421 The
422 .Fn pmc_get_msr
423 function returns the processor model specific register number
424 associated with
425 .Fa pmc .
426 Applications may use the x86
427 .Ic RDPMC
428 instruction to directly read the contents of the PMC.
429 .Sh EVENT SPECIFIERS
430 Event specifiers are strings comprising of an event name, followed by
431 optional parameters modifying the semantics of the hardware event
432 being probed.
433 Event names are PMC architecture dependent, but the
434 .Xr hwpmc 4
435 library defines machine independent aliases for commonly used
436 events.
437 .Ss Event Name Aliases
438 Event name aliases are CPU architecture independent names for commonly
439 used events.
440 The following aliases are known to this version of the
441 .Nm pmc
442 library:
443 .Bl -tag -width indent
444 .It Li branches
445 Measure the number of branches retired.
446 .It Li branch-mispredicts
447 Measure the number of retired branches that were mispredicted.
448 .It Li cycles
449 Measure processor cycles.
450 This event is implemented using the processor's Time Stamp Counter
451 register.
452 .It Li dc-misses
453 Measure the number of data cache misses.
454 .It Li ic-misses
455 Measure the number of instruction cache misses.
456 .It Li instructions
457 Measure the number of instructions retired.
458 .It Li interrupts
459 Measure the number of interrupts seen.
460 .It Li unhalted-cycles
461 Measure the number of cycles the processor is not in a halted
462 or sleep state.
463 .El
464 .Ss Time Stamp Counter (TSC)
465 The timestamp counter is a monotonically non-decreasing counter that
466 counts processor cycles.
467 .Pp
468 In the i386 architecture, this counter may
469 be selected by requesting an event with event specifier
470 .Dq Li tsc .
471 The
472 .Dq Li tsc
473 event does not support any further qualifiers.
474 It can only be allocated in system-wide counting mode,
475 and is a read-only counter.
476 Multiple processes are allowed to allocate the TSC.
477 Once allocated, it may be read using the
478 .Fn pmc_read
479 function, or by using the RDTSC instruction.
480 .Ss AMD (K7) PMCs
481 These PMCs are present in the
482 .Tn "AMD Athlon"
483 series of CPUs and are documented in:
484 .Rs
485 .%B "AMD Athlon Processor x86 Code Optimization Guide"
486 .%N "Publication No. 22007"
487 .%D "February 2002"
488 .%Q "Advanced Micro Devices, Inc."
489 .Re
490 .Pp
491 Event specifiers for AMD K7 PMCs can have the following optional
492 qualifiers:
493 .Bl -tag -width indent
494 .It Li count= Ns Ar value
495 Configure the counter to increment only if the number of configured
496 events measured in a cycle is greater than or equal to
497 .Ar value .
498 .It Li edge
499 Configure the counter to only count negated-to-asserted transitions
500 of the conditions expressed by the other qualifiers.
501 In other words, the counter will increment only once whenever a given
502 condition becomes true, irrespective of the number of clocks during
503 which the condition remains true.
504 .It Li inv
505 Invert the sense of comparision when the
506 .Dq Li count
507 qualifier is present, making the counter to increment when the
508 number of events per cycle is less than the value specified by
509 the
510 .Dq Li count
511 qualifier.
512 .It Li os
513 Configure the PMC to count events happening at privilege level 0.
514 .It Li unitmask= Ns Ar mask
515 This qualifier is used to further qualify a select few events,
516 .Dq Li k7-dc-refills-from-l2 ,
517 .Dq Li k7-dc-refills-from-system
518 and
519 .Dq Li k7-dc-writebacks .
520 Here
521 .Ar mask
522 is a string of the following characters optionally separated by
523 .Ql +
524 characters:
525 .Pp
526 .Bl -tag -width indent -compact
527 .It Li m
528 Count operations for lines in the
529 .Dq Modified
530 state.
531 .It Li o
532 Count operations for lines in the
533 .Dq Owner
534 state.
535 .It Li e
536 Count operations for lines in the
537 .Dq Exclusive
538 state.
539 .It Li s
540 Count operations for lines in the
541 .Dq Shared
542 state.
543 .It Li i
544 Count operations for lines in the
545 .Dq Invalid
546 state.
547 .El
548 .Pp
549 If no
550 .Dq Li unitmask
551 qualifier is specified, the default is to count events for caches
552 lines in any of the above states.
553 .It Li usr
554 Configure the PMC to count events occurring at privilege levels 1, 2
555 or 3.
556 .El
557 .Pp
558 If neither of the
559 .Dq Li os
560 or
561 .Dq Li usr
562 qualifiers were specified, the default is to enable both.
563 .Pp
564 The event specifiers supported on AMD K7 PMCs are:
565 .Bl -tag -width indent
566 .It Li k7-dc-accesses
567 Count data cache accesses.
568 .It Li k7-dc-misses
569 Count data cache misses.
570 .It Li k7-dc-refills-from-l2 Op Li ,unitmask= Ns Ar mask
571 Count data cache refills from L2 cache.
572 This event may be further qualified using the
573 .Dq Li unitmask
574 qualifier.
575 .It Li k7-dc-refills-from-system Op Li ,unitmask= Ns Ar mask
576 Count data cache refills from system memory.
577 This event may be further qualified using the
578 .Dq Li unitmask
579 qualifier.
580 .It Li k7-dc-writebacks Op Li ,unitmask= Ns Ar mask
581 Count data cache writebacks.
582 This event may be further qualified using the
583 .Dq Li unitmask
584 qualifier.
585 .It Li k7-l1-dtlb-miss-and-l2-dtlb-hits
586 Count L1 DTLB misses and L2 DTLB hits.
587 .It Li k7-l1-and-l2-dtlb-misses
588 Count L1 and L2 DTLB misses.
589 .It Li k7-misaligned-references
590 Count misaligned data references.
591 .It Li k7-ic-fetches
592 Count instruction cache fetches.
593 .It Li k7-ic-misses
594 Count instruction cache misses.
595 .It Li k7-l1-itlb-misses
596 Count L1 ITLB misses that are L2 ITLB hits.
597 .It Li k7-l1-l2-itlb-misses
598 Count L1 (and L2) ITLB misses.
599 .It Li k7-retired-instructions
600 Count all retired instructions.
601 .It Li k7-retired-ops
602 Count retired ops.
603 .It Li k7-retired-branches
604 Count all retired branches (conditional, unconditional, exceptions
605 and interrupts).
606 .It Li k7-retired-branches-mispredicted
607 Count all misprediced retired branches.
608 .It Li k7-retired-taken-branches
609 Count retired taken branches.
610 .It Li k7-retired-taken-branches-mispredicted
611 Count mispredicted taken branches that were retired.
612 .It Li k7-retired-far-control-transfers
613 Count retired far control transfers.
614 .It Li k7-retired-resync-branches
615 Count retired resync branches (non control transfer branches).
616 .It Li k7-interrupts-masked-cycles
617 Count the number of cycles when the processor's
618 .Va IF
619 flag was zero.
620 .It Li k7-interrupts-masked-while-pending-cycles
621 Count the number of cycles interrupts were masked while pending due
622 to the processor's
623 .Va IF
624 flag being zero.
625 .It Li k7-hardware-interrupts
626 Count the number of taken hardware interrupts.
627 .El
628 .Ss AMD (K8) PMCs
629 These PMCs are present in the
630 .Tn "AMD Athlon64"
631 and
632 .Tn "AMD Opteron"
633 series of CPUs.
634 They are documented in:
635 .Rs
636 .%B "BIOS and Kernel Developer's Guide for the AMD Athlon(tm) 64 and AMD Opteron Processors"
637 .%N "Publication No. 26094"
638 .%D "April 2004"
639 .%Q "Advanced Micro Devices, Inc."
640 .Re
641 .Pp
642 Event specifiers for AMD K8 PMCs can have the following optional
643 qualifiers:
644 .Bl -tag -width indent
645 .It Li count= Ns Ar value
646 Configure the counter to increment only if the number of configured
647 events measured in a cycle is greater than or equal to
648 .Ar value .
649 .It Li edge
650 Configure the counter to only count negated-to-asserted transitions
651 of the conditions expressed by the other fields.
652 In other words, the counter will increment only once whenever a given
653 condition becomes true, irrespective of the number of clocks during
654 which the condition remains true.
655 .It Li inv
656 Invert the sense of comparision when the
657 .Dq Li count
658 qualifier is present, making the counter to increment when the
659 number of events per cycle is less than the value specified by
660 the
661 .Dq Li count
662 qualifier.
663 .It Li mask= Ns Ar qualifier
664 Many event specifiers for AMD K8 PMCs need to be additionally
665 qualified using a mask qualifier.
666 These additional qualifiers are event-specific and are documented
667 along with their associated event specifiers below.
668 .It Li os
669 Configure the PMC to count events happening at privilege level 0.
670 .It Li usr
671 Configure the PMC to count events occurring at privilege levels 1, 2
672 or 3.
673 .El
674 .Pp
675 If neither of the
676 .Dq Li os
677 or
678 .Dq Li usr
679 qualifiers were specified, the default is to enable both.
680 .Pp
681 The event specifiers supported on AMD K8 PMCs are:
682 .Bl -tag -width indent
683 .It Li k8-bu-cpu-clk-unhalted
684 Count the number of clock cycles when the CPU is not in the HLT or
685 STPCLK states.
686 .It Li k8-bu-fill-request-l2-miss Op Li ,mask= Ns Ar qualifier
687 Count fill requests that missed in the L2 cache.
688 This event may be further qualified using
689 .Ar qualifier ,
690 which is a
691 .Ql +
692 separated set of the following keywords:
693 .Pp
694 .Bl -tag -width indent -compact
695 .It Li dc-fill
696 Count data cache fill requests.
697 .It Li ic-fill
698 Count instruction cache fill requests.
699 .It Li tlb-reload
700 Count TLB reloads.
701 .El
702 .Pp
703 The default is to count all types of requests.
704 .It Li k8-bu-internal-l2-request Op Li ,mask= Ns Ar qualifier
705 Count internally generated requests to the L2 cache.
706 This event may be further qualified using
707 .Ar qualifier ,
708 which is a
709 .Ql +
710 separated set of the following keywords:
711 .Pp
712 .Bl -tag -width indent -compact
713 .It Li cancelled
714 Count cancelled requests.
715 .It Li dc-fill
716 Count data cache fill requests.
717 .It Li ic-fill
718 Count instruction cache fill requests.
719 .It Li tag-snoop
720 Count tag snoop requests.
721 .It Li tlb-reload
722 Count TLB reloads.
723 .El
724 .Pp
725 The default is to count all types of requests.
726 .It Li k8-dc-access
727 Count data cache accesses including microcode scratchpad accesses.
728 .It Li k8-dc-copyback Op Li ,mask= Ns Ar qualifier
729 Count data cache copyback operations.
730 This event may be further qualified using
731 .Ar qualifier ,
732 which is a
733 .Ql +
734 separated set of the following keywords:
735 .Pp
736 .Bl -tag -width indent -compact
737 .It Li exclusive
738 Count operations for lines in the
739 .Dq exclusive
740 state.
741 .It Li invalid
742 Count operations for lines in the
743 .Dq invalid
744 state.
745 .It Li modified
746 Count operations for lines in the
747 .Dq modified
748 state.
749 .It Li owner
750 Count operations for lines in the
751 .Dq owner
752 state.
753 .It Li shared
754 Count operations for lines in the
755 .Dq shared
756 state.
757 .El
758 .Pp
759 The default is to count operations for lines in all the
760 above states.
761 .It Li k8-dc-dcache-accesses-by-locks Op Li ,mask= Ns Ar qualifier
762 Count data cache accesses by lock instructions.
763 This event is only available on processors of revision C or later
764 vintage.
765 This event may be further qualified using
766 .Ar qualifier ,
767 which is a
768 .Ql +
769 separated set of the following keywords:
770 .Pp
771 .Bl -tag -width indent -compact
772 .It Li accesses
773 Count data cache accesses by lock instructions.
774 .It Li misses
775 Count data cache misses by lock instructions.
776 .El
777 .Pp
778 The default is to count all accesses.
779 .It Li k8-dc-dispatched-prefetch-instructions Op Li ,mask= Ns Ar qualifier
780 Count the number of dispatched prefetch instructions.
781 This event may be further qualified using
782 .Ar qualifier ,
783 which is a
784 .Ql +
785 separated set of the following keywords:
786 .Pp
787 .Bl -tag -width indent -compact
788 .It Li load
789 Count load operations.
790 .It Li nta
791 Count non-temporal operations.
792 .It Li store
793 Count store operations.
794 .El
795 .Pp
796 The default is to count all operations.
797 .It Li k8-dc-l1-dtlb-miss-and-l2-dtlb-hit
798 Count L1 DTLB misses that are L2 DTLB hits.
799 .It Li k8-dc-l1-dtlb-miss-and-l2-dtlb-miss
800 Count L1 DTLB misses that are also misses in the L2 DTLB.
801 .It Li k8-dc-microarchitectural-early-cancel-of-an-access
802 Count microarchitectural early cancels of data cache accesses.
803 .It Li k8-dc-microarchitectural-late-cancel-of-an-access
804 Count microarchitectural late cancels of data cache accesses.
805 .It Li k8-dc-misaligned-data-reference
806 Count misaligned data references.
807 .It Li k8-dc-miss
808 Count data cache misses.
809 .It Li k8-dc-one-bit-ecc-error Op Li ,mask= Ns Ar qualifier
810 Count one bit ECC errors found by the scrubber.
811 This event may be further qualified using
812 .Ar qualifier ,
813 which is a
814 .Ql +
815 separated set of the following keywords:
816 .Pp
817 .Bl -tag -width indent -compact
818 .It Li scrubber
819 Count scrubber detected errors.
820 .It Li piggyback
821 Count piggyback scrubber errors.
822 .El
823 .Pp
824 The default is to count both kinds of errors.
825 .It Li k8-dc-refill-from-l2 Op Li ,mask= Ns Ar qualifier
826 Count data cache refills from L2 cache.
827 This event may be further qualified using
828 .Ar qualifier ,
829 which is a
830 .Ql +
831 separated set of the following keywords:
832 .Pp
833 .Bl -tag -width indent -compact
834 .It Li exclusive
835 Count operations for lines in the
836 .Dq exclusive
837 state.
838 .It Li invalid
839 Count operations for lines in the
840 .Dq invalid
841 state.
842 .It Li modified
843 Count operations for lines in the
844 .Dq modified
845 state.
846 .It Li owner
847 Count operations for lines in the
848 .Dq owner
849 state.
850 .It Li shared
851 Count operations for lines in the
852 .Dq shared
853 state.
854 .El
855 .Pp
856 The default is to count operations for lines in all the
857 above states.
858 .It Li k8-dc-refill-from-system Op Li ,mask= Ns Ar qualifier
859 Count data cache refills from system memory.
860 This event may be further qualified using
861 .Ar qualifier ,
862 which is a
863 .Ql +
864 separated set of the following keywords:
865 .Pp
866 .Bl -tag -width indent -compact
867 .It Li exclusive
868 Count operations for lines in the
869 .Dq exclusive
870 state.
871 .It Li invalid
872 Count operations for lines in the
873 .Dq invalid
874 state.
875 .It Li modified
876 Count operations for lines in the
877 .Dq modified
878 state.
879 .It Li owner
880 Count operations for lines in the
881 .Dq owner
882 state.
883 .It Li shared
884 Count operations for lines in the
885 .Dq shared
886 state.
887 .El
888 .Pp
889 The default is to count operations for lines in all the
890 above states.
891 .It Li k8-fp-dispatched-fpu-ops Op Li ,mask= Ns Ar qualifier
892 Count the number of dispatched FPU ops.
893 This event is supported in revision B and later CPUs.
894 This event may be further qualified using
895 .Ar qualifier ,
896 which is a
897 .Ql +
898 separated set of the following keywords:
899 .Pp
900 .Bl -tag -width indent -compact
901 .It Li add-pipe-excluding-junk-ops
902 Count add pipe ops excluding junk ops.
903 .It Li add-pipe-junk-ops
904 Count junk ops in the add pipe.
905 .It Li multiply-pipe-excluding-junk-ops
906 Count multiply pipe ops excluding junk ops.
907 .It Li multiply-pipe-junk-ops
908 Count junk ops in the multiply pipe.
909 .It Li store-pipe-excluding-junk-ops
910 Count store pipe ops excluding junk ops
911 .It Li store-pipe-junk-ops
912 Count junk ops in the store pipe.
913 .El
914 .Pp
915 The default is to count all types of ops.
916 .It Li k8-fp-cycles-with-no-fpu-ops-retired
917 Count cycles when no FPU ops were retired.
918 This event is supported in revision B and later CPUs.
919 .It Li k8-fp-dispatched-fpu-fast-flag-ops
920 Count dispatched FPU ops that use the fast flag interface.
921 This event is supported in revision B and later CPUs.
922 .It Li k8-fr-decoder-empty
923 Count cycles when there was nothing to dispatch (i.e., the decoder
924 was empty).
925 .It Li k8-fr-dispatch-stalls
926 Count all dispatch stalls.
927 .It Li k8-fr-dispatch-stall-for-segment-load
928 Count dispatch stalls for segment loads.
929 .It Li k8-fr-dispatch-stall-for-serialization
930 Count dispatch stalls for serialization.
931 .It Li k8-fr-dispatch-stall-from-branch-abort-to-retire
932 Count dispatch stalls from branch abort to retiral.
933 .It Li k8-fr-dispatch-stall-when-fpu-is-full
934 Count dispatch stalls when the FPU is full.
935 .It Li k8-fr-dispatch-stall-when-ls-is-full
936 Count dispatch stalls when the load/store unit is full.
937 .It Li k8-fr-dispatch-stall-when-reorder-buffer-is-full
938 Count dispatch stalls when the reorder buffer is full.
939 .It Li k8-fr-dispatch-stall-when-reservation-stations-are-full
940 Count dispatch stalls when reservation stations are full.
941 .It Li k8-fr-dispatch-stall-when-waiting-for-all-to-be-quiet
942 Count dispatch stalls when waiting for all to be quiet.
943 .\" XXX What does "waiting for all to be quiet" mean?
944 .It Li k8-fr-dispatch-stall-when-waiting-far-xfer-or-resync-branch-pending
945 Count dispatch stalls when a far control transfer or a resync branch
946 is pending.
947 .It Li k8-fr-fpu-exceptions Op Li ,mask= Ns Ar qualifier
948 Count FPU exceptions.
949 This event is supported in revision B and later CPUs.
950 This event may be further qualified using
951 .Ar qualifier ,
952 which is a
953 .Ql +
954 separated set of the following keywords:
955 .Pp
956 .Bl -tag -width indent -compact
957 .It Li sse-and-x87-microtraps
958 Count SSE and x87 microtraps.
959 .It Li sse-reclass-microfaults
960 Count SSE reclass microfaults
961 .It Li sse-retype-microfaults
962 Count SSE retype microfaults
963 .It Li x87-reclass-microfaults
964 Count x87 reclass microfaults.
965 .El
966 .Pp
967 The default is to count all types of exceptions.
968 .It Li k8-fr-interrupts-masked-cycles
969 Count cycles when interrupts were masked (by CPU RFLAGS field IF was zero).
970 .It Li k8-fr-interrupts-masked-while-pending-cycles
971 Count cycles while interrupts were masked while pending (i.e., cycles
972 when INTR was asserted while CPU RFLAGS field IF was zero).
973 .It Li k8-fr-number-of-breakpoints-for-dr0
974 Count the number of breakpoints for DR0.
975 .It Li k8-fr-number-of-breakpoints-for-dr1
976 Count the number of breakpoints for DR1.
977 .It Li k8-fr-number-of-breakpoints-for-dr2
978 Count the number of breakpoints for DR2.
979 .It Li k8-fr-number-of-breakpoints-for-dr3
980 Count the number of breakpoints for DR3.
981 .It Li k8-fr-retired-branches
982 Count retired branches including exceptions and interrupts.
983 .It Li k8-fr-retired-branches-mispredicted
984 Count mispredicted retired branches.
985 .It Li k8-fr-retired-far-control-transfers
986 Count retired far control transfers (which are always mispredicted).
987 .It Li k8-fr-retired-fastpath-double-op-instructions Op Li ,mask= Ns Ar qualifier
988 Count retired fastpath double op instructions.
989 This event is supported in revision B and later CPUs.
990 This event may be further qualified using
991 .Ar qualifier ,
992 which is a
993 .Ql +
994 separated set of the following keywords:
995 .Pp
996 .Bl -tag -width indent -compact
997 .It Li low-op-pos-0
998 Count instructions with the low op in position 0.
999 .It Li low-op-pos-1
1000 Count instructions with the low op in position 1.
1001 .It Li low-op-pos-2
1002 Count instructions with the low op in position 2.
1003 .El
1004 .Pp
1005 The default is to count all types of instructions.
1006 .It Li k8-fr-retired-fpu-instructions Op Li ,mask= Ns Ar qualifier
1007 Count retired FPU instructions.
1008 This event is supported in revision B and later CPUs.
1009 This event may be further qualified using
1010 .Ar qualifier ,
1011 which is a
1012 .Ql +
1013 separated set of the following keywords:
1014 .Pp
1015 .Bl -tag -width indent -compact
1016 .It Li mmx-3dnow
1017 Count MMX and 3DNow!\& instructions.
1018 .It Li packed-sse-sse2
1019 Count packed SSE and SSE2 instructions.
1020 .It Li scalar-sse-sse2
1021 Count scalar SSE and SSE2 instructions
1022 .It Li x87
1023 Count x87 instructions.
1024 .El
1025 .Pp
1026 The default is to count all types of instructions.
1027 .It Li k8-fr-retired-near-returns
1028 Count retired near returns.
1029 .It Li k8-fr-retired-near-returns-mispredicted
1030 Count mispredicted near returns.
1031 .It Li k8-fr-retired-resyncs
1032 Count retired resyncs (non-control transfer branches).
1033 .It Li k8-fr-retired-taken-hardware-interrupts
1034 Count retired taken hardware interrupts.
1035 .It Li k8-fr-retired-taken-branches
1036 Count retired taken branches.
1037 .It Li k8-fr-retired-taken-branches-mispredicted
1038 Count retired taken branches that were mispredicted.
1039 .It Li k8-fr-retired-taken-branches-mispredicted-by-addr-miscompare
1040 Count retired taken branches that were mispredicted only due to an
1041 address miscompare.
1042 .It Li k8-fr-retired-uops
1043 Count retired uops.
1044 .It Li k8-fr-retired-x86-instructions
1045 Count retired x86 instructions including exceptions and interrupts.
1046 .It Li k8-ic-fetch
1047 Count instruction cache fetches.
1048 .It Li k8-ic-instruction-fetch-stall
1049 Count cycles in stalls due to instruction fetch.
1050 .It Li k8-ic-l1-itlb-miss-and-l2-itlb-hit
1051 Count L1 ITLB misses that are L2 ITLB hits.
1052 .It Li k8-ic-l1-itlb-miss-and-l2-itlb-miss
1053 Count ITLB misses that miss in both L1 and L2 ITLBs.
1054 .It Li k8-ic-microarchitectural-resync-by-snoop
1055 Count microarchitectural resyncs caused by snoops.
1056 .It Li k8-ic-miss
1057 Count instruction cache misses.
1058 .It Li k8-ic-refill-from-l2
1059 Count instruction cache refills from L2 cache.
1060 .It Li k8-ic-refill-from-system
1061 Count instruction cache refills from system memory.
1062 .It Li k8-ic-return-stack-hits
1063 Count hits to the return stack.
1064 .It Li k8-ic-return-stack-overflow
1065 Count overflows of the return stack.
1066 .It Li k8-ls-buffer2-full
1067 Count load/store buffer2 full events.
1068 .It Li k8-ls-locked-operation Op Li ,mask= Ns Ar qualifier
1069 Count locked operations.
1070 For revision C and later CPUs, the following qualifiers are supported:
1071 .Pp
1072 .Bl -tag -width indent -compact
1073 .It Li cycles-in-request
1074 Count the number of cycles in the lock request/grant stage.
1075 .It Li cycles-to-complete
1076 Count the number of cycles a lock takes to complete once it is
1077 non-speculative and is the older load/store operation.
1078 .It Li locked-instructions
1079 Count the number of lock instructions executed.
1080 .El
1081 .Pp
1082 The default is to count the number of lock instructions executed.
1083 .It Li k8-ls-microarchitectural-late-cancel
1084 Count microarchitectural late cancels of operations in the load/store
1085 unit.
1086 .It Li k8-ls-microarchitectural-resync-by-self-modifying-code
1087 Count microarchitectural resyncs caused by self-modifying code.
1088 .It Li k8-ls-microarchitectural-resync-by-snoop
1089 Count microarchitectural resyncs caused by snoops.
1090 .It Li k8-ls-retired-cflush-instructions
1091 Count retired CFLUSH instructions.
1092 .It Li k8-ls-retired-cpuid-instructions
1093 Count retired CPUID instructions.
1094 .It Li k8-ls-segment-register-load Op Li ,mask= Ns Ar qualifier
1095 Count segment register loads.
1096 This event may be further qualified using
1097 .Ar qualifier ,
1098 which is a
1099 .Ql +
1100 separated set of the following keywords:
1101 .Bl -tag -width indent -compact
1102 .It Li cs
1103 Count CS register loads.
1104 .It Li ds
1105 Count DS register loads.
1106 .It Li es
1107 Count ES register loads.
1108 .It Li fs
1109 Count FS register loads.
1110 .It Li gs
1111 Count GS register loads.
1112 .\" .It Li hs
1113 .\" Count HS register loads.
1114 .\" XXX "HS" register?
1115 .It Li ss
1116 Count SS register loads.
1117 .El
1118 .Pp
1119 The default is to count all types of loads.
1120 .It Li k8-nb-memory-controller-bypass-saturation Op Li ,mask= Ns Ar qualifier
1121 Count memory controller bypass counter saturation events.
1122 This event may be further qualified using
1123 .Ar qualifier ,
1124 which is a
1125 .Ql +
1126 separated set of the following keywords:
1127 .Pp
1128 .Bl -tag -width indent -compact
1129 .It Li dram-controller-interface-bypass
1130 Count DRAM controller interface bypass.
1131 .It Li dram-controller-queue-bypass
1132 Count DRAM controller queue bypass.
1133 .It Li memory-controller-hi-pri-bypass
1134 Count memory controller high priority bypasses.
1135 .It Li memory-controller-lo-pri-bypass
1136 Count memory controller low priority bypasses.
1137 .El
1138 .Pp
1139 .It Li k8-nb-memory-controller-dram-slots-missed
1140 Count memory controller DRAM command slots missed (in MemClks).
1141 .It Li k8-nb-memory-controller-page-access-event Op Li ,mask= Ns Ar qualifier
1142 Count memory controller page access events.
1143 This event may be further qualified using
1144 .Ar qualifier ,
1145 which is a
1146 .Ql +
1147 separated set of the following keywords:
1148 .Pp
1149 .Bl -tag -width indent -compact
1150 .It Li page-conflict
1151 Count page conflicts.
1152 .It Li page-hit
1153 Count page hits.
1154 .It Li page-miss
1155 Count page misses.
1156 .El
1157 .Pp
1158 The default is to count all types of events.
1159 .It Li k8-nb-memory-controller-page-table-overflow
1160 Count memory control page table overflow events.
1161 .It Li k8-nb-probe-result Op Li ,mask= Ns Ar qualifier
1162 Count probe events.
1163 This event may be further qualified using
1164 .Ar qualifier ,
1165 which is a
1166 .Ql +
1167 separated set of the following keywords:
1168 .Pp
1169 .Bl -tag -width indent -compact
1170 .It Li probe-hit
1171 Count all probe hits.
1172 .It Li probe-hit-dirty-no-memory-cancel
1173 Count probe hits without memory cancels.
1174 .It Li probe-hit-dirty-with-memory-cancel
1175 Count probe hits with memory cancels.
1176 .It Li probe-miss
1177 Count probe misses.
1178 .El
1179 .It Li k8-nb-sized-commands Op Li ,mask= Ns Ar qualifier
1180 Count sized commands issued.
1181 This event may be further qualified using
1182 .Ar qualifier ,
1183 which is a
1184 .Ql +
1185 separated set of the following keywords:
1186 .Pp
1187 .Bl -tag -width indent -compact
1188 .It Li nonpostwrszbyte
1189 .It Li nonpostwrszdword
1190 .It Li postwrszbyte
1191 .It Li postwrszdword
1192 .It Li rdszbyte
1193 .It Li rdszdword
1194 .It Li rdmodwr
1195 .El
1196 .Pp
1197 The default is to count all types of commands.
1198 .It Li k8-nb-memory-controller-turnaround Op Li ,mask= Ns Ar qualifier
1199 Count memory control turnaround events.
1200 This event may be further qualified using
1201 .Ar qualifier ,
1202 which is a
1203 .Ql +
1204 separated set of the following keywords:
1205 .Pp
1206 .Bl -tag -width indent -compact
1207 .\" XXX doc is unclear whether these are cycle counts or event counts
1208 .It Li dimm-turnaround
1209 Count DIMM turnarounds.
1210 .It Li read-to-write-turnaround
1211 Count read to write turnarounds.
1212 .It Li write-to-read-turnaround
1213 Count write to read turnarounds.
1214 .El
1215 .Pp
1216 The default is to count all types of events.
1217 .It Li k8-nb-ht-bus0-bandwidth Op Li ,mask= Ns Ar qualifier
1218 .It Li k8-nb-ht-bus1-bandwidth Op Li ,mask= Ns Ar qualifier
1219 .It Li k8-nb-ht-bus2-bandwidth Op Li ,mask= Ns Ar qualifier
1220 Count events on the HyperTransport(tm) buses.
1221 These events may be further qualified using
1222 .Ar qualifier ,
1223 which is a
1224 .Ql +
1225 separated set of the following keywords:
1226 .Pp
1227 .Bl -tag -width indent -compact
1228 .It Li buffer-release
1229 Count buffer release messages sent.
1230 .It Li command
1231 Count command messages sent.
1232 .It Li data
1233 Count data messages sent.
1234 .It Li nop
1235 Count nop messages sent.
1236 .El
1237 .Pp
1238 The default is to count all types of messages.
1239 .El
1240 .Ss Intel P6 PMCS
1241 Intel P6 PMCs are present in Intel
1242 .Tn "Pentium Pro" ,
1243 .Tn "Pentium II" ,
1244 .Tn Celeron ,
1245 .Tn "Pentium III"
1246 and
1247 .Tn "Pentium M"
1248 processors.
1249 .Pp
1250 These CPUs have two counters.
1251 Some events may only be used on specific counters and some events are
1252 defined only on specific processor models.
1253 .Pp
1254 These PMCs are documented in
1255 .Rs
1256 .%B "IA-32 Intel(R) Architecture Software Developer's Manual"
1257 .%T "Volume 3: System Programming Guide"
1258 .%N "Order Number 245472-012"
1259 .%D 2003
1260 .%Q "Intel Corporation"
1261 .Re
1262 .Pp
1263 Some of these events are affected by processor errata described in
1264 .Rs
1265 .%B "Intel(R) Pentium(R) III Processor Specification Update"
1266 .%N "Document Number: 244453-054"
1267 .%D "April 2005"
1268 .%Q "Intel Corporation"
1269 .Re
1270 .Pp
1271 Event specifiers for Intel P6 PMCs can have the following common
1272 qualifiers:
1273 .Bl -tag -width indent
1274 .It Li cmask= Ns Ar value
1275 Configure the PMC to increment only if the number of configured
1276 events measured in a cycle is greater than or equal to
1277 .Ar value .
1278 .It Li edge
1279 Configure the PMC to count the number of deasserted to asserted
1280 transitions of the conditions expressed by the other qualifiers.
1281 If specified, the counter will increment only once whenever a
1282 condition becomes true, irrespective of the number of clocks during
1283 which the condition remains true.
1284 .It Li inv
1285 Invert the sense of comparision when the
1286 .Dq Li cmask
1287 qualifier is present, making the counter increment when the number of
1288 events per cycle is less than the value specified by the
1289 .Dq Li cmask
1290 qualifier.
1291 .It Li os
1292 Configure the PMC to count events happening at processor privilege
1293 level 0.
1294 .It Li umask= Ns Ar value
1295 This qualifier is used to further qualify the event selected (see
1296 below).
1297 .It Li usr
1298 Configure the PMC to count events occurring at privilege levels 1, 2
1299 or 3.
1300 .El
1301 .Pp
1302 If neither of the
1303 .Dq Li os
1304 or
1305 .Dq Li usr
1306 qualifiers are specified, the default is to enable both.
1307 .Pp
1308 The event specifiers supported by Intel P6 PMCs are:
1309 .Bl -tag -width indent
1310 .It Li p6-baclears
1311 Count the number of times a static branch prediction was made by the
1312 branch decoder because the BTB did not have a prediction.
1313 .It Li p6-br-bac-missp-exec
1314 .Pq Tn "Pentium M"
1315 Count the number of branch instructions executed that where
1316 mispredicted at the Front End (BAC).
1317 .It Li p6-br-bogus
1318 Count the number of bogus branches.
1319 .It Li p6-br-call-exec
1320 .Pq Tn "Pentium M"
1321 Count the number of call instructions executed.
1322 .It Li p6-br-call-missp-exec
1323 .Pq Tn "Pentium M"
1324 Count the number of call instructions executed that were mispredicted.
1325 .It Li p6-br-cnd-exec
1326 .Pq Tn "Pentium M"
1327 Count the number of conditional branch instructions executed.
1328 .It Li p6-br-cnd-missp-exec
1329 .Pq Tn "Pentium M"
1330 Count the number of conditional branch instructions executed that were
1331 mispredicted.
1332 .It Li p6-br-ind-call-exec
1333 .Pq Tn "Pentium M"
1334 Count the number of indirect call instructions executed.
1335 .It Li p6-br-ind-exec
1336 .Pq Tn "Pentium M"
1337 Count the number of indirect branch instructions executed.
1338 .It Li p6-br-ind-missp-exec
1339 .Pq Tn "Pentium M"
1340 Count the number of indirect branch instructions executed that were
1341 mispredicted.
1342 .It Li p6-br-inst-decoded
1343 Count the number of branch instructions decoded.
1344 .It Li p6-br-inst-exec
1345 .Pq Tn "Pentium M"
1346 Count the number of branch instructions executed but necessarily retired.
1347 .It Li p6-br-inst-retired
1348 Count the number of branch instructions retired.
1349 .It Li p6-br-miss-pred-retired
1350 Count the number of mispredicted branch instructions retired.
1351 .It Li p6-br-miss-pred-taken-ret
1352 Count the number of taken mispredicted branches retired.
1353 .It Li p6-br-missp-exec
1354 .Pq Tn "Pentium M"
1355 Count the number of branch instructions executed that were
1356 mispredicted at execution.
1357 .It Li p6-br-ret-bac-missp-exec
1358 .Pq Tn "Pentium M"
1359 Count the number of return instructions executed that were
1360 mispredicted at the Front End (BAC).
1361 .It Li p6-br-ret-exec
1362 .Pq Tn "Pentium M"
1363 Count the number of return instructions executed.
1364 .It Li p6-br-ret-missp-exec
1365 .Pq Tn "Pentium M"
1366 Count the number of return instructions executed that were
1367 mispredicted at execution.
1368 .It Li p6-br-taken-retired
1369 Count the number of taken branches retired.
1370 .It Li p6-btb-misses
1371 Count the number of branches for which the BTB did not produce a
1372 prediction.
1373 .It Li p6-bus-bnr-drv
1374 Count the number of bus clock cycles during which this processor is
1375 driving the BNR# pin.
1376 .It Li p6-bus-data-rcv
1377 Count the number of bus clock cycles during which this processor is
1378 receiving data.
1379 .It Li p6-bus-drdy-clocks Op Li ,umask= Ns Ar qualifier
1380 Count the number of clocks during which DRDY# is asserted.
1381 An additional qualifier may be specified, and comprises one of the
1382 following keywords:
1383 .Pp
1384 .Bl -tag -width indent -compact
1385 .It Li any
1386 Count transactions generated by any agent on the bus.
1387 .It Li self
1388 Count transactions generated by this processor.
1389 .El
1390 .Pp
1391 The default is to count operations generated by this processor.
1392 .It Li p6-bus-hit-drv
1393 Count the number of bus clock cycles during which this processor is
1394 driving the HIT# pin.
1395 .It Li p6-bus-hitm-drv
1396 Count the number of bus clock cycles during which this processor is
1397 driving the HITM# pin.
1398 .It Li p6-bus-lock-clocks Op Li ,umask= Ns Ar qualifier
1399 Count the number of clocks during with LOCK# is asserted on the
1400 external system bus.
1401 An additional qualifier may be specified and comprises one of the following
1402 keywords:
1403 .Pp
1404 .Bl -tag -width indent -compact
1405 .It Li any
1406 Count transactions generated by any agent on the bus.
1407 .It Li self
1408 Count transactions generated by this processor.
1409 .El
1410 .Pp
1411 The default is to count operations generated by this processor.
1412 .It Li p6-bus-req-outstanding
1413 Count the number of bus requests outstanding in any given cycle.
1414 .It Li p6-bus-snoop-stall
1415 Count the number of clock cycles during which the bus is snoop stalled.
1416 .It Li p6-bus-tran-any Op Li ,umask= Ns Ar qualifier
1417 Count the number of completed bus transactions of any kind.
1418 An additional qualifier may be specified and comprises one of the following
1419 keywords:
1420 .Pp
1421 .Bl -tag -width indent -compact
1422 .It Li any
1423 Count transactions generated by any agent on the bus.
1424 .It Li self
1425 Count transactions generated by this processor.
1426 .El
1427 .Pp
1428 The default is to count operations generated by this processor.
1429 .It Li p6-bus-tran-brd Op Li ,umask= Ns Ar qualifier
1430 Count the number of burst read transactions.
1431 An additional qualifier may be specified and comprises one of the following
1432 keywords:
1433 .Pp
1434 .Bl -tag -width indent -compact
1435 .It Li any
1436 Count transactions generated by any agent on the bus.
1437 .It Li self
1438 Count transactions generated by this processor.
1439 .El
1440 .Pp
1441 The default is to count operations generated by this processor.
1442 .It Li p6-bus-tran-burst Op Li ,umask= Ns Ar qualifier
1443 Count the number of completed burst transactions.
1444 An additional qualifier may be specified and comprises one of the following
1445 keywords:
1446 .Pp
1447 .Bl -tag -width indent -compact
1448 .It Li any
1449 Count transactions generated by any agent on the bus.
1450 .It Li self
1451 Count transactions generated by this processor.
1452 .El
1453 .Pp
1454 The default is to count operations generated by this processor.
1455 .It Li p6-bus-tran-def Op Li ,umask= Ns Ar qualifier
1456 Count the number of completed deferred transactions.
1457 An additional qualifier may be specified and comprises one of the following
1458 keywords:
1459 .Pp
1460 .Bl -tag -width indent -compact
1461 .It Li any
1462 Count transactions generated by any agent on the bus.
1463 .It Li self
1464 Count transactions generated by this processor.
1465 .El
1466 .Pp
1467 The default is to count operations generated by this processor.
1468 .It Li p6-bus-tran-ifetch Op Li ,umask= Ns Ar qualifier
1469 Count the number of completed instruction fetch transactions.
1470 An additional qualifier may be specified and comprises one of the following
1471 keywords:
1472 .Pp
1473 .Bl -tag -width indent -compact
1474 .It Li any
1475 Count transactions generated by any agent on the bus.
1476 .It Li self
1477 Count transactions generated by this processor.
1478 .El
1479 .Pp
1480 The default is to count operations generated by this processor.
1481 .It Li p6-bus-tran-inval Op Li ,umask= Ns Ar qualifier
1482 Count the number of completed invalidate transactions.
1483 An additional qualifier may be specified and comprises one of the following
1484 keywords:
1485 .Pp
1486 .Bl -tag -width indent -compact
1487 .It Li any
1488 Count transactions generated by any agent on the bus.
1489 .It Li self
1490 Count transactions generated by this processor.
1491 .El
1492 .Pp
1493 The default is to count operations generated by this processor.
1494 .It Li p6-bus-tran-mem Op Li ,umask= Ns Ar qualifier
1495 Count the number of completed memory transactions.
1496 An additional qualifier may be specified and comprises one of the following
1497 keywords:
1498 .Pp
1499 .Bl -tag -width indent -compact
1500 .It Li any
1501 Count transactions generated by any agent on the bus.
1502 .It Li self
1503 Count transactions generated by this processor.
1504 .El
1505 .Pp
1506 The default is to count operations generated by this processor.
1507 .It Li p6-bus-tran-pwr Op Li ,umask= Ns Ar qualifier
1508 Count the number of completed partial write transactions.
1509 An additional qualifier may be specified and comprises one of the following
1510 keywords:
1511 .Pp
1512 .Bl -tag -width indent -compact
1513 .It Li any
1514 Count transactions generated by any agent on the bus.
1515 .It Li self
1516 Count transactions generated by this processor.
1517 .El
1518 .Pp
1519 The default is to count operations generated by this processor.
1520 .It Li p6-bus-tran-rfo Op Li ,umask= Ns Ar qualifier
1521 Count the number of completed read-for-ownership transactions.
1522 An additional qualifier may be specified and comprises one of the following
1523 keywords:
1524 .Pp
1525 .Bl -tag -width indent -compact
1526 .It Li any
1527 Count transactions generated by any agent on the bus.
1528 .It Li self
1529 Count transactions generated by this processor.
1530 .El
1531 .Pp
1532 The default is to count operations generated by this processor.
1533 .It Li p6-bus-trans-io Op Li ,umask= Ns Ar qualifier
1534 Count the number of completed I/O transactions.
1535 An additional qualifier may be specified and comprises one of the following
1536 keywords:
1537 .Pp
1538 .Bl -tag -width indent -compact
1539 .It Li any
1540 Count transactions generated by any agent on the bus.
1541 .It Li self
1542 Count transactions generated by this processor.
1543 .El
1544 .Pp
1545 The default is to count operations generated by this processor.
1546 .It Li p6-bus-trans-p Op Li ,umask= Ns Ar qualifier
1547 Count the number of completed partial transactions.
1548 An additional qualifier may be specified and comprises one of the following
1549 keywords:
1550 .Pp
1551 .Bl -tag -width indent -compact
1552 .It Li any
1553 Count transactions generated by any agent on the bus.
1554 .It Li self
1555 Count transactions generated by this processor.
1556 .El
1557 .Pp
1558 The default is to count operations generated by this processor.
1559 .It Li p6-bus-trans-wb Op Li ,umask= Ns Ar qualifier
1560 Count the number of completed write-back transactions.
1561 An additional qualifier may be specified and comprises one of the following
1562 keywords:
1563 .Pp
1564 .Bl -tag -width indent -compact
1565 .It Li any
1566 Count transactions generated by any agent on the bus.
1567 .It Li self
1568 Count transactions generated by this processor.
1569 .El
1570 .Pp
1571 The default is to count operations generated by this processor.
1572 .It Li p6-cpu-clk-unhalted
1573 Count the number of cycles during with the processor was not halted.
1574 .Pp
1575 .Pq Tn "Pentium M"
1576 Count the number of cycles during with the processor was not halted
1577 and not in a thermal trip.
1578 .It Li p6-cycles-div-busy
1579 Count the number of cycles during which the divider is busy and cannot
1580 accept new divides.
1581 This event is only allocated on counter 0.
1582 .It Li p6-cycles-in-pending-and-masked
1583 Count the number of processor cycles for which interrupts were
1584 disabled and interrupts were pending.
1585 .It Li p6-cycles-int-masked
1586 Count the number of processor cycles for which interrupts were
1587 disabled.
1588 .It Li p6-data-mem-refs
1589 Count all loads and all stores using any memory type, including
1590 internal retries.
1591 Each part of a split store is counted separately.
1592 .It Li p6-dcu-lines-in
1593 Count the total lines allocated in the data cache unit.
1594 .It Li p6-dcu-m-lines-in
1595 Count the number of M state lines allocated in the data cache unit.
1596 .It Li p6-dcu-m-lines-out
1597 Count the number of M state lines evicted from the data cache unit.
1598 .It Li p6-dcu-miss-outstanding
1599 Count the weighted number of cycles while a data cache unit miss is
1600 outstanding, incremented by the number of outstanding cache misses at
1601 any time.
1602 .It Li p6-div
1603 Count the number of integer and floating-point divides including
1604 speculative divides.
1605 This event is only allocated on counter 1.
1606 .It Li p6-emon-esp-uops
1607 .Pq Tn "Pentium M"
1608 Count the total number of micro-ops.
1609 .It Li p6-emon-est-trans Op Li ,umask= Ns Ar qualifier
1610 .Pq Tn "Pentium M"
1611 Count the number of
1612 .Tn "Enhanced Intel SpeedStep"
1613 transitions.
1614 An additional qualifier may be specified, and can be one of the
1615 following keywords:
1616 .Pp
1617 .Bl -tag -width indent -compact
1618 .It Li all
1619 Count all transitions.
1620 .It Li freq
1621 Count only frequency transitions.
1622 .El
1623 .Pp
1624 The default is to count all transitions.
1625 .It Li p6-emon-fused-uops-ret Op Li ,umask= Ns Ar qualifier
1626 .Pq Tn "Pentium M"
1627 Count the number of retired fused micro-ops.
1628 An additional qualifier may be specified, and may be one of the
1629 following keywords:
1630 .Pp
1631 .Bl -tag -width indent -compact
1632 .It Li all
1633 Count all fused micro-ops.
1634 .It Li loadop
1635 Count only load and op micro-ops.
1636 .It Li stdsta
1637 Count only STD/STA micro-ops.
1638 .El
1639 .Pp
1640 The default is to count all fused micro-ops.
1641 .It Li p6-emon-kni-comp-inst-ret
1642 .Pq Tn "Pentium III"
1643 Count the number of SSE computational instructions retired.
1644 An additional qualifier may be specified, and comprises one of the
1645 following keywords:
1646 .Pp
1647 .Bl -tag -width indent -compact
1648 .It Li packed-and-scalar
1649 Count packed and scalar operations.
1650 .It Li scalar
1651 Count scalar operations only.
1652 .El
1653 .Pp
1654 The default is to count packed and scalar operations.
1655 .It Li p6-emon-kni-inst-retired Op Li ,umask= Ns Ar qualifier
1656 .Pq Tn "Pentium III"
1657 Count the number of SSE instructions retired.
1658 An additional qualifier may be specified, and comprises one of the
1659 following keywords:
1660 .Pp
1661 .Bl -tag -width indent -compact
1662 .It Li packed-and-scalar
1663 Count packed and scalar operations.
1664 .It Li scalar
1665 Count scalar operations only.
1666 .El
1667 .Pp
1668 The default is to count packed and scalar operations.
1669 .It Li p6-emon-kni-pref-dispatched Op Li ,umask= Ns Ar qualifier
1670 .Pq Tn "Pentium III"
1671 Count the number of SSE prefetch or weakly ordered instructions
1672 dispatched (including speculative prefetches).
1673 An additional qualifier may be specified, and comprises one of the
1674 following keywords:
1675 .Pp
1676 .Bl -tag -width indent -compact
1677 .It Li nta
1678 Count non-temporal prefetches.
1679 .It Li t1
1680 Count prefetches to L1.
1681 .It Li t2
1682 Count prefetches to L2.
1683 .It Li wos
1684 Count weakly ordered stores.
1685 .El
1686 .Pp
1687 The default is to count non-temporal prefetches.
1688 .It Li p6-emon-kni-pref-miss Op Li ,umask= Ns Ar qualifier
1689 .Pq Tn "Pentium III"
1690 Count the number of prefetch or weakly ordered instructions that miss
1691 all caches.
1692 An additional qualifier may be specified, and comprises one of the
1693 following keywords:
1694 .Pp
1695 .Bl -tag -width indent -compact
1696 .It Li nta
1697 Count non-temporal prefetches.
1698 .It Li t1
1699 Count prefetches to L1.
1700 .It Li t2
1701 Count prefetches to L2.
1702 .It Li wos
1703 Count weakly ordered stores.
1704 .El
1705 .Pp
1706 The default is to count non-temporal prefetches.
1707 .It Li p6-emon-pref-rqsts-dn
1708 .Pq Tn "Pentium M"
1709 Count the number of downward prefetches issued.
1710 .It Li p6-emon-pref-rqsts-up
1711 .Pq Tn "Pentium M"
1712 Count the number of upward prefetches issued.
1713 .It Li p6-emon-simd-instr-retired
1714 .Pq Tn "Pentium M"
1715 Count the number of retired
1716 .Tn MMX
1717 instructions.
1718 .It Li p6-emon-sse-sse2-comp-inst-retired Op Li ,umask= Ns Ar qualifier
1719 .Pq Tn "Pentium M"
1720 Count the number of computational SSE instructions retired.
1721 An additional qualifier may be specified and can be one of the
1722 following keywords:
1723 .Pp
1724 .Bl -tag -width indent -compact
1725 .It Li sse-packed-single
1726 Count SSE packed-single instructions.
1727 .It Li sse-scalar-single
1728 Count SSE scalar-single instructions.
1729 .It Li sse2-packed-double
1730 Count SSE2 packed-double instructions.
1731 .It Li sse2-scalar-double
1732 Count SSE2 scalar-double instructions.
1733 .El
1734 .Pp
1735 The default is to count SSE packed-single instructions.
1736 .It Li p6-emon-sse-sse2-inst-retired Op Li ,umask= Ns Ar qualifer
1737 .Pp
1738 .Pq Tn "Pentium M"
1739 Count the number of SSE instructions retired.
1740 An additional qualifier can be specified, and can be one of the
1741 following keywords:
1742 .Pp
1743 .Bl -tag -width indent -compact
1744 .It Li sse-packed-single
1745 Count SSE packed-single instructions.
1746 .It Li sse-packed-single-scalar-single
1747 Count SSE packed-single and scalar-single instructions.
1748 .It Li sse2-packed-double
1749 Count SSE2 packed-double instructions.
1750 .It Li sse2-scalar-double
1751 Count SSE2 scalar-double instructions.
1752 .El
1753 .Pp
1754 The default is to count SSE packed-single instructions.
1755 .It Li p6-emon-synch-uops
1756 .Pq Tn "Pentium M"
1757 Count the number of sync micro-ops.
1758 .It Li p6-emon-thermal-trip
1759 .Pq Tn "Pentium M"
1760 Count the duration or occurrences of thermal trips.
1761 Use the
1762 .Dq Li edge
1763 qualifier to count occurrences of thermal trips.
1764 .It Li p6-emon-unfusion
1765 .Pq Tn "Pentium M"
1766 Count the number of unfusion events in the reorder buffer.
1767 .It Li p6-flops
1768 Count the number of computational floating point operations retired.
1769 This event is only allocated on counter 0.
1770 .It Li p6-fp-assist
1771 Count the number of floating point exceptions handled by microcode.
1772 This event is only allocated on counter 1.
1773 .It Li p6-fp-comps-ops-exe
1774 Count the number of computation floating point operations executed.
1775 This event is only allocated on counter 0.
1776 .It Li p6-fp-mmx-trans Op Li ,umask= Ns Ar qualifier
1777 .Pq Tn "Pentium II" , Tn "Pentium III"
1778 Count the number of transitions between MMX and floating-point
1779 instructions.
1780 An additional qualifier may be specified, and comprises one of the
1781 following keywords:
1782 .Pp
1783 .Bl -tag -width indent -compact
1784 .It Li mmxtofp
1785 Count transitions from MMX instructions to floating-point instructions.
1786 .It Li fptommx
1787 Count transitions from floating-point instructions to MMX instructions.
1788 .El
1789 .Pp
1790 The default is to count MMX to floating-point transitions.
1791 .It Li p6-hw-int-rx
1792 Count the number of hardware interrupts received.
1793 .It Li p6-ifu-fetch
1794 Count the number of instruction fetches, both cacheable and non-cacheable.
1795 .It Li p6-ifu-fetch-miss
1796 Count the number of instruction fetch misses (i.e., those that produce
1797 memory accesses).
1798 .It Li p6-ifu-mem-stall
1799 Count the number of cycles instruction fetch is stalled for any reason.
1800 .It Li p6-ild-stall
1801 Count the number of cycles the instruction length decoder is stalled.
1802 .It Li p6-inst-decoded
1803 Count the number of instructions decoded.
1804 .It Li p6-inst-retired
1805 Count the number of instructions retired.
1806 .It Li p6-itlb-miss
1807 Count the number of instruction TLB misses.
1808 .It Li p6-l2-ads
1809 Count the number of L2 address strobes.
1810 .It Li p6-l2-dbus-busy
1811 Count the number of cycles during which the L2 cache data bus was busy.
1812 .It Li p6-l2-dbus-busy-rd
1813 Count the number of cycles during which the L2 cache data bus was busy
1814 transferring read data from L2 to the processor.
1815 .It Li p6-l2-ifetch Op Li ,umask= Ns Ar qualifier
1816 Count the number of L2 instruction fetches.
1817 An additional qualifier may be specified and comprises a list of the following
1818 keywords separated by
1819 .Ql +
1820 characters:
1821 .Pp
1822 .Bl -tag -width indent -compact
1823 .It Li e
1824 Count operations affecting E (exclusive) state lines.
1825 .It Li i
1826 Count operations affecting I (invalid) state lines.
1827 .It Li m
1828 Count operations affecting M (modified) state lines.
1829 .It Li s
1830 Count operations affecting S (shared) state lines.
1831 .El
1832 .Pp
1833 The default is to count operations affecting all (MESI) state lines.
1834 .It Li p6-l2-ld Op Li ,umask= Ns Ar qualifier
1835 Count the number of L2 data loads.
1836 An additional qualifier may be specified and comprises a list of the following
1837 keywords separated by
1838 .Ql +
1839 characters:
1840 .Pp
1841 .Bl -tag -width indent -compact
1842 .It Li both
1843 .Pq Tn "Pentium M"
1844 Count both hardware-prefetched lines and non-hardware-prefetched lines.
1845 .It Li e
1846 Count operations affecting E (exclusive) state lines.
1847 .It Li hw
1848 .Pq Tn "Pentium M"
1849 Count hardware-prefetched lines only.
1850 .It Li i
1851 Count operations affecting I (invalid) state lines.
1852 .It Li m
1853 Count operations affecting M (modified) state lines.
1854 .It Li nonhw
1855 .Pq Tn "Pentium M"
1856 Exclude hardware-prefetched lines.
1857 .It Li s
1858 Count operations affecting S (shared) state lines.
1859 .El
1860 .Pp
1861 The default on processors other than
1862 .Tn "Pentium M"
1863 processors is to count operations affecting all (MESI) state lines.
1864 The default on
1865 .Tn "Pentium M"
1866 processors is to count both hardware-prefetched and
1867 non-hardware-prefetch operations on all (MESI) state lines.
1868 .Pq Errata
1869 This event is affected by processor errata E53.
1870 .It Li p6-l2-lines-in Op Li ,umask= Ns Ar qualifier
1871 Count the number of L2 lines allocated.
1872 An additional qualifier may be specified and comprises a list of the following
1873 keywords separated by
1874 .Ql +
1875 characters:
1876 .Pp
1877 .Bl -tag -width indent -compact
1878 .It Li both
1879 .Pq Tn "Pentium M"
1880 Count both hardware-prefetched lines and non-hardware-prefetched lines.
1881 .It Li e
1882 Count operations affecting E (exclusive) state lines.
1883 .It Li hw
1884 .Pq Tn "Pentium M"
1885 Count hardware-prefetched lines only.
1886 .It Li i
1887 Count operations affecting I (invalid) state lines.
1888 .It Li m
1889 Count operations affecting M (modified) state lines.
1890 .It Li nonhw
1891 .Pq Tn "Pentium M"
1892 Exclude hardware-prefetched lines.
1893 .It Li s
1894 Count operations affecting S (shared) state lines.
1895 .El
1896 .Pp
1897 The default on processors other than
1898 .Tn "Pentium M"
1899 processors is to count operations affecting all (MESI) state lines.
1900 The default on
1901 .Tn "Pentium M"
1902 processors is to count both hardware-prefetched and
1903 non-hardware-prefetch operations on all (MESI) state lines.
1904 .Pq Errata
1905 This event is affected by processor errata E45.
1906 .It Li p6-l2-lines-out Op Li ,umask= Ns Ar qualifier
1907 Count the number of L2 lines evicted.
1908 An additional qualifier may be specified and comprises a list of the following
1909 keywords separated by
1910 .Ql +
1911 characters:
1912 .Pp
1913 .Bl -tag -width indent -compact
1914 .It Li both
1915 .Pq Tn "Pentium M"
1916 Count both hardware-prefetched lines and non-hardware-prefetched lines.
1917 .It Li e
1918 Count operations affecting E (exclusive) state lines.
1919 .It Li hw
1920 .Pq Tn "Pentium M"
1921 Count hardware-prefetched lines only.
1922 .It Li i
1923 Count operations affecting I (invalid) state lines.
1924 .It Li m
1925 Count operations affecting M (modified) state lines.
1926 .It Li nonhw
1927 .Pq Tn "Pentium M" only
1928 Exclude hardware-prefetched lines.
1929 .It Li s
1930 Count operations affecting S (shared) state lines.
1931 .El
1932 .Pp
1933 The default on processors other than
1934 .Tn "Pentium M"
1935 processors is to count operations affecting all (MESI) state lines.
1936 The default on
1937 .Tn "Pentium M"
1938 processors is to count both hardware-prefetched and
1939 non-hardware-prefetch operations on all (MESI) state lines.
1940 .Pq Errata
1941 This event is affected by processor errata E45.
1942 .It Li p6-l2-m-lines-inm
1943 Count the number of modified lines allocated in L2 cache.
1944 .It Li p6-l2-m-lines-outm Op Li ,umask= Ns Ar qualifier
1945 Count the number of L2 M-state lines evicted.
1946 .Pp
1947 .Pq Tn "Pentium M"
1948 On these processors an additional qualifier may be specified and
1949 comprises a list of the following keywords separated by
1950 .Ql +
1951 characters:
1952 .Pp
1953 .Bl -tag -width indent -compact
1954 .It Li both
1955 Count both hardware-prefetched lines and non-hardware-prefetched lines.
1956 .It Li hw
1957 Count hardware-prefetched lines only.
1958 .It Li nonhw
1959 Exclude hardware-prefetched lines.
1960 .El
1961 .Pp
1962 The default is to count both hardware-prefetched and
1963 non-hardware-prefetch operations.
1964 .Pq Errata
1965 This event is affected by processor errata E53.
1966 .It Li p6-l2-rqsts Op Li ,umask= Ns Ar qualifier
1967 Count the total number of L2 requests.
1968 An additional qualifier may be specified and comprises a list of the following
1969 keywords separated by
1970 .Ql +
1971 characters:
1972 .Pp
1973 .Bl -tag -width indent -compact
1974 .It Li e
1975 Count operations affecting E (exclusive) state lines.
1976 .It Li i
1977 Count operations affecting I (invalid) state lines.
1978 .It Li m
1979 Count operations affecting M (modified) state lines.
1980 .It Li s
1981 Count operations affecting S (shared) state lines.
1982 .El
1983 .Pp
1984 The default is to count operations affecting all (MESI) state lines.
1985 .It Li p6-l2-st
1986 Count the number of L2 data stores.
1987 An additional qualifier may be specified and comprises a list of the following
1988 keywords separated by
1989 .Ql +
1990 characters:
1991 .Pp
1992 .Bl -tag -width indent -compact
1993 .It Li e
1994 Count operations affecting E (exclusive) state lines.
1995 .It Li i
1996 Count operations affecting I (invalid) state lines.
1997 .It Li m
1998 Count operations affecting M (modified) state lines.
1999 .It Li s
2000 Count operations affecting S (shared) state lines.
2001 .El
2002 .Pp
2003 The default is to count operations affecting all (MESI) state lines.
2004 .It Li p6-ld-blocks
2005 Count the number of load operations delayed due to store buffer blocks.
2006 .It Li p6-misalign-mem-ref
2007 Count the number of misaligned data memory references (crossing a 64
2008 bit boundary).
2009 .It Li p6-mmx-assist
2010 .Pq Tn "Pentium II" , Tn "Pentium III"
2011 Count the number of MMX assists executed.
2012 .It Li p6-mmx-instr-exec
2013 .Pq Tn Celeron , Tn "Pentium II"
2014 Count the number of MMX instructions executed, except MOVQ and MOVD
2015 stores from register to memory.
2016 .It Li p6-mmx-instr-ret
2017 .Pq Tn "Pentium II"
2018 Count the number of MMX instructions retired.
2019 .It Li p6-mmx-instr-type-exec Op Li ,umask= Ns Ar qualifier
2020 .Pq Tn "Pentium II" , Tn "Pentium III"
2021 Count the number of MMX instructions executed.
2022 An additional qualifier may be specified and comprises a list of
2023 the following keywords separated by
2024 .Ql +
2025 characters:
2026 .Pp
2027 .Bl -tag -width indent -compact
2028 .It Li pack
2029 Count MMX pack operation instructions.
2030 .It Li packed-arithmetic
2031 Count MMX packed arithmetic instructions.
2032 .It Li packed-logical
2033 Count MMX packed logical instructions.
2034 .It Li packed-multiply
2035 Count MMX packed multiply instructions.
2036 .It Li packed-shift
2037 Count MMX packed shift instructions.
2038 .It Li unpack
2039 Count MMX unpack operation instructions.
2040 .El
2041 .Pp
2042 The default is to count all operations.
2043 .It Li p6-mmx-sat-instr-exec
2044 .Pq Tn "Pentium II" , Tn "Pentium III"
2045 Count the number of MMX saturating instructions executed.
2046 .It Li p6-mmx-uops-exec
2047 .Pq Tn "Pentium II" , Tn "Pentium III"
2048 Count the number of MMX micro-ops executed.
2049 .It Li p6-mul
2050 Count the number of integer and floating-point multiplies, including
2051 speculative multiplies.
2052 This event is only allocated on counter 1.
2053 .It Li p6-partial-rat-stalls
2054 Count the number of cycles or events for partial stalls.
2055 .It Li p6-resource-stalls
2056 Count the number of cycles there was a resource related stall of any kind.
2057 .It Li p6-ret-seg-renames
2058 .Pq Tn "Pentium II" , Tn "Pentium III"
2059 Count the number of segment register rename events retired.
2060 .It Li p6-sb-drains
2061 Count the number of cycles the store buffer is draining.
2062 .It Li p6-seg-reg-renames Op Li ,umask= Ns Ar qualifier
2063 .Pq Tn "Pentium II" , Tn "Pentium III"
2064 Count the number of segment register renames.
2065 An additional qualifier may be specified, and comprises a list of the
2066 following keywords separated by
2067 .Ql +
2068 characters:
2069 .Pp
2070 .Bl -tag -width indent -compact
2071 .It Li ds
2072 Count renames for segment register DS.
2073 .It Li es
2074 Count renames for segment register ES.
2075 .It Li fs
2076 Count renames for segment register FS.
2077 .It Li gs
2078 Count renames for segment register GS.
2079 .El
2080 .Pp
2081 The default is to count operations affecting all segment registers.
2082 .It Li p6-seg-rename-stalls
2083 .Pq Tn "Pentium II" , Tn "Pentium III"
2084 Count the number of segment register renaming stalls.
2085 An additional qualifier may be specified, and comprises a list of the
2086 following keywords separated by
2087 .Ql +
2088 characters:
2089 .Pp
2090 .Bl -tag -width indent -compact
2091 .It Li ds
2092 Count stalls for segment register DS.
2093 .It Li es
2094 Count stalls for segment register ES.
2095 .It Li fs
2096 Count stalls for segment register FS.
2097 .It Li gs
2098 Count stalls for segment register GS.
2099 .El
2100 .Pp
2101 The default is to count operations affecting all the segment registers.
2102 .It Li p6-segment-reg-loads
2103 Count the number of segment register loads.
2104 .It Li p6-uops-retired
2105 Count the number of micro-ops retired.
2106 .El
2107 .Ss Intel P4 PMCS
2108 Intel P4 PMCs are present in Intel
2109 .Tn "Pentium 4"
2110 and
2111 .Tn Xeon
2112 processors.
2113 These PMCs are documented in
2114 .Rs
2115 .%B "IA-32 Intel(R) Architecture Software Developer's Manual"
2116 .%T "Volume 3: System Programming Guide"
2117 .%N "Order Number 245472-012"
2118 .%D 2003
2119 .%Q "Intel Corporation"
2120 .Re
2121 Further information about using these PMCs may be found in
2122 .Rs
2123 .%B "IA-32 Intel(R) Architecture Optimization Guide"
2124 .%D 2003
2125 .%N "Order Number 248966-009"
2126 .%Q "Intel Corporation"
2127 .Re
2128 Some of these events are affected by processor errata described in
2129 .Rs
2130 .%B "Intel(R) Pentium(R) 4 Processor Specification Update"
2131 .%N "Document Number: 249199-059"
2132 .%D "April 2005"
2133 .%Q "Intel Corporation"
2134 .Re
2135 .Pp
2136 Event specifiers for Intel P4 PMCs can have the following common
2137 qualifiers:
2138 .Bl -tag -width indent
2139 .It Li active= Ns Ar choice
2140 (On P4 HTT CPUs) Filter event counting based on which logical
2141 processors are active.
2142 The allowed values of
2143 .Ar choice
2144 are:
2145 .Pp
2146 .Bl -tag -width indent -compact
2147 .It Li any
2148 Count when either logical processor is active.
2149 .It Li both
2150 Count when both logical processors are active.
2151 .It Li none
2152 Count only when neither logical processor is active.
2153 .It Li single
2154 Count only when one logical processor is active.
2155 .El
2156 .Pp
2157 The default is
2158 .Dq Li both .
2159 .It Li cascade
2160 Configure the PMC to cascade onto its partner.
2161 See
2162 .Sx "Cascading P4 PMCs"
2163 below for more information.
2164 .It Li edge
2165 Configure the counter to count false to true transitions of the threshold
2166 comparision output.
2167 This qualifier only takes effect if a threshold qualifier has also been
2168 specified.
2169 .It Li complement
2170 Configure the counter to increment only when the event count seen is
2171 less than the threshold qualifier value specified.
2172 .It Li mask= Ns Ar qualifier
2173 Many event specifiers for Intel P4 PMCs need to be additionally
2174 qualified using a mask qualifier.
2175 The allowed syntax for these qualifiers is event specific and is
2176 described along with the events.
2177 .It Li os
2178 Configure the PMC to count when the CPL of the processor is 0.
2179 .It Li precise
2180 Select precise event based sampling.
2181 Precise sampling is supported by the hardware for a limited set of
2182 events.
2183 .It Li tag= Ns Ar value
2184 Configure the PMC to tag the internal uop selected by the other
2185 fields in this event specifier with value
2186 .Ar value .
2187 This feature is used when cascading PMCs.
2188 .It Li threshold= Ns Ar value
2189 Configure the PMC to increment only when the event counts seen are
2190 greater than the specified threshold value
2191 .Ar value .
2192 .It Li usr
2193 Configure the PMC to count when the CPL of the processor is 1, 2 or 3.
2194 .El
2195 .Pp
2196 If neither of the
2197 .Dq Li os
2198 or
2199 .Dq Li usr
2200 qualifiers are specified, the default is to enable both.
2201 .Pp
2202 On Intel Pentium 4 processors with HTT, events are
2203 divided into two classes:
2204 .Pp
2205 .Bl -tag -width indent -compact
2206 .It "TS Events"
2207 are those where hardware can differentiate between events
2208 generated on one logical processor from those generated on the
2209 other.
2210 .It "TI Events"
2211 are those where hardware cannot differentiate between events
2212 generated by multiple logical processors in a package.
2213 .El
2214 .Pp
2215 Only TS events are allowed for use with process-mode PMCs on
2216 Pentium-4/HTT CPUs.
2217 .Pp
2218 The event specifiers supported by Intel P4 PMCs are:
2219 .Pp
2220 .Bl -tag -width indent
2221 .It Li p4-128bit-mmx-uop Op Li ,mask= Ns Ar flags
2222 .Pq "TI event"
2223 Count integer SIMD SSE2 instructions that operate on 128 bit SIMD
2224 operands.
2225 Qualifier
2226 .Ar flags
2227 can take the following value (which is also the default):
2228 .Pp
2229 .Bl -tag -width indent -compact
2230 .It Li all
2231 Count all uops operating on 128 bit SIMD integer operands in memory or
2232 XMM register.
2233 .El
2234 .Pp
2235 If an instruction contains more than one 128 bit MMX uop, then each
2236 uop will be counted.
2237 .It Li p4-64bit-mmx-uop Op Li ,mask= Ns Ar flags
2238 .Pq "TI event"
2239 Count MMX instructions that operate on 64 bit SIMD operands.
2240 Qualifier
2241 .Ar flags
2242 can take the following value (which is also the default):
2243 .Pp
2244 .Bl -tag -width indent -compact
2245 .It Li all
2246 Count all uops operating on 64 bit SIMD integer operands in memory or
2247 in MMX registers.
2248 .El
2249 .Pp
2250 If an instruction contains more than one 64 bit MMX uop, then each
2251 uop will be counted.
2252 .It Li p4-b2b-cycles
2253 .Pq "TI event"
2254 Count back-to-back bys cycles.
2255 Further documentation for this event is unavailable.
2256 .It Li p4-bnr
2257 .Pq "TI event"
2258 Count bus-not-ready conditions.
2259 Further documentation for this event is unavailable.
2260 .It Li p4-bpu-fetch-request Op Li ,mask= Ns Ar qualifier
2261 .Pq "TS event"
2262 Count instruction fetch requests qualified by additional
2263 flags specified in
2264 .Ar qualifier .
2265 At this point only one flag is supported:
2266 .Pp
2267 .Bl -tag -width indent -compact
2268 .It Li tcmiss
2269 Count trace cache lookup misses.
2270 .El
2271 .Pp
2272 The default qualifier is also
2273 .Dq Li mask=tcmiss .
2274 .It Li p4-branch-retired Op Li ,mask= Ns Ar flags
2275 .Pq "TS event"
2276 Counts retired branches.
2277 Qualifier
2278 .Ar flags
2279 is a list of the following
2280 .Ql +
2281 separated strings:
2282 .Pp
2283 .Bl -tag -width indent -compact
2284 .It Li mmnp
2285 Count branches not-taken and predicted.
2286 .It Li mmnm
2287 Count branches not-taken and mis-predicted.
2288 .It Li mmtp
2289 Count branches taken and predicted.
2290 .It Li mmtm
2291 Count branches taken and mis-predicted.
2292 .El
2293 .Pp
2294 The default qualifier counts all four kinds of branches.
2295 .It Li p4-bsq-active-entries Op Li ,mask= Ns Ar qualifier
2296 .Pq "TS event"
2297 Count the number of entries (clipped at 15) currently active in the
2298 BSQ.
2299 Qualifier
2300 .Ar qualifier
2301 is a
2302 .Ql +
2303 separated set of the following flags:
2304 .Pp
2305 .Bl -tag -width indent -compact
2306 .It Li req-type0 , Li req-type1
2307 Forms a 2-bit number used to select the request type encoding:
2308 .Pp
2309 .Bl -tag -width indent -compact
2310 .It Li 0
2311 reads excluding read invalidate
2312 .It Li 1
2313 read invalidates
2314 .It Li 2
2315 writes other than writebacks
2316 .It Li 3
2317 writebacks
2318 .El
2319 .Pp
2320 Bit
2321 .Dq Li req-type1
2322 is the MSB for this two bit number.
2323 .It Li req-len0 , Li req-len1
2324 Forms a two-bit number that specifies the request length encoding:
2325 .Pp
2326 .Bl -tag -width indent -compact
2327 .It Li 0
2328 0 chunks
2329 .It Li 1
2330 1 chunk
2331 .It Li 3
2332 8 chunks
2333 .El
2334 .Pp
2335 Bit
2336 .Dq Li req-len1
2337 is the MSB for this two bit number.
2338 .It Li req-io-type
2339 Count requests that are input or output requests.
2340 .It Li req-lock-type
2341 Count requests that lock the bus.
2342 .It Li req-lock-cache
2343 Count requests that lock the cache.
2344 .It Li req-split-type
2345 Count requests that is a bus 8-byte chunk that is split across an
2346 8-byte boundary.
2347 .It Li req-dem-type
2348 Count requests that are demand (not prefetches) if set.
2349 Count requests that are prefetches if not set.
2350 .It Li req-ord-type
2351 Count requests that are ordered.
2352 .It Li mem-type0 , Li mem-type1 , Li mem-type2
2353 Forms a 3-bit number that specifies a memory type encoding:
2354 .Pp
2355 .Bl -tag -width indent -compact
2356 .It Li 0
2357 UC
2358 .It Li 1
2359 USWC
2360 .It Li 4
2361 WT
2362 .It Li 5
2363 WP
2364 .It Li 6
2365 WB
2366 .El
2367 .Pp
2368 Bit
2369 .Dq Li mem-type2
2370 is the MSB of this 3-bit number.
2371 .El
2372 .Pp
2373 The default qualifier has all the above bits set.
2374 .Pp
2375 Edge triggering using the
2376 .Dq Li edge
2377 qualifier should not be used with this event when counting cycles.
2378 .It Li p4-bsq-allocation Op Li ,mask= Ns Ar qualifier
2379 .Pq "TS event"
2380 Count allocations in the bus sequence unit according to the flags
2381 specified in
2382 .Ar qualifier ,
2383 which is a
2384 .Ql +
2385 separated set of the following flags:
2386 .Pp
2387 .Bl -tag -width indent -compact
2388 .It Li req-type0 , Li req-type1
2389 Forms a 2-bit number used to select the request type encoding:
2390 .Pp
2391 .Bl -tag -width indent -compact
2392 .It Li 0
2393 reads excluding read invalidate
2394 .It Li 1
2395 read invalidates
2396 .It Li 2
2397 writes other than writebacks
2398 .It Li 3
2399 writebacks
2400 .El
2401 .Pp
2402 Bit
2403 .Dq Li req-type1
2404 is the MSB for this two bit number.
2405 .It Li req-len0 , Li req-len1
2406 Forms a two-bit number that specifies the request length encoding:
2407 .Pp
2408 .Bl -tag -width indent -compact
2409 .It Li 0
2410 0 chunks
2411 .It Li 1
2412 1 chunk
2413 .It Li 3
2414 8 chunks
2415 .El
2416 .Pp
2417 Bit
2418 .Dq Li req-len1
2419 is the MSB for this two bit number.
2420 .It Li req-io-type
2421 Count requests that are input or output requests.
2422 .It Li req-lock-type
2423 Count requests that lock the bus.
2424 .It Li req-lock-cache
2425 Count requests that lock the cache.
2426 .It Li req-split-type
2427 Count requests that is a bus 8-byte chunk that is split across an
2428 8-byte boundary.
2429 .It Li req-dem-type
2430 Count requests that are demand (not prefetches) if set.
2431 Count requests that are prefetches if not set.
2432 .It Li req-ord-type
2433 Count requests that are ordered.
2434 .It Li mem-type0 , Li mem-type1 , Li mem-type2
2435 Forms a 3-bit number that specifies a memory type encoding:
2436 .Pp
2437 .Bl -tag -width indent -compact
2438 .It Li 0
2439 UC
2440 .It Li 1
2441 USWC
2442 .It Li 4
2443 WT
2444 .It Li 5
2445 WP
2446 .It Li 6
2447 WB
2448 .El
2449 .Pp
2450 Bit
2451 .Dq Li mem-type2
2452 is the MSB of this 3-bit number.
2453 .El
2454 .Pp
2455 The default qualifier has all the above bits set.
2456 .Pp
2457 This event is usually used along with the
2458 .Dq Li edge
2459 qualifier to avoid multiple counting.
2460 .It Li p4-bsq-cache-reference Op Li ,mask= Ns Ar qualifier
2461 .Pq "TS event"
2462 Count cache references as seen by the bus unit (2nd or 3rd level
2463 cache references).
2464 Qualifier
2465 .Ar qualifier
2466 is a
2467 .Ql +
2468 separated list of the following keywords:
2469 .Pp
2470 .Bl -tag -width indent -compact
2471 .It Li rd-2ndl-hits
2472 Count 2nd level cache hits in the shared state.
2473 .It Li rd-2ndl-hite
2474 Count 2nd level cache hits in the exclusive state.
2475 .It Li rd-2ndl-hitm
2476 Count 2nd level cache hits in the modified state.
2477 .It Li rd-3rdl-hits
2478 Count 3rd level cache hits in the shared state.
2479 .It Li rd-3rdl-hite
2480 Count 3rd level cache hits in the exclusive state.
2481 .It Li rd-3rdl-hitm
2482 Count 3rd level cache hits in the modified state.
2483 .It Li rd-2ndl-miss
2484 Count 2nd level cache misses.
2485 .It Li rd-3rdl-miss
2486 Count 3rd level cache misses.
2487 .It Li wr-2ndl-miss
2488 Count write-back lookups from the data access cache that miss the 2nd
2489 level cache.
2490 .El
2491 .Pp
2492 The default is to count all the above events.
2493 .It Li p4-execution-event Op Li ,mask= Ns Ar flags
2494 .Pq "TS event"
2495 Count the retirement of tagged uops selected through the execution
2496 tagging mechanism.
2497 Qualifier
2498 .Ar flags
2499 can contain the following strings separated by
2500 .Ql +
2501 characters:
2502 .Pp
2503 .Bl -tag -width indent -compact
2504 .It Li nbogus0 , Li nbogus1 , Li nbogus2 , Li nbogus3
2505 The marked uops are not bogus.
2506 .It Li bogus0 , Li bogus1 , Li bogus2 , Li bogus3
2507 The marked uops are bogus.
2508 .El
2509 .Pp
2510 This event requires additional (upstream) events to be allocated to
2511 perform the desired uop tagging.
2512 The default is to set all the above flags.
2513 This event can be used for precise event based sampling.
2514 .It Li p4-front-end-event Op Li ,mask= Ns Ar flags
2515 .Pq "TS event"
2516 Count the retirement of tagged uops selected through the front-end
2517 tagging mechanism.
2518 Qualifier
2519 .Ar flags
2520 can contain the following strings separated by
2521 .Ql +
2522 characters:
2523 .Pp
2524 .Bl -tag -width indent -compact
2525 .It Li nbogus
2526 The marked uops are not bogus.
2527 .It Li bogus
2528 The marked uops are bogus.
2529 .El
2530 .Pp
2531 This event requires additional (upstream) events to be allocated to
2532 perform the desired uop tagging.
2533 The default is to select both kinds of events.
2534 This event can be used for precise event based sampling.
2535 .It Li p4-fsb-data-activity Op Li ,mask= Ns Ar flags
2536 .Pq "TI event"
2537 Count each DBSY or DRDY event selected by qualifier
2538 .Ar flags .
2539 Qualifier
2540 .Ar flags
2541 is a
2542 .Ql +
2543 separated set of the following flags:
2544 .Pp
2545 .Bl -tag -width indent -compact
2546 .It Li drdy-drv
2547 Count when this processor is driving data onto the bus.
2548 .It Li drdy-own
2549 Count when this processor is reading data from the bus.
2550 .It Li drdy-other
2551 Count when data is on the bus but not being sampled by this processor.
2552 .It Li dbsy-drv
2553 Count when this processor reserves the bus for use in the next cycle
2554 in order to drive data.
2555 .It Li dbsy-own
2556 Count when some agent reserves the bus for use in the next bus cycle
2557 to drive data that this processor will sample.
2558 .It Li dbsy-other
2559 Count when some agent reserves the bus for use in the next bus cycle
2560 to drive data that this processor will not sample.
2561 .El
2562 .Pp
2563 Flags
2564 .Dq Li drdy-own
2565 and
2566 .Dq Li drdy-other
2567 are mutually exclusive.
2568 Flags
2569 .Dq Li dbsy-own
2570 and
2571 .Dq Li dbsy-other
2572 are mutually exclusive.
2573 The default value for
2574 .Ar qualifier
2575 is
2576 .Dq Li drdy-drv+drdy-own+dbsy-drv+dbsy-own .
2577 .It Li p4-global-power-events Op Li ,mask= Ns Ar flags
2578 .Pq "TS event"
2579 Count cycles during which the processor is not stopped.
2580 Qualifier
2581 .Ar flags
2582 can take the following value (which is also the default):
2583 .Pp
2584 .Bl -tag -width indent -compact
2585 .It Li running
2586 Count cycles when the processor is active.
2587 .El
2588 .Pp
2589 .It Li p4-instr-retired Op Li ,mask= Ns Ar flags
2590 .Pq "TS event"
2591 Count instructions retired during a clock cycle.
2592 Qualifer
2593 .Ar flags
2594 comprises of the following strings separated by
2595 .Ql +
2596 characters:
2597 .Pp
2598 .Bl -tag -width indent -compact
2599 .It Li nbogusntag
2600 Count non-bogus instructions that are not tagged.
2601 .It Li nbogustag
2602 Count non-bogus instructions that are tagged.
2603 .It Li bogusntag
2604 Count bogus instructions that are not tagged.
2605 .It Li bogustag
2606 Count bogus instructions that are tagged.
2607 .El
2608 .Pp
2609 The default qualifier counts all the above kinds of instructions.
2610 .It Li p4-ioq-active-entries Xo
2611 .Op Li ,mask= Ns Ar qualifier
2612 .Op Li ,busreqtype= Ns Ar req-type
2613 .Xc
2614 .Pq "TS event"
2615 Count the number of entries (clipped at 15) in the IOQ that are
2616 active.
2617 The event masks are specified by qualifier
2618 .Ar qualifier
2619 and
2620 .Ar req-type .
2621 .Pp
2622 Qualifier
2623 .Ar qualifier
2624 is a
2625 .Ql +
2626 separated set of the following flags:
2627 .Pp
2628 .Bl -tag -width indent -compact
2629 .It Li all-read
2630 Count read entries.
2631 .It Li all-write
2632 Count write entries.
2633 .It Li mem-uc
2634 Count entries accessing uncacheable memory.
2635 .It Li mem-wc
2636 Count entries accessing write-combining memory.
2637 .It Li mem-wt
2638 Count entries accessing write-through memory.
2639 .It Li mem-wp
2640 Count entries accessing write-protected memory
2641 .It Li mem-wb
2642 Count entries accessing write-back memory.
2643 .It Li own
2644 Count store requests driven by the processor (i.e., not by other
2645 processors or by DMA).
2646 .It Li other
2647 Count store requests driven by other processors or by DMA.
2648 .It Li prefetch
2649 Include hardware and software prefetch requests in the count.
2650 .El
2651 .Pp
2652 The default value for
2653 .Ar qualifier
2654 is to enable all the above flags.
2655 .Pp
2656 The
2657 .Ar req-type
2658 qualifier is a 5-bit number can be additionally used to select a
2659 specific bus request type.
2660 The default is 0.
2661 .Pp
2662 The
2663 .Dq Li edge
2664 qualifier should not be used when counting cycles with this event.
2665 The exact behaviour of this event depends on the processor revision.
2666 .It Li p4-ioq-allocation Xo
2667 .Op Li ,mask= Ns Ar qualifier
2668 .Op Li ,busreqtype= Ns Ar req-type
2669 .Xc
2670 .Pq "TS event"
2671 Count various types of transactions on the bus matching the flags set
2672 in
2673 .Ar qualifier
2674 and
2675 .Ar req-type .
2676 .Pp
2677 Qualifier
2678 .Ar qualifier
2679 is a
2680 .Ql +
2681 separated set of the following flags:
2682 .Pp
2683 .Bl -tag -width indent -compact
2684 .It Li all-read
2685 Count read entries.
2686 .It Li all-write
2687 Count write entries.
2688 .It Li mem-uc
2689 Count entries accessing uncacheable memory.
2690 .It Li mem-wc
2691 Count entries accessing write-combining memory.
2692 .It Li mem-wt
2693 Count entries accessing write-through memory.
2694 .It Li mem-wp
2695 Count entries accessing write-protected memory
2696 .It Li mem-wb
2697 Count entries accessing write-back memory.
2698 .It Li own
2699 Count store requests driven by the processor (i.e., not by other
2700 processors or by DMA).
2701 .It Li other
2702 Count store requests driven by other processors or by DMA.
2703 .It Li prefetch
2704 Include hardware and software prefetch requests in the count.
2705 .El
2706 .Pp
2707 The default value for
2708 .Ar qualifier
2709 is to enable all the above flags.
2710 .Pp
2711 The
2712 .Ar req-type
2713 qualifier is a 5-bit number can be additionally used to select a
2714 specific bus request type.
2715 The default is 0.
2716 .Pp
2717 The
2718 .Dq Li edge
2719 qualifier is normally used with this event to prevent multiple
2720 counting.
2721 The exact behaviour of this event depends on the processor revision.
2722 .It Li p4-itlb-reference Op mask= Ns Ar qualifier
2723 .Pq "TS event"
2724 Count translations using the intruction translation look-aside
2725 buffer.
2726 The
2727 .Ar qualifier
2728 argument is a list of the following strings separated by
2729 .Ql +
2730 characters.
2731 .Pp
2732 .Bl -tag -width indent -compact
2733 .It Li hit
2734 Count ITLB hits.
2735 .It Li miss
2736 Count ITLB misses.
2737 .It Li hit-uc
2738 Count uncacheable ITLB hits.
2739 .El
2740 .Pp
2741 If no
2742 .Ar qualifier
2743 is specified the default is to count all the three kinds of ITLB
2744 translations.
2745 .It Li p4-load-port-replay Op Li ,mask= Ns Ar qualifier
2746 .Pq "TS event"
2747 Count replayed events at the load port.
2748 Qualifier
2749 .Ar qualifier
2750 can take on one value:
2751 .Pp
2752 .Bl -tag -width indent -compact
2753 .It Li split-ld
2754 Count split loads.
2755 .El
2756 .Pp
2757 The default value for
2758 .Ar qualifier
2759 is
2760 .Dq Li split-ld .
2761 .It Li p4-mispred-branch-retired Op Li ,mask= Ns Ar flags
2762 .Pq "TS event"
2763 Count mispredicted IA-32 branch instructions.
2764 Qualifier
2765 .Ar flags
2766 can take the following value (which is also the default):
2767 .Pp
2768 .Bl -tag -width indent -compact
2769 .It Li nbogus
2770 Count non-bogus retired branch instructions.
2771 .El
2772 .It Li p4-machine-clear Op Li ,mask= Ns Ar flags
2773 .Pq "TS event"
2774 Count the number of pipeline clears seen by the processor.
2775 Qualifer
2776 .Ar flags
2777 is a list of the following strings separated by
2778 .Ql +
2779 characters:
2780 .Pp
2781 .Bl -tag -width indent -compact
2782 .It Li clear
2783 Count for a portion of the many cycles when the machine is being
2784 cleared for any reason.
2785 .It Li moclear
2786 Count machine clears due to memory ordering issues.
2787 .It Li smclear
2788 Count machine clears due to self-modifying code.
2789 .El
2790 .Pp
2791 Use qualifier
2792 .Dq Li edge
2793 to get a count of occurrences of machine clears.
2794 The default qualifier is
2795 .Dq Li clear .
2796 .It Li p4-memory-cancel Op Li ,mask= Ns Ar event-list
2797 .Pq "TS event"
2798 Count the cancelling of various kinds of requests in the data cache
2799 address control unit of the CPU.
2800 The qualifier
2801 .Ar event-list
2802 is a list of the following strings separated by
2803 .Ql +
2804 characters:
2805 .Pp
2806 .Bl -tag -width indent -compact
2807 .It Li st-rb-full
2808 Requests cancelled because no store request buffer was available.
2809 .It Li 64k-conf
2810 Requests that conflict due to 64K aliasing.
2811 .El
2812 .Pp
2813 If
2814 .Ar event-list
2815 is not specified, then the default is to count both kinds of events.
2816 .It Li p4-memory-complete Op Li ,mask= Ns Ar event-list
2817 .Pq "TS event"
2818 Count the completion of load split, store split, uncacheable split and
2819 uncacheable load operations selected by qualifier
2820 .Ar event-list .
2821 The qualifier
2822 .Ar event-list
2823 is a
2824 .Ql +
2825 separated list of the following flags:
2826 .Pp
2827 .Bl -tag -width indent -compact
2828 .It Li lsc
2829 Count load splits completed, excluding loads from uncacheable or
2830 write-combining areas.
2831 .It Li ssc
2832 Count any split stores completed.
2833 .El
2834 .Pp
2835 The default is to count both kinds of operations.
2836 .It Li p4-mob-load-replay Op Li ,mask= Ns Ar qualifier
2837 .Pq "TS event"
2838 Count load replays triggered by the memory order buffer.
2839 Qualifier
2840 .Ar qualifier
2841 can be a
2842 .Ql +
2843 separated list of the following flags:
2844 .Pp
2845 .Bl -tag -width indent -compact
2846 .It Li no-sta
2847 Count replays because of unknown store addresses.
2848 .It Li no-std
2849 Count replays because of unknown store data.
2850 .It Li partial-data
2851 Count replays because of partially overlapped data accesses between
2852 load and store operations.
2853 .It Li unalgn-addr
2854 Count replays because of mismatches in the lower 4 bits of load and
2855 store operations.
2856 .El
2857 .Pp
2858 The default qualifier is
2859 .Ar no-sta+no-std+partial-data+unalgn-addr .
2860 .It Li p4-packed-dp-uop Op Li ,mask= Ns Ar flags
2861 .Pq "TI event"
2862 Count packed double-precision uops.
2863 Qualifier
2864 .Ar flags
2865 can take the following value (which is also the default):
2866 .Pp
2867 .Bl -tag -width indent -compact
2868 .It Li all
2869 Count all uops operating on packed double-precision operands.
2870 .El
2871 .It Li p4-packed-sp-uop Op Li ,mask= Ns Ar flags
2872 .Pq "TI event"
2873 Count packed single-precision uops.
2874 Qualifier
2875 .Ar flags
2876 can take the following value (which is also the default):
2877 .Pp
2878 .Bl -tag -width indent -compact
2879 .It Li all
2880 Count all uops operating on packed single-precision operands.
2881 .El
2882 .It Li p4-page-walk-type Op Li ,mask= Ns Ar qualifier
2883 .Pq "TI event"
2884 Count page walks performed by the page miss handler.
2885 Qualifier
2886 .Ar qualifier
2887 can be a
2888 .Ql +
2889 separated list of the following keywords:
2890 .Pp
2891 .Bl -tag -width indent -compact
2892 .It Li dtmiss
2893 Count page walks for data TLB misses.
2894 .It Li itmiss
2895 Count page walks for instruction TLB misses.
2896 .El
2897 .Pp
2898 The default value for
2899 .Ar qualifier
2900 is
2901 .Dq Li dtmiss+itmiss .
2902 .It Li p4-replay-event Op Li ,mask= Ns Ar flags
2903 .Pq "TS event"
2904 Count the retirement of tagged uops selected through the replay
2905 tagging mechanism.
2906 Qualifier
2907 .Ar flags
2908 contains a
2909 .Ql +
2910 separated set of the following strings:
2911 .Pp
2912 .Bl -tag -width indent -compact
2913 .It Li nbogus
2914 The marked uops are not bogus.
2915 .It Li bogus
2916 The marked uops are bogus.
2917 .El
2918 .Pp
2919 This event requires additional (upstream) events to be allocated to
2920 perform the desired uop tagging.
2921 The default qualifier counts both kinds of uops.
2922 This event can be used for precise event based sampling.
2923 .It Li p4-resource-stall Op Li ,mask= Ns Ar flags
2924 .Pq "TS event"
2925 Count the occurrence or latency of stalls in the allocator.
2926 Qualifier
2927 .Ar flags
2928 can take the following value (which is also the default):
2929 .Pp
2930 .Bl -tag -width indent -compact
2931 .It Li sbfull
2932 A stall due to the lack of store buffers.
2933 .El
2934 .It Li p4-response
2935 .Pq "TI event"
2936 Count different types of responses.
2937 Further documentation on this event is not available.
2938 .It Li p4-retired-branch-type Op Li ,mask= Ns Ar flags
2939 .Pq "TS event"
2940 Count branches retired.
2941 Qualifier
2942 .Ar flags
2943 contains a
2944 .Ql +
2945 separated list of strings:
2946 .Pp
2947 .Bl -tag -width indent -compact
2948 .It Li conditional
2949 Count conditional jumps.
2950 .It Li call
2951 Count direct and indirect call branches.
2952 .It Li return
2953 Count return branches.
2954 .It Li indirect
2955 Count returns, indirect calls or indirect jumps.
2956 .El
2957 .Pp
2958 The default qualifier counts all the above branch types.
2959 .It Li p4-retired-mispred-branch-type Op Li ,mask= Ns Ar flags
2960 .Pq "TS event"
2961 Count mispredicted branches retired.
2962 Qualifier
2963 .Ar flags
2964 contains a
2965 .Ql +
2966 separated list of strings:
2967 .Pp
2968 .Bl -tag -width indent -compact
2969 .It Li conditional
2970 Count conditional jumps.
2971 .It Li call
2972 Count indirect call branches.
2973 .It Li return
2974 Count return branches.
2975 .It Li indirect
2976 Count returns, indirect calls or indirect jumps.
2977 .El
2978 .Pp
2979 The default qualifier counts all the above branch types.
2980 .It Li p4-scalar-dp-uop Op Li ,mask= Ns Ar flags
2981 .Pq "TI event"
2982 Count the number of scalar double-precision uops.
2983 Qualifier
2984 .Ar flags
2985 can take the following value (which is also the default):
2986 .Pp
2987 .Bl -tag -width indent -compact
2988 .It Li all
2989 Count the number of scalar double-precision uops.
2990 .El
2991 .It Li p4-scalar-sp-uop Op Li ,mask= Ns Ar flags
2992 .Pq "TI event"
2993 Count the number of scalar single-precision uops.
2994 Qualifier
2995 .Ar flags
2996 can take the following value (which is also the default):
2997 .Pp
2998 .Bl -tag -width indent -compact
2999 .It Li all
3000 Count all uops operating on scalar single-precision operands.
3001 .El
3002 .It Li p4-snoop
3003 .Pq "TI event"
3004 Count snoop traffic.
3005 Further documentation on this event is not available.
3006 .It Li p4-sse-input-assist Op Li ,mask= Ns Ar flags
3007 .Pq "TI event"
3008 Count the number of times an assist is required to handle problems
3009 with the operands for SSE and SSE2 operations.
3010 Qualifier
3011 .Ar flags
3012 can take the following value (which is also the default):
3013 .Pp
3014 .Bl -tag -width indent -compact
3015 .It Li all
3016 Count assists for all SSE and SSE2 uops.
3017 .El
3018 .It Li p4-store-port-replay Op Li ,mask= Ns Ar qualifier
3019 .Pq "TS event"
3020 Count events replayed at the store port.
3021 Qualifier
3022 .Ar qualifier
3023 can take on one value:
3024 .Pp
3025 .Bl -tag -width indent -compact
3026 .It Li split-st
3027 Count split stores.
3028 .El
3029 .Pp
3030 The default value for
3031 .Ar qualifier
3032 is
3033 .Dq Li split-st .
3034 .It Li p4-tc-deliver-mode Op Li ,mask= Ns Ar qualifier
3035 .Pq "TI event"
3036 Count the duration in cycles of operating modes of the trace cache and
3037 decode engine.
3038 The desired operating mode is selected by
3039 .Ar qualifier ,
3040 which is a list of the following strings separated by
3041 .Ql +
3042 characters:
3043 .Pp
3044 .Bl -tag -width indent -compact
3045 .It Li DD
3046 Both logical processors are in deliver mode.
3047 .It Li DB
3048 Logical processor 0 is in deliver mode while logical processor 1 is in
3049 build mode.
3050 .It Li DI
3051 Logical processor 0 is in deliver mode while logical processor 1 is
3052 halted, or in machine clear, or transitioning to a long microcode
3053 flow.
3054 .It Li BD
3055 Logical processor 0 is in build mode while logical processor 1 is in
3056 deliver mode.
3057 .It Li BB
3058 Both logical processors are in build mode.
3059 .It Li BI
3060 Logical processor 0 is in build mode while logical processor 1 is
3061 halted, or in machine clear or transitioning to a long microcode
3062 flow.
3063 .It Li ID
3064 Logical processor 0 is halted, or in machine clear or transitioning to
3065 a long microcode flow while logical processor 1 is in deliver mode.
3066 .It Li IB
3067 Logical processor 0 is halted, or in machine clear or transitioning to
3068 a long microcode flow while logical processor 1 is in build mode.
3069 .El
3070 .Pp
3071 If there is only one logical processor in the processor package then
3072 the qualifier for logical processor 1 is ignored.
3073 If no qualifier is specified, the default qualifier is
3074 .Dq Li DD+DB+DI+BD+BB+BI+ID+IB .
3075 .It Li p4-tc-ms-xfer Op Li ,mask= Ns Ar flags
3076 .Pq "TI event"
3077 Count the number of times uop delivery changed from the trace cache to
3078 MS ROM.
3079 Qualifier
3080 .Ar flags
3081 can take the following value (which is also the default):
3082 .Pp
3083 .Bl -tag -width indent -compact
3084 .It Li cisc
3085 Count TC to MS transfers.
3086 .El
3087 .It Li p4-uop-queue-writes Op Li ,mask= Ns Ar flags
3088 .Pq "TS event"
3089 Count the number of valid uops written to the uop queue.
3090 Qualifier
3091 .Ar flags
3092 is a list of the following strings, separated by
3093 .Ql +
3094 characters:
3095 .Pp
3096 .Bl -tag -width indent -compact
3097 .It Li from-tc-build
3098 Count uops being written from the trace cache in build mode.
3099 .It Li from-tc-deliver
3100 Count uops being written from the trace cache in deliver mode.
3101 .It Li from-rom
3102 Count uops being written from microcode ROM.
3103 .El
3104 .Pp
3105 The default qualifier counts all the above kinds of uops.
3106 .It Li p4-uop-type Op Li ,mask= Ns Ar flags
3107 .Pq "TS event"
3108 This event is used in conjunction with the front-end at-retirement
3109 mechanism to tag load and store uops.
3110 Qualifer
3111 .Ar flags
3112 comprises the following strings separated by
3113 .Ql +
3114 characters:
3115 .Pp
3116 .Bl -tag -width indent -compact
3117 .It Li tagloads
3118 Mark uops that are load operations.
3119 .It Li tagstores
3120 Mark uops that are store operations.
3121 .El
3122 .Pp
3123 The default qualifier counts both kinds of uops.
3124 .It Li p4-uops-retired Op Li ,mask= Ns Ar flags
3125 .Pq "TS event"
3126 Count uops retired during a clock cycle.
3127 Qualifier
3128 .Ar flags
3129 comprises the following strings separated by
3130 .Ql +
3131 characters:
3132 .Pp
3133 .Bl -tag -width indent -compact
3134 .It Li nbogus
3135 Count marked uops that are not bogus.
3136 .It Li bogus
3137 Count marked uops that are bogus.
3138 .El
3139 .Pp
3140 The default qualifier counts both kinds of uops.
3141 .It Li p4-wc-buffer Op Li ,mask= Ns Ar flags
3142 .Pq "TI event"
3143 Count write-combining buffer operations.
3144 Qualifier
3145 .Ar flags
3146 contains the following strings separated by
3147 .Ql +
3148 characters:
3149 .Pp
3150 .Bl -tag -width indent -compact
3151 .It Li wcb-evicts
3152 WC buffer evictions due to any cause.
3153 .It Li wcb-full-evict
3154 WC buffer evictions due to no WC buffer being available.
3155 .El
3156 .Pp
3157 The default qualifer counts both kinds of evictions.
3158 .It Li p4-x87-assist Op Li ,mask= Ns Ar flags
3159 .Pq "TS event"
3160 Count the retirement of x87 instructions that required special
3161 handling.
3162 Qualifier
3163 .Ar flags
3164 contains the following strings separated by
3165 .Ql +
3166 characters:
3167 .Pp
3168 .Bl -tag -width indent -compact
3169 .It Li fpsu
3170 Count instructions that saw an FP stack underflow.
3171 .It Li fpso
3172 Count instructions that saw an FP stack overflow.
3173 .It Li poao
3174 Count instructions that saw an x87 output overflow.
3175 .It Li poau
3176 Count instructions that saw an x87 output underflow.
3177 .It Li prea
3178 Count instructions that needed an x87 input assist.
3179 .El
3180 .Pp
3181 The default qualifier counts all the above types of instruction
3182 retirements.
3183 .It Li p4-x87-fp-uop Op Li ,mask= Ns Ar flags
3184 .Pq "TI event"
3185 Count x87 floating-point uops.
3186 Qualifier
3187 .Ar flags
3188 can take the following value (which is also the default):
3189 .Pp
3190 .Bl -tag -width indent -compact
3191 .It Li all
3192 Count all x87 floating-point uops.
3193 .El
3194 .Pp
3195 If an instruction contains more than one x87 floating-point uops, then
3196 all x87 floating-point uops will be counted.
3197 This event does not count x87 floating-point data movement operations.
3198 .It Li p4-x87-simd-moves-uop Op Li ,mask= Ns Ar flags
3199 .Pq "TI event"
3200 Count each x87 FPU, MMX, SSE, or SSE2 uops that load data or store
3201 data or perform register-to-register moves.
3202 This event does not count integer move uops.
3203 Qualifier
3204 .Ar flags
3205 may contain the following keywords separated by
3206 .Ql +
3207 characters:
3208 .Pp
3209 .Bl -tag -width indent -compact
3210 .It Li allp0
3211 Count all x87 and SIMD store and move uops.
3212 .It Li allp2
3213 Count all x87 and SIMD load uops.
3214 .El
3215 .Pp
3216 The default is to count all uops.
3217 .Pq Errata
3218 This event may be affected by processor errata N43.
3219 .El
3220 .Ss "Cascading P4 PMCs"
3221 PMC cascading support is currently poorly implemented.
3222 While individual event counters may be allocated with a
3223 .Dq Li cascade
3224 qualifier, the current API does not offer the ability
3225 to name and allocate all the resources needed for a
3226 cascaded event counter pair in a single operation.
3227 .Ss "Precise Event Based Sampling"
3228 Support for precise event based sampling is currently
3229 unimplemented in
3230 .Xr hwpmc 4 .
3231 .Sh IMPLEMENTATION NOTES
3232 On the i386 architecture,
3233 .Fx
3234 has historically allowed the use of the RDTSC instruction from
3235 user-mode (i.e., at a processor CPL of 3) by any process.
3236 This behaviour is preserved by
3237 .Xr hwpmc 4 .
3238 .Sh RETURN VALUES
3239 The
3240 .Fn pmc_name_of_capability ,
3241 .Fn pmc_name_of_class ,
3242 .Fn pmc_name_of_cputype ,
3243 .Fn pmc_name_of_disposition ,
3244 .Fn pmc_name_of_event ,
3245 .Fn pmc_name_of_mode ,
3246 and
3247 .Fn pmc_name_of_state
3248 functions return a pointer to the human readable form of their argument.
3249 These pointers may point to statically allocated storage and must
3250 not be passed to
3251 .Fn free .
3252 In case of an error, these functions return
3253 .Dv NULL
3254 and set the global variable
3255 .Va errno .
3256 .Pp
3257 The functions
3258 .Fn pmc_ncpu
3259 and
3260 .Fn pmc_npmc
3261 return the number of CPUs and number of PMCs configured respectively;
3262 in case of an error they return the value
3263 \-1
3264 and set the global variable
3265 .Va errno .
3266 .Pp
3267 All other functions return the value
3268 0
3269 if successful; otherwise the value
3270 \-1
3271 is returned and the global variable
3272 .Va errno
3273 is set to indicate the error.
3274 .Sh COMPATIBILITY
3275 The interface between the
3276 .Nm pmc
3277 library and the
3278 .Xr hwpmc 4
3279 driver is intended to be private to the implementation and may
3280 change.
3281 In order to ease forward compatibility with future versions of the
3282 .Xr hwpmc 4
3283 driver, applications are urged to dynamically link with the
3284 .Nm pmc
3285 library.
3286 .Pp
3287 The
3288 .Nm pmc
3289 API is
3290 .Ud
3291 .Sh ERRORS
3292 A call to
3293 .Fn pmc_init
3294 may fail with the following errors in addition to those returned by
3295 .Xr modfind 2 ,
3296 .Xr modstat 2
3297 and
3298 .Xr hwpmc 4 :
3299 .Bl -tag -width Er
3300 .It Bq Er ENXIO
3301 An unknown CPU type was encountered during initialization.
3302 .It Bq Er EPROGMISMATCH
3303 The version number of the
3304 .Xr hwpmc 4
3305 kernel module did not match that compiled into the
3306 .Nm pmc
3307 library.
3308 .El
3309 .Pp
3310 A call to
3311 .Fn pmc_capabilities ,
3312 .Fn pmc_name_of_capability ,
3313 .Fn pmc_name_of_disposition ,
3314 .Fn pmc_name_of_state ,
3315 .Fn pmc_name_of_event ,
3316 .Fn pmc_name_of_mode
3317 .Fn pmc_name_of_class
3318 and
3319 .Fn pmc_width
3320 may fail with the following error:
3321 .Bl -tag -width Er
3322 .It Bq Er EINVAL
3323 An invalid argument was passed to the function.
3324 .El
3325 .Pp
3326 A call to
3327 .Fn pmc_cpuinfo
3328 or
3329 .Fn pmc_ncpu
3330 may fail with the following error:
3331 .Bl -tag -width Er
3332 .It Bq Er ENXIO
3333 The
3334 .Nm pmc
3335 has not been initialized.
3336 .El
3337 .Pp
3338 A call to
3339 .Fn pmc_npmc
3340 may fail with the following errors:
3341 .Bl -tag -width Er
3342 .It Bq Er EINVAL
3343 The argument passed in was out of range.
3344 .It Bq Er ENXIO
3345 The
3346 .Nm pmc
3347 library has not been initialized.
3348 .El
3349 .Pp
3350 A call to
3351 .Fn pmc_pmcinfo
3352 may fail with the following errors, in addition to those returned by
3353 .Xr hwpmc 4 :
3354 .Bl -tag -width Er
3355 .It Bq Er ENXIO
3356 The
3357 .Nm pmc
3358 library is not yet initialized.
3359 .El
3360 .Pp
3361 A call to
3362 .Fn pmc_allocate
3363 may fail with the following errors, in addition to those returned by
3364 .Xr hwpmc 4 :
3365 .Bl -tag -width Er
3366 .It Bq Er EINVAL
3367 The
3368 .Fa mode
3369 argument passed in had an illegal value, or the event specification
3370 .Fa ctrspec
3371 was unrecognized for this CPU type.
3372 .El
3373 .Pp
3374 Calls to
3375 .Fn pmc_attach ,
3376 .Fn pmc_configure_logfile ,
3377 .Fn pmc_detach ,
3378 .Fn pmc_disable ,
3379 .Fn pmc_enable ,
3380 .Fn pmc_get_driver_stats ,
3381 .Fn pmc_get_msr ,
3382 .Fn pmc_read ,
3383 .Fn pmc_release ,
3384 .Fn pmc_rw ,
3385 .Fn pmc_set ,
3386 .Fn pmc_start ,
3387 .Fn pmc_stop ,
3388 .Fn pmc_write ,
3389 and
3390 .Fn pmc_writelog
3391 may fail with the errors described in
3392 .Xr hwpmc 4 .
3393 .Pp
3394 If a log file was configured using
3395 .Fn pmc_configure_logfile
3396 and the
3397 .Xr hwpmc 4
3398 driver encountered an error while logging data to it, then
3399 logging will be stopped and a subsequent call to
3400 .Fn pmc_flush_logfile
3401 will fail with the error code seen by the
3402 .Xr hwpmc 4
3403 driver.
3404 .Sh SEE ALSO
3405 .Xr modfind 2 ,
3406 .Xr modstat 2 ,
3407 .Xr calloc 3 ,
3408 .Xr pmclog 3 ,
3409 .Xr hwpmc 4 ,
3410 .Xr pmccontrol 8 ,
3411 .Xr pmcstat 8
3412 .Sh HISTORY
3413 The
3414 .Nm pmc
3415 library first appeared in
3416 .Fx 6.0 .
3417 .Sh BUGS
3418 The information returned by
3419 .Fn pmc_cpuinfo ,
3420 .Fn pmc_ncpu
3421 and possibly
3422 .Fn pmc_npmc
3423 should really be available all the time, through a better designed
3424 interface and not just when
3425 .Xr hwpmc 4
3426 is present in the kernel.