1.\" Copyright (c) 2007 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 Joseph Koshy ``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 Joseph Koshy 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 November 20, 2007 27.Os 28.Dt PMC_ENABLE 3 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 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