summaryrefslogtreecommitdiffstats
path: root/lib/libpmc/pmc.3
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>2005-05-01 14:11:49 +0000
committerjkoshy <jkoshy@FreeBSD.org>2005-05-01 14:11:49 +0000
commita21392e3accd60fd407365553a29a3b7250316cc (patch)
tree1e7573a97fa735d4770310305b9ec83d8767f4a7 /lib/libpmc/pmc.3
parent88ecd82ce992dc5add7c7c4e8a56fd3c6fed65a3 (diff)
downloadFreeBSD-src-a21392e3accd60fd407365553a29a3b7250316cc.zip
FreeBSD-src-a21392e3accd60fd407365553a29a3b7250316cc.tar.gz
Add convenience APIs pmc_width() and pmc_capabilities() to -lpmc.
Have pmcstat(8) and pmccontrol(8) use these APIs. Return PMC class-related constants (PMC widths and capabilities) with the OP GETCPUINFO call leaving OP PMCINFO to return only the dynamic information associated with a PMC (i.e., whether enabled, owner pid, reload count etc.). Allow pmc_read() (i.e., OPS PMCRW) on active self-attached PMCs to get upto-date values from hardware since we can guarantee that the hardware is running the correct PMC at the time of the call. Bug fixes: - (x86 class processors) Fix a bug that prevented an RDPMC instruction from being recognized as permitted till after the attached process had context switched out and back in again after a pmc_start() call. Tighten the rules for using RDPMC class instructions: a GETMSR OP is now allowed only after an OP ATTACH has been done by the PMC's owner to itself. OP GETMSR is not allowed for PMCs that track descendants, for PMCs attached to processes other than their owner processes. - (P4/HTT processors only) Fix a bug that caused the MI and MD layers to get out of sync. Add a new MD operation 'get_config()' as part of this fix. - Allow multiple system-mode PMCs at the same row-index but on different CPUs to be allocated. - Reject allocation of an administratively disabled PMC. Misc. code cleanups and refactoring. Improve a few comments.
Diffstat (limited to 'lib/libpmc/pmc.3')
-rw-r--r--lib/libpmc/pmc.324
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/libpmc/pmc.3 b/lib/libpmc/pmc.3
index aed6735..0612ce7 100644
--- a/lib/libpmc/pmc.3
+++ b/lib/libpmc/pmc.3
@@ -29,6 +29,7 @@
.Sh NAME
.Nm pmc_allocate ,
.Nm pmc_attach ,
+.Nm pmc_capabilities ,
.Nm pmc_configure_logfile ,
.Nm pmc_cpuinfo ,
.Nm pmc_detach ,
@@ -53,6 +54,7 @@
.Nm pmc_start ,
.Nm pmc_stop ,
.Nm pmc_write ,
+.Nm pmc_width ,
.Nm pmc_x86_get_msr
.Nd programming API for using hardware performance monitoring counters
.Sh LIBRARY
@@ -73,6 +75,8 @@
.Fa "pid_t pid"
.Fc
.Ft int
+.Fn pmc_capabilities "pmc_id_t pmc" "uint32_t *caps"
+.Ft int
.Fn pmc_configure_logfile "int fd"
.Ft int
.Fn pmc_cpuinfo "const struct pmc_op_getcpuinfo **cpu_info"
@@ -130,6 +134,8 @@
.Ft int
.Fn pmc_write "pmc_id_t pmc" "pmc_value_t value"
.Ft int
+.Fn pmc_width "pmc_id_t pmc" "uint32_t *width"
+.Ft int
.Fn pmc_x86_get_msr "int pmc" "uint32_t *msr"
.Sh DESCRIPTION
These functions implement a high-level library for using the
@@ -252,6 +258,20 @@ the allocated PMC.
The read and write operation may be combined using
.Fn pmc_rw .
.Pp
+The function
+.Fn pmc_capabilities
+sets argument
+.Fa caps
+to a bitmask of capabilities supported by the PMC denoted by
+argument
+.Fa pmc .
+The function
+.Fn pmc_width
+sets argument
+.Fa width
+to the width of the PMC denoted by argument
+.Fa pmc .
+.Pp
The
.Fn pmc_configure_logfile
function causes the
@@ -3011,13 +3031,15 @@ library.
.El
.Pp
A call to
+.Fn pmc_capabilities ,
.Fn pmc_name_of_capability ,
.Fn pmc_name_of_disposition ,
.Fn pmc_name_of_state ,
.Fn pmc_name_of_event ,
.Fn pmc_name_of_mode
-and
.Fn pmc_name_of_class
+and
+.Fn pmc_width
may fail with the following error:
.Bl -tag -width Er
.It Bq Er EINVAL
OpenPOWER on IntegriCloud