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