xref: /freebsd/lib/libpmc/pmc_disable.3 (revision 2b15cb3d0922bd70ea592f0da9b4a5b167f4d53f)
1.\" Copyright (c) 2007-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 September 22, 2008
27.Dt PMC_ENABLE 3
28.Os
29.Sh NAME
30.Nm pmc_disable ,
31.Nm pmc_enable
32.Nd administrative control of hardware performance counters
33.Sh LIBRARY
34.Lb libpmc
35.Sh SYNOPSIS
36.In pmc.h
37.Ft int
38.Fn pmc_disable "int cpu" "int pmc"
39.Ft int
40.Fn pmc_enable "int cpu" "int pmc"
41.Sh DESCRIPTION
42These functions allow specific hardware performance monitoring
43counters in a system to be disabled and enabled administratively.
44The hardware performance counters available on each CPU are numbered
45using small non-negative integers, in a system dependent manner.
46Disabled counters will not be available to applications for use.
47.Pp
48The invoking process needs to have the
49.Dv PRIV_PMC_MANAGE
50privilege to perform these operations.
51.Pp
52Function
53.Fn pmc_disable
54disables the hardware counter numbered by argument
55.Fa pmc
56on CPU number
57.Fa cpu .
58.Pp
59Function
60.Fn pmc_enable
61enables the hardware counter numbered by argument
62.Fa pmc
63on CPU number
64.Fa cpu .
65.Sh IMPLEMENTATION NOTES
66Hardware PMCs that are currently in use by applications cannot be
67disabled.
68Allocation of a process scope software PMC marks all
69hardware PMCs in the system with the same pmc number as being in-use.
70.Sh RETURN VALUES
71.Rv -std
72.Sh ERRORS
73A call to these functions may fail with the following errors:
74.Bl -tag -width Er
75.It Bq Er EBUSY
76Function
77.Fn pmc_disable
78specified a hardware PMC is currently in use.
79.It Bq Er EINVAL
80Arguments
81.Fa cpu
82or
83.Fa pmc
84were invalid.
85.It Bq Er ENXIO
86Argument
87.Fa cpu
88specified a disabled or absent CPU.
89.It Bq Er EPERM
90The current process lacks sufficient privilege to perform this
91operation.
92.El
93.Sh SEE ALSO
94.Xr pmc 3 ,
95.Xr pmc_cpuinfo 3 ,
96.Xr pmc_pmcinfo 3 ,
97.Xr hwpmc 4 ,
98.Xr pmccontrol 8 ,
99.Xr priv_check 9
100