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