| PCTR(1) | General Commands Manual | PCTR(1) |
pctr — display CPU
performance counters
pctr |
[-AEeIiklMSu] [-f
funct] [-m
umask] [-s
ctr] [-t
thold] |
The pctr program is a sample
implementation of how to access the
pctr(4) pseudo device available on
many i386 and amd64 compatible machines.
By default, the pctr command displays the
current values of the TSC and any vendor specific counter registers.
The options are as follows:
-A-E-e-f
funct-s option.-I-i-k-k or -u options is
mandatory.-l-M-m
umask-f option.-S-s
ctr-f option. A list of all possible
functions supported on the current processor can be obtained by the
-l option output.-t
thold-u-k or -u options is
mandatory.The following command, executed from the command line, will set the first performance counter to count the number of cacheable L1 data cache reads in user and kernel modes on an Intel Core2 Duo processor:
# pctr -s 0 -f 40 -uk -MESI
To reset the counter run the following command:
# pctr -s 0 -f 0
OS and Kernel Developer's Guide for AMD NPT Family 0Fh Processors.
Intel 64 and IA-32 Architectures Software Developer's Manual. Volume 3B: System Programming Guide, Part 2. Appendix A: Performance Monitoring Events.
The pctr program appeared in
OpenBSD 2.0 but was subsequently rewritten in
OpenBSD 4.3.
It is strongly advised to look through the manual for a particular processor before programming a counter and interpreting the results.
| July 8, 2008 | openbsd |