]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - lib/libpmc/pmc.p4.3
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / lib / libpmc / pmc.p4.3
1 .\" Copyright (c) 2003-2008 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 October 4, 2008
27 .Os
28 .Dt PMC.P4 3
29 .Sh NAME
30 .Nm pmc.p4
31 .Nd measurement events for
32 .Tn "Intel Pentium 4"
33 and other
34 .Tn Netburst
35 architecture CPUs
36 .Sh LIBRARY
37 .Lb libpmc
38 .Sh SYNOPSIS
39 .In pmc.h
40 .Sh DESCRIPTION
41 Intel P4 PMCs are present in Intel
42 .Tn "Pentium 4"
43 and
44 .Tn Xeon
45 processors that use the
46 .Tn Netburst
47 CPU architecture.
48 .Pp
49 These PMCs are documented in
50 .Rs
51 .%B "IA-32 Intel(R) Architecture Software Developer's Manual"
52 .%T "Volume 3: System Programming Guide"
53 .%N "Order Number 245472-012"
54 .%D 2003
55 .%Q "Intel Corporation"
56 .Re
57 Further information about using these PMCs may be found in
58 .Rs
59 .%B "IA-32 Intel(R) Architecture Optimization Guide"
60 .%D 2003
61 .%N "Order Number 248966-009"
62 .%Q "Intel Corporation"
63 .Re
64 Some of these events are affected by processor errata described in
65 .Rs
66 .%B "Intel(R) Pentium(R) 4 Processor Specification Update"
67 .%N "Document Number: 249199-059"
68 .%D "April 2005"
69 .%Q "Intel Corporation"
70 .Re
71 .Ss PMC Features
72 Intel Pentium 4 PMCs are 40 bits wide.
73 Each CPU contains 18 PMCs, divided into 4 groups with 4, 4, 4 and 6
74 PMCs respectively.
75 On processors with hyperthreading support, PMC resources are shared
76 between logical processors.
77 These PMCs support the following capabilities:
78 .Bl -column "PMC_CAP_INTERRUPT" "Support"
79 .It Em Capability Ta Em Support
80 .It PMC_CAP_CASCADE Ta Yes
81 .It PMC_CAP_EDGE Ta Yes
82 .It PMC_CAP_INTERRUPT Ta Yes
83 .It PMC_CAP_INVERT Ta Yes
84 .It PMC_CAP_READ Ta Yes
85 .It PMC_CAP_PRECISE Ta Unimplemented
86 .It PMC_CAP_SYSTEM Ta Yes
87 .It PMC_CAP_TAGGING Ta Yes
88 .It PMC_CAP_THRESHOLD Ta Yes
89 .It PMC_CAP_USER Ta Yes
90 .It PMC_CAP_WRITE Ta Yes
91 .El
92 .Ss Event Qualifiers
93 .Pp
94 Event specifiers for Intel P4 PMCs can have the following common
95 qualifiers:
96 .Bl -tag -width indent
97 .It Li active= Ns Ar choice
98 (On P4 HTT CPUs) Filter event counting based on which logical
99 processors are active.
100 The allowed values of
101 .Ar choice
102 are:
103 .Pp
104 .Bl -tag -width indent -compact
105 .It Li any
106 Count when either logical processor is active.
107 .It Li both
108 Count when both logical processors are active.
109 .It Li none
110 Count only when neither logical processor is active.
111 .It Li single
112 Count only when one logical processor is active.
113 .El
114 .Pp
115 The default is
116 .Dq Li both .
117 .It Li cascade
118 Configure the PMC to cascade onto its partner.
119 See
120 .Sx "Cascading P4 PMCs"
121 below for more information.
122 .It Li edge
123 Configure the counter to count false to true transitions of the threshold
124 comparision output.
125 This qualifier only takes effect if a threshold qualifier has also been
126 specified.
127 .It Li complement
128 Configure the counter to increment only when the event count seen is
129 less than the threshold qualifier value specified.
130 .It Li mask= Ns Ar qualifier
131 Many event specifiers for Intel P4 PMCs need to be additionally
132 qualified using a mask qualifier.
133 The allowed syntax for these qualifiers is event specific and is
134 described along with the events.
135 .It Li os
136 Configure the PMC to count when the CPL of the processor is 0.
137 .It Li precise
138 Select precise event based sampling.
139 Precise sampling is supported by the hardware for a limited set of
140 events.
141 .It Li tag= Ns Ar value
142 Configure the PMC to tag the internal uop selected by the other
143 fields in this event specifier with value
144 .Ar value .
145 This feature is used when cascading PMCs.
146 .It Li threshold= Ns Ar value
147 Configure the PMC to increment only when the event counts seen are
148 greater than the specified threshold value
149 .Ar value .
150 .It Li usr
151 Configure the PMC to count when the CPL of the processor is 1, 2 or 3.
152 .El
153 .Pp
154 If neither of the
155 .Dq Li os
156 or
157 .Dq Li usr
158 qualifiers are specified, the default is to enable both.
159 .Pp
160 On Intel Pentium 4 processors with HTT, events are
161 divided into two classes:
162 .Pp
163 .Bl -tag -width indent -compact
164 .It "TS Events"
165 are those where hardware can differentiate between events
166 generated on one logical processor from those generated on the
167 other.
168 .It "TI Events"
169 are those where hardware cannot differentiate between events
170 generated by multiple logical processors in a package.
171 .El
172 .Pp
173 Only TS events are allowed for use with process-mode PMCs on
174 Pentium-4/HTT CPUs.
175 .Pp
176 The event specifiers supported by Intel P4 PMCs are:
177 .Pp
178 .Bl -tag -width indent
179 .It Li p4-128bit-mmx-uop Op Li ,mask= Ns Ar flags
180 .Pq "TI event"
181 Count integer SIMD SSE2 instructions that operate on 128 bit SIMD
182 operands.
183 Qualifier
184 .Ar flags
185 can take the following value (which is also the default):
186 .Pp
187 .Bl -tag -width indent -compact
188 .It Li all
189 Count all uops operating on 128 bit SIMD integer operands in memory or
190 XMM register.
191 .El
192 .Pp
193 If an instruction contains more than one 128 bit MMX uop, then each
194 uop will be counted.
195 .It Li p4-64bit-mmx-uop Op Li ,mask= Ns Ar flags
196 .Pq "TI event"
197 Count MMX instructions that operate on 64 bit SIMD operands.
198 Qualifier
199 .Ar flags
200 can take the following value (which is also the default):
201 .Pp
202 .Bl -tag -width indent -compact
203 .It Li all
204 Count all uops operating on 64 bit SIMD integer operands in memory or
205 in MMX registers.
206 .El
207 .Pp
208 If an instruction contains more than one 64 bit MMX uop, then each
209 uop will be counted.
210 .It Li p4-b2b-cycles
211 .Pq "TI event"
212 Count back-to-back bus cycles.
213 Further documentation for this event is unavailable.
214 .It Li p4-bnr
215 .Pq "TI event"
216 Count bus-not-ready conditions.
217 Further documentation for this event is unavailable.
218 .It Li p4-bpu-fetch-request Op Li ,mask= Ns Ar qualifier
219 .Pq "TS event"
220 Count instruction fetch requests qualified by additional
221 flags specified in
222 .Ar qualifier .
223 At this point only one flag is supported:
224 .Pp
225 .Bl -tag -width indent -compact
226 .It Li tcmiss
227 Count trace cache lookup misses.
228 .El
229 .Pp
230 The default qualifier is also
231 .Dq Li mask=tcmiss .
232 .It Li p4-branch-retired Op Li ,mask= Ns Ar flags
233 .Pq "TS event"
234 Counts retired branches.
235 Qualifier
236 .Ar flags
237 is a list of the following
238 .Ql +
239 separated strings:
240 .Pp
241 .Bl -tag -width indent -compact
242 .It Li mmnp
243 Count branches not-taken and predicted.
244 .It Li mmnm
245 Count branches not-taken and mis-predicted.
246 .It Li mmtp
247 Count branches taken and predicted.
248 .It Li mmtm
249 Count branches taken and mis-predicted.
250 .El
251 .Pp
252 The default qualifier counts all four kinds of branches.
253 .It Li p4-bsq-active-entries Op Li ,mask= Ns Ar qualifier
254 .Pq "TS event"
255 Count the number of entries (clipped at 15) currently active in the
256 BSQ.
257 Qualifier
258 .Ar qualifier
259 is a
260 .Ql +
261 separated set of the following flags:
262 .Pp
263 .Bl -tag -width indent -compact
264 .It Li req-type0 , Li req-type1
265 Forms a 2-bit number used to select the request type encoding:
266 .Pp
267 .Bl -tag -width indent -compact
268 .It Li 0
269 reads excluding read invalidate
270 .It Li 1
271 read invalidates
272 .It Li 2
273 writes other than writebacks
274 .It Li 3
275 writebacks
276 .El
277 .Pp
278 Bit
279 .Dq Li req-type1
280 is the MSB for this two bit number.
281 .It Li req-len0 , Li req-len1
282 Forms a two-bit number that specifies the request length encoding:
283 .Pp
284 .Bl -tag -width indent -compact
285 .It Li 0
286 0 chunks
287 .It Li 1
288 1 chunk
289 .It Li 3
290 8 chunks
291 .El
292 .Pp
293 Bit
294 .Dq Li req-len1
295 is the MSB for this two bit number.
296 .It Li req-io-type
297 Count requests that are input or output requests.
298 .It Li req-lock-type
299 Count requests that lock the bus.
300 .It Li req-lock-cache
301 Count requests that lock the cache.
302 .It Li req-split-type
303 Count requests that is a bus 8-byte chunk that is split across an
304 8-byte boundary.
305 .It Li req-dem-type
306 Count requests that are demand (not prefetches) if set.
307 Count requests that are prefetches if not set.
308 .It Li req-ord-type
309 Count requests that are ordered.
310 .It Li mem-type0 , Li mem-type1 , Li mem-type2
311 Forms a 3-bit number that specifies a memory type encoding:
312 .Pp
313 .Bl -tag -width indent -compact
314 .It Li 0
315 UC
316 .It Li 1
317 USWC
318 .It Li 4
319 WT
320 .It Li 5
321 WP
322 .It Li 6
323 WB
324 .El
325 .Pp
326 Bit
327 .Dq Li mem-type2
328 is the MSB of this 3-bit number.
329 .El
330 .Pp
331 The default qualifier has all the above bits set.
332 .Pp
333 Edge triggering using the
334 .Dq Li edge
335 qualifier should not be used with this event when counting cycles.
336 .It Li p4-bsq-allocation Op Li ,mask= Ns Ar qualifier
337 .Pq "TS event"
338 Count allocations in the bus sequence unit according to the flags
339 specified in
340 .Ar qualifier ,
341 which is a
342 .Ql +
343 separated set of the following flags:
344 .Pp
345 .Bl -tag -width indent -compact
346 .It Li req-type0 , Li req-type1
347 Forms a 2-bit number used to select the request type encoding:
348 .Pp
349 .Bl -tag -width indent -compact
350 .It Li 0
351 reads excluding read invalidate
352 .It Li 1
353 read invalidates
354 .It Li 2
355 writes other than writebacks
356 .It Li 3
357 writebacks
358 .El
359 .Pp
360 Bit
361 .Dq Li req-type1
362 is the MSB for this two bit number.
363 .It Li req-len0 , Li req-len1
364 Forms a two-bit number that specifies the request length encoding:
365 .Pp
366 .Bl -tag -width indent -compact
367 .It Li 0
368 0 chunks
369 .It Li 1
370 1 chunk
371 .It Li 3
372 8 chunks
373 .El
374 .Pp
375 Bit
376 .Dq Li req-len1
377 is the MSB for this two bit number.
378 .It Li req-io-type
379 Count requests that are input or output requests.
380 .It Li req-lock-type
381 Count requests that lock the bus.
382 .It Li req-lock-cache
383 Count requests that lock the cache.
384 .It Li req-split-type
385 Count requests that is a bus 8-byte chunk that is split across an
386 8-byte boundary.
387 .It Li req-dem-type
388 Count requests that are demand (not prefetches) if set.
389 Count requests that are prefetches if not set.
390 .It Li req-ord-type
391 Count requests that are ordered.
392 .It Li mem-type0 , Li mem-type1 , Li mem-type2
393 Forms a 3-bit number that specifies a memory type encoding:
394 .Pp
395 .Bl -tag -width indent -compact
396 .It Li 0
397 UC
398 .It Li 1
399 USWC
400 .It Li 4
401 WT
402 .It Li 5
403 WP
404 .It Li 6
405 WB
406 .El
407 .Pp
408 Bit
409 .Dq Li mem-type2
410 is the MSB of this 3-bit number.
411 .El
412 .Pp
413 The default qualifier has all the above bits set.
414 .Pp
415 This event is usually used along with the
416 .Dq Li edge
417 qualifier to avoid multiple counting.
418 .It Li p4-bsq-cache-reference Op Li ,mask= Ns Ar qualifier
419 .Pq "TS event"
420 Count cache references as seen by the bus unit (2nd or 3rd level
421 cache references).
422 Qualifier
423 .Ar qualifier
424 is a
425 .Ql +
426 separated list of the following keywords:
427 .Pp
428 .Bl -tag -width indent -compact
429 .It Li rd-2ndl-hits
430 Count 2nd level cache hits in the shared state.
431 .It Li rd-2ndl-hite
432 Count 2nd level cache hits in the exclusive state.
433 .It Li rd-2ndl-hitm
434 Count 2nd level cache hits in the modified state.
435 .It Li rd-3rdl-hits
436 Count 3rd level cache hits in the shared state.
437 .It Li rd-3rdl-hite
438 Count 3rd level cache hits in the exclusive state.
439 .It Li rd-3rdl-hitm
440 Count 3rd level cache hits in the modified state.
441 .It Li rd-2ndl-miss
442 Count 2nd level cache misses.
443 .It Li rd-3rdl-miss
444 Count 3rd level cache misses.
445 .It Li wr-2ndl-miss
446 Count write-back lookups from the data access cache that miss the 2nd
447 level cache.
448 .El
449 .Pp
450 The default is to count all the above events.
451 .It Li p4-execution-event Op Li ,mask= Ns Ar flags
452 .Pq "TS event"
453 Count the retirement of tagged uops selected through the execution
454 tagging mechanism.
455 Qualifier
456 .Ar flags
457 can contain the following strings separated by
458 .Ql +
459 characters:
460 .Pp
461 .Bl -tag -width indent -compact
462 .It Li nbogus0 , Li nbogus1 , Li nbogus2 , Li nbogus3
463 The marked uops are not bogus.
464 .It Li bogus0 , Li bogus1 , Li bogus2 , Li bogus3
465 The marked uops are bogus.
466 .El
467 .Pp
468 This event requires additional (upstream) events to be allocated to
469 perform the desired uop tagging.
470 The default is to set all the above flags.
471 This event can be used for precise event based sampling.
472 .It Li p4-front-end-event Op Li ,mask= Ns Ar flags
473 .Pq "TS event"
474 Count the retirement of tagged uops selected through the front-end
475 tagging mechanism.
476 Qualifier
477 .Ar flags
478 can contain the following strings separated by
479 .Ql +
480 characters:
481 .Pp
482 .Bl -tag -width indent -compact
483 .It Li nbogus
484 The marked uops are not bogus.
485 .It Li bogus
486 The marked uops are bogus.
487 .El
488 .Pp
489 This event requires additional (upstream) events to be allocated to
490 perform the desired uop tagging.
491 The default is to select both kinds of events.
492 This event can be used for precise event based sampling.
493 .It Li p4-fsb-data-activity Op Li ,mask= Ns Ar flags
494 .Pq "TI event"
495 Count each DBSY or DRDY event selected by qualifier
496 .Ar flags .
497 Qualifier
498 .Ar flags
499 is a
500 .Ql +
501 separated set of the following flags:
502 .Pp
503 .Bl -tag -width indent -compact
504 .It Li drdy-drv
505 Count when this processor is driving data onto the bus.
506 .It Li drdy-own
507 Count when this processor is reading data from the bus.
508 .It Li drdy-other
509 Count when data is on the bus but not being sampled by this processor.
510 .It Li dbsy-drv
511 Count when this processor reserves the bus for use in the next cycle
512 in order to drive data.
513 .It Li dbsy-own
514 Count when some agent reserves the bus for use in the next bus cycle
515 to drive data that this processor will sample.
516 .It Li dbsy-other
517 Count when some agent reserves the bus for use in the next bus cycle
518 to drive data that this processor will not sample.
519 .El
520 .Pp
521 Flags
522 .Dq Li drdy-own
523 and
524 .Dq Li drdy-other
525 are mutually exclusive.
526 Flags
527 .Dq Li dbsy-own
528 and
529 .Dq Li dbsy-other
530 are mutually exclusive.
531 The default value for
532 .Ar qualifier
533 is
534 .Dq Li drdy-drv+drdy-own+dbsy-drv+dbsy-own .
535 .It Li p4-global-power-events Op Li ,mask= Ns Ar flags
536 .Pq "TS event"
537 Count cycles during which the processor is not stopped.
538 Qualifier
539 .Ar flags
540 can take the following value (which is also the default):
541 .Pp
542 .Bl -tag -width indent -compact
543 .It Li running
544 Count cycles when the processor is active.
545 .El
546 .Pp
547 .It Li p4-instr-retired Op Li ,mask= Ns Ar flags
548 .Pq "TS event"
549 Count instructions retired during a clock cycle.
550 Qualifer
551 .Ar flags
552 comprises of the following strings separated by
553 .Ql +
554 characters:
555 .Pp
556 .Bl -tag -width indent -compact
557 .It Li nbogusntag
558 Count non-bogus instructions that are not tagged.
559 .It Li nbogustag
560 Count non-bogus instructions that are tagged.
561 .It Li bogusntag
562 Count bogus instructions that are not tagged.
563 .It Li bogustag
564 Count bogus instructions that are tagged.
565 .El
566 .Pp
567 The default qualifier counts all the above kinds of instructions.
568 .It Li p4-ioq-active-entries Xo
569 .Op Li ,mask= Ns Ar qualifier
570 .Op Li ,busreqtype= Ns Ar req-type
571 .Xc
572 .Pq "TS event"
573 Count the number of entries (clipped at 15) in the IOQ that are
574 active.
575 The event masks are specified by qualifier
576 .Ar qualifier
577 and
578 .Ar req-type .
579 .Pp
580 Qualifier
581 .Ar qualifier
582 is a
583 .Ql +
584 separated set of the following flags:
585 .Pp
586 .Bl -tag -width indent -compact
587 .It Li all-read
588 Count read entries.
589 .It Li all-write
590 Count write entries.
591 .It Li mem-uc
592 Count entries accessing uncacheable memory.
593 .It Li mem-wc
594 Count entries accessing write-combining memory.
595 .It Li mem-wt
596 Count entries accessing write-through memory.
597 .It Li mem-wp
598 Count entries accessing write-protected memory
599 .It Li mem-wb
600 Count entries accessing write-back memory.
601 .It Li own
602 Count store requests driven by the processor (i.e., not by other
603 processors or by DMA).
604 .It Li other
605 Count store requests driven by other processors or by DMA.
606 .It Li prefetch
607 Include hardware and software prefetch requests in the count.
608 .El
609 .Pp
610 The default value for
611 .Ar qualifier
612 is to enable all the above flags.
613 .Pp
614 The
615 .Ar req-type
616 qualifier is a 5-bit number can be additionally used to select a
617 specific bus request type.
618 The default is 0.
619 .Pp
620 The
621 .Dq Li edge
622 qualifier should not be used when counting cycles with this event.
623 The exact behaviour of this event depends on the processor revision.
624 .It Li p4-ioq-allocation Xo
625 .Op Li ,mask= Ns Ar qualifier
626 .Op Li ,busreqtype= Ns Ar req-type
627 .Xc
628 .Pq "TS event"
629 Count various types of transactions on the bus matching the flags set
630 in
631 .Ar qualifier
632 and
633 .Ar req-type .
634 .Pp
635 Qualifier
636 .Ar qualifier
637 is a
638 .Ql +
639 separated set of the following flags:
640 .Pp
641 .Bl -tag -width indent -compact
642 .It Li all-read
643 Count read entries.
644 .It Li all-write
645 Count write entries.
646 .It Li mem-uc
647 Count entries accessing uncacheable memory.
648 .It Li mem-wc
649 Count entries accessing write-combining memory.
650 .It Li mem-wt
651 Count entries accessing write-through memory.
652 .It Li mem-wp
653 Count entries accessing write-protected memory
654 .It Li mem-wb
655 Count entries accessing write-back memory.
656 .It Li own
657 Count store requests driven by the processor (i.e., not by other
658 processors or by DMA).
659 .It Li other
660 Count store requests driven by other processors or by DMA.
661 .It Li prefetch
662 Include hardware and software prefetch requests in the count.
663 .El
664 .Pp
665 The default value for
666 .Ar qualifier
667 is to enable all the above flags.
668 .Pp
669 The
670 .Ar req-type
671 qualifier is a 5-bit number can be additionally used to select a
672 specific bus request type.
673 The default is 0.
674 .Pp
675 The
676 .Dq Li edge
677 qualifier is normally used with this event to prevent multiple
678 counting.
679 The exact behaviour of this event depends on the processor revision.
680 .It Li p4-itlb-reference Op mask= Ns Ar qualifier
681 .Pq "TS event"
682 Count translations using the intruction translation look-aside
683 buffer.
684 The
685 .Ar qualifier
686 argument is a list of the following strings separated by
687 .Ql +
688 characters.
689 .Pp
690 .Bl -tag -width indent -compact
691 .It Li hit
692 Count ITLB hits.
693 .It Li miss
694 Count ITLB misses.
695 .It Li hit-uc
696 Count uncacheable ITLB hits.
697 .El
698 .Pp
699 If no
700 .Ar qualifier
701 is specified the default is to count all the three kinds of ITLB
702 translations.
703 .It Li p4-load-port-replay Op Li ,mask= Ns Ar qualifier
704 .Pq "TS event"
705 Count replayed events at the load port.
706 Qualifier
707 .Ar qualifier
708 can take on one value:
709 .Pp
710 .Bl -tag -width indent -compact
711 .It Li split-ld
712 Count split loads.
713 .El
714 .Pp
715 The default value for
716 .Ar qualifier
717 is
718 .Dq Li split-ld .
719 .It Li p4-mispred-branch-retired Op Li ,mask= Ns Ar flags
720 .Pq "TS event"
721 Count mispredicted IA-32 branch instructions.
722 Qualifier
723 .Ar flags
724 can take the following value (which is also the default):
725 .Pp
726 .Bl -tag -width indent -compact
727 .It Li nbogus
728 Count non-bogus retired branch instructions.
729 .El
730 .It Li p4-machine-clear Op Li ,mask= Ns Ar flags
731 .Pq "TS event"
732 Count the number of pipeline clears seen by the processor.
733 Qualifer
734 .Ar flags
735 is a list of the following strings separated by
736 .Ql +
737 characters:
738 .Pp
739 .Bl -tag -width indent -compact
740 .It Li clear
741 Count for a portion of the many cycles when the machine is being
742 cleared for any reason.
743 .It Li moclear
744 Count machine clears due to memory ordering issues.
745 .It Li smclear
746 Count machine clears due to self-modifying code.
747 .El
748 .Pp
749 Use qualifier
750 .Dq Li edge
751 to get a count of occurrences of machine clears.
752 The default qualifier is
753 .Dq Li clear .
754 .It Li p4-memory-cancel Op Li ,mask= Ns Ar event-list
755 .Pq "TS event"
756 Count the cancelling of various kinds of requests in the data cache
757 address control unit of the CPU.
758 The qualifier
759 .Ar event-list
760 is a list of the following strings separated by
761 .Ql +
762 characters:
763 .Pp
764 .Bl -tag -width indent -compact
765 .It Li st-rb-full
766 Requests cancelled because no store request buffer was available.
767 .It Li 64k-conf
768 Requests that conflict due to 64K aliasing.
769 .El
770 .Pp
771 If
772 .Ar event-list
773 is not specified, then the default is to count both kinds of events.
774 .It Li p4-memory-complete Op Li ,mask= Ns Ar event-list
775 .Pq "TS event"
776 Count the completion of load split, store split, uncacheable split and
777 uncacheable load operations selected by qualifier
778 .Ar event-list .
779 The qualifier
780 .Ar event-list
781 is a
782 .Ql +
783 separated list of the following flags:
784 .Pp
785 .Bl -tag -width indent -compact
786 .It Li lsc
787 Count load splits completed, excluding loads from uncacheable or
788 write-combining areas.
789 .It Li ssc
790 Count any split stores completed.
791 .El
792 .Pp
793 The default is to count both kinds of operations.
794 .It Li p4-mob-load-replay Op Li ,mask= Ns Ar qualifier
795 .Pq "TS event"
796 Count load replays triggered by the memory order buffer.
797 Qualifier
798 .Ar qualifier
799 can be a
800 .Ql +
801 separated list of the following flags:
802 .Pp
803 .Bl -tag -width indent -compact
804 .It Li no-sta
805 Count replays because of unknown store addresses.
806 .It Li no-std
807 Count replays because of unknown store data.
808 .It Li partial-data
809 Count replays because of partially overlapped data accesses between
810 load and store operations.
811 .It Li unalgn-addr
812 Count replays because of mismatches in the lower 4 bits of load and
813 store operations.
814 .El
815 .Pp
816 The default qualifier is
817 .Ar no-sta+no-std+partial-data+unalgn-addr .
818 .It Li p4-packed-dp-uop Op Li ,mask= Ns Ar flags
819 .Pq "TI event"
820 Count packed double-precision uops.
821 Qualifier
822 .Ar flags
823 can take the following value (which is also the default):
824 .Pp
825 .Bl -tag -width indent -compact
826 .It Li all
827 Count all uops operating on packed double-precision operands.
828 .El
829 .It Li p4-packed-sp-uop Op Li ,mask= Ns Ar flags
830 .Pq "TI event"
831 Count packed single-precision uops.
832 Qualifier
833 .Ar flags
834 can take the following value (which is also the default):
835 .Pp
836 .Bl -tag -width indent -compact
837 .It Li all
838 Count all uops operating on packed single-precision operands.
839 .El
840 .It Li p4-page-walk-type Op Li ,mask= Ns Ar qualifier
841 .Pq "TI event"
842 Count page walks performed by the page miss handler.
843 Qualifier
844 .Ar qualifier
845 can be a
846 .Ql +
847 separated list of the following keywords:
848 .Pp
849 .Bl -tag -width indent -compact
850 .It Li dtmiss
851 Count page walks for data TLB misses.
852 .It Li itmiss
853 Count page walks for instruction TLB misses.
854 .El
855 .Pp
856 The default value for
857 .Ar qualifier
858 is
859 .Dq Li dtmiss+itmiss .
860 .It Li p4-replay-event Op Li ,mask= Ns Ar flags
861 .Pq "TS event"
862 Count the retirement of tagged uops selected through the replay
863 tagging mechanism.
864 Qualifier
865 .Ar flags
866 contains a
867 .Ql +
868 separated set of the following strings:
869 .Pp
870 .Bl -tag -width indent -compact
871 .It Li nbogus
872 The marked uops are not bogus.
873 .It Li bogus
874 The marked uops are bogus.
875 .El
876 .Pp
877 This event requires additional (upstream) events to be allocated to
878 perform the desired uop tagging.
879 The default qualifier counts both kinds of uops.
880 This event can be used for precise event based sampling.
881 .It Li p4-resource-stall Op Li ,mask= Ns Ar flags
882 .Pq "TS event"
883 Count the occurrence or latency of stalls in the allocator.
884 Qualifier
885 .Ar flags
886 can take the following value (which is also the default):
887 .Pp
888 .Bl -tag -width indent -compact
889 .It Li sbfull
890 A stall due to the lack of store buffers.
891 .El
892 .It Li p4-response
893 .Pq "TI event"
894 Count different types of responses.
895 Further documentation on this event is not available.
896 .It Li p4-retired-branch-type Op Li ,mask= Ns Ar flags
897 .Pq "TS event"
898 Count branches retired.
899 Qualifier
900 .Ar flags
901 contains a
902 .Ql +
903 separated list of strings:
904 .Pp
905 .Bl -tag -width indent -compact
906 .It Li conditional
907 Count conditional jumps.
908 .It Li call
909 Count direct and indirect call branches.
910 .It Li return
911 Count return branches.
912 .It Li indirect
913 Count returns, indirect calls or indirect jumps.
914 .El
915 .Pp
916 The default qualifier counts all the above branch types.
917 .It Li p4-retired-mispred-branch-type Op Li ,mask= Ns Ar flags
918 .Pq "TS event"
919 Count mispredicted branches retired.
920 Qualifier
921 .Ar flags
922 contains a
923 .Ql +
924 separated list of strings:
925 .Pp
926 .Bl -tag -width indent -compact
927 .It Li conditional
928 Count conditional jumps.
929 .It Li call
930 Count indirect call branches.
931 .It Li return
932 Count return branches.
933 .It Li indirect
934 Count returns, indirect calls or indirect jumps.
935 .El
936 .Pp
937 The default qualifier counts all the above branch types.
938 .It Li p4-scalar-dp-uop Op Li ,mask= Ns Ar flags
939 .Pq "TI event"
940 Count the number of scalar double-precision uops.
941 Qualifier
942 .Ar flags
943 can take the following value (which is also the default):
944 .Pp
945 .Bl -tag -width indent -compact
946 .It Li all
947 Count the number of scalar double-precision uops.
948 .El
949 .It Li p4-scalar-sp-uop Op Li ,mask= Ns Ar flags
950 .Pq "TI event"
951 Count the number of scalar single-precision uops.
952 Qualifier
953 .Ar flags
954 can take the following value (which is also the default):
955 .Pp
956 .Bl -tag -width indent -compact
957 .It Li all
958 Count all uops operating on scalar single-precision operands.
959 .El
960 .It Li p4-snoop
961 .Pq "TI event"
962 Count snoop traffic.
963 Further documentation on this event is not available.
964 .It Li p4-sse-input-assist Op Li ,mask= Ns Ar flags
965 .Pq "TI event"
966 Count the number of times an assist is required to handle problems
967 with the operands for SSE and SSE2 operations.
968 Qualifier
969 .Ar flags
970 can take the following value (which is also the default):
971 .Pp
972 .Bl -tag -width indent -compact
973 .It Li all
974 Count assists for all SSE and SSE2 uops.
975 .El
976 .It Li p4-store-port-replay Op Li ,mask= Ns Ar qualifier
977 .Pq "TS event"
978 Count events replayed at the store port.
979 Qualifier
980 .Ar qualifier
981 can take on one value:
982 .Pp
983 .Bl -tag -width indent -compact
984 .It Li split-st
985 Count split stores.
986 .El
987 .Pp
988 The default value for
989 .Ar qualifier
990 is
991 .Dq Li split-st .
992 .It Li p4-tc-deliver-mode Op Li ,mask= Ns Ar qualifier
993 .Pq "TI event"
994 Count the duration in cycles of operating modes of the trace cache and
995 decode engine.
996 The desired operating mode is selected by
997 .Ar qualifier ,
998 which is a list of the following strings separated by
999 .Ql +
1000 characters:
1001 .Pp
1002 .Bl -tag -width indent -compact
1003 .It Li DD
1004 Both logical processors are in deliver mode.
1005 .It Li DB
1006 Logical processor 0 is in deliver mode while logical processor 1 is in
1007 build mode.
1008 .It Li DI
1009 Logical processor 0 is in deliver mode while logical processor 1 is
1010 halted, or in machine clear, or transitioning to a long microcode
1011 flow.
1012 .It Li BD
1013 Logical processor 0 is in build mode while logical processor 1 is in
1014 deliver mode.
1015 .It Li BB
1016 Both logical processors are in build mode.
1017 .It Li BI
1018 Logical processor 0 is in build mode while logical processor 1 is
1019 halted, or in machine clear or transitioning to a long microcode
1020 flow.
1021 .It Li ID
1022 Logical processor 0 is halted, or in machine clear or transitioning to
1023 a long microcode flow while logical processor 1 is in deliver mode.
1024 .It Li IB
1025 Logical processor 0 is halted, or in machine clear or transitioning to
1026 a long microcode flow while logical processor 1 is in build mode.
1027 .El
1028 .Pp
1029 If there is only one logical processor in the processor package then
1030 the qualifier for logical processor 1 is ignored.
1031 If no qualifier is specified, the default qualifier is
1032 .Dq Li DD+DB+DI+BD+BB+BI+ID+IB .
1033 .It Li p4-tc-ms-xfer Op Li ,mask= Ns Ar flags
1034 .Pq "TI event"
1035 Count the number of times uop delivery changed from the trace cache to
1036 MS ROM.
1037 Qualifier
1038 .Ar flags
1039 can take the following value (which is also the default):
1040 .Pp
1041 .Bl -tag -width indent -compact
1042 .It Li cisc
1043 Count TC to MS transfers.
1044 .El
1045 .It Li p4-uop-queue-writes Op Li ,mask= Ns Ar flags
1046 .Pq "TS event"
1047 Count the number of valid uops written to the uop queue.
1048 Qualifier
1049 .Ar flags
1050 is a list of the following strings, separated by
1051 .Ql +
1052 characters:
1053 .Pp
1054 .Bl -tag -width indent -compact
1055 .It Li from-tc-build
1056 Count uops being written from the trace cache in build mode.
1057 .It Li from-tc-deliver
1058 Count uops being written from the trace cache in deliver mode.
1059 .It Li from-rom
1060 Count uops being written from microcode ROM.
1061 .El
1062 .Pp
1063 The default qualifier counts all the above kinds of uops.
1064 .It Li p4-uop-type Op Li ,mask= Ns Ar flags
1065 .Pq "TS event"
1066 This event is used in conjunction with the front-end at-retirement
1067 mechanism to tag load and store uops.
1068 Qualifer
1069 .Ar flags
1070 comprises the following strings separated by
1071 .Ql +
1072 characters:
1073 .Pp
1074 .Bl -tag -width indent -compact
1075 .It Li tagloads
1076 Mark uops that are load operations.
1077 .It Li tagstores
1078 Mark uops that are store operations.
1079 .El
1080 .Pp
1081 The default qualifier counts both kinds of uops.
1082 .It Li p4-uops-retired Op Li ,mask= Ns Ar flags
1083 .Pq "TS event"
1084 Count uops retired during a clock cycle.
1085 Qualifier
1086 .Ar flags
1087 comprises the following strings separated by
1088 .Ql +
1089 characters:
1090 .Pp
1091 .Bl -tag -width indent -compact
1092 .It Li nbogus
1093 Count marked uops that are not bogus.
1094 .It Li bogus
1095 Count marked uops that are bogus.
1096 .El
1097 .Pp
1098 The default qualifier counts both kinds of uops.
1099 .It Li p4-wc-buffer Op Li ,mask= Ns Ar flags
1100 .Pq "TI event"
1101 Count write-combining buffer operations.
1102 Qualifier
1103 .Ar flags
1104 contains the following strings separated by
1105 .Ql +
1106 characters:
1107 .Pp
1108 .Bl -tag -width indent -compact
1109 .It Li wcb-evicts
1110 WC buffer evictions due to any cause.
1111 .It Li wcb-full-evict
1112 WC buffer evictions due to no WC buffer being available.
1113 .El
1114 .Pp
1115 The default qualifer counts both kinds of evictions.
1116 .It Li p4-x87-assist Op Li ,mask= Ns Ar flags
1117 .Pq "TS event"
1118 Count the retirement of x87 instructions that required special
1119 handling.
1120 Qualifier
1121 .Ar flags
1122 contains the following strings separated by
1123 .Ql +
1124 characters:
1125 .Pp
1126 .Bl -tag -width indent -compact
1127 .It Li fpsu
1128 Count instructions that saw an FP stack underflow.
1129 .It Li fpso
1130 Count instructions that saw an FP stack overflow.
1131 .It Li poao
1132 Count instructions that saw an x87 output overflow.
1133 .It Li poau
1134 Count instructions that saw an x87 output underflow.
1135 .It Li prea
1136 Count instructions that needed an x87 input assist.
1137 .El
1138 .Pp
1139 The default qualifier counts all the above types of instruction
1140 retirements.
1141 .It Li p4-x87-fp-uop Op Li ,mask= Ns Ar flags
1142 .Pq "TI event"
1143 Count x87 floating-point uops.
1144 Qualifier
1145 .Ar flags
1146 can take the following value (which is also the default):
1147 .Pp
1148 .Bl -tag -width indent -compact
1149 .It Li all
1150 Count all x87 floating-point uops.
1151 .El
1152 .Pp
1153 If an instruction contains more than one x87 floating-point uops, then
1154 all x87 floating-point uops will be counted.
1155 This event does not count x87 floating-point data movement operations.
1156 .It Li p4-x87-simd-moves-uop Op Li ,mask= Ns Ar flags
1157 .Pq "TI event"
1158 Count each x87 FPU, MMX, SSE, or SSE2 uops that load data or store
1159 data or perform register-to-register moves.
1160 This event does not count integer move uops.
1161 Qualifier
1162 .Ar flags
1163 may contain the following keywords separated by
1164 .Ql +
1165 characters:
1166 .Pp
1167 .Bl -tag -width indent -compact
1168 .It Li allp0
1169 Count all x87 and SIMD store and move uops.
1170 .It Li allp2
1171 Count all x87 and SIMD load uops.
1172 .El
1173 .Pp
1174 The default is to count all uops.
1175 .Pq Errata
1176 This event may be affected by processor errata N43.
1177 .El
1178 .Ss "Cascading P4 PMCs"
1179 PMC cascading support is currently poorly implemented.
1180 While individual event counters may be allocated with a
1181 .Dq Li cascade
1182 qualifier, the current API does not offer the ability
1183 to name and allocate all the resources needed for a
1184 cascaded event counter pair in a single operation.
1185 .Ss "Precise Event Based Sampling"
1186 Support for precise event based sampling is currently
1187 unimplemented.
1188 .Ss Event Name Aliases
1189 The following table shows the mapping between the PMC-independent
1190 aliases supported by
1191 .Lb libpmc
1192 and the underlying hardware events used.
1193 .Bl -column "branch-mispredicts" "Description"
1194 .It Em Alias Ta Em Event
1195 .It Li branches Ta Li p4-branch-retired,mask=mmtp+mmtm
1196 .It Li branch-mispredicts Ta Li p4-mispred-branch-retired
1197 .It Li dc-misses Ta (unsupported)
1198 .It Li ic-misses Ta (unsupported)
1199 .It Li instructions Ta Li p4-instr-retired,mask=nbogusntag+nbogustag
1200 .It Li interrupts Ta Li (unsupported)
1201 .It Li unhalted-cycles Ta Li p4-global-power-events
1202 .El
1203 .Sh SEE ALSO
1204 .Xr pmc 3 ,
1205 .Xr pmc.atom 3 ,
1206 .Xr pmc.core 3 ,
1207 .Xr pmc.core2 3 ,
1208 .Xr pmc.iaf 3 ,
1209 .Xr pmc.k7 3 ,
1210 .Xr pmc.k8 3 ,
1211 .Xr pmc.p5 3 ,
1212 .Xr pmc.p6 3 ,
1213 .Xr pmc.tsc 3 ,
1214 .Xr pmclog 3 ,
1215 .Xr hwpmc 4
1216 .Sh HISTORY
1217 The
1218 .Nm pmc
1219 library first appeared in
1220 .Fx 6.0 .
1221 .Sh AUTHORS
1222 The
1223 .Lb libpmc
1224 library was written by
1225 .An "Joseph Koshy"
1226 .Aq jkoshy@FreeBSD.org .