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