xref: /freebsd/lib/libpmc/pmc_disable.3 (revision 6455febbea8a62a96b963e613f3f5c1dcec39030)
16455febbSJoseph Koshy.\" Copyright (c) 2007-2008 Joseph Koshy.  All rights reserved.
21ddf079eSJoseph Koshy.\"
31ddf079eSJoseph Koshy.\" Redistribution and use in source and binary forms, with or without
41ddf079eSJoseph Koshy.\" modification, are permitted provided that the following conditions
51ddf079eSJoseph Koshy.\" are met:
61ddf079eSJoseph Koshy.\" 1. Redistributions of source code must retain the above copyright
71ddf079eSJoseph Koshy.\"    notice, this list of conditions and the following disclaimer.
81ddf079eSJoseph Koshy.\" 2. Redistributions in binary form must reproduce the above copyright
91ddf079eSJoseph Koshy.\"    notice, this list of conditions and the following disclaimer in the
101ddf079eSJoseph Koshy.\"    documentation and/or other materials provided with the distribution.
111ddf079eSJoseph Koshy.\"
121ddf079eSJoseph Koshy.\" This software is provided by Joseph Koshy ``as is'' and
131ddf079eSJoseph Koshy.\" any express or implied warranties, including, but not limited to, the
141ddf079eSJoseph Koshy.\" implied warranties of merchantability and fitness for a particular purpose
151ddf079eSJoseph Koshy.\" are disclaimed.  in no event shall Joseph Koshy be liable
161ddf079eSJoseph Koshy.\" for any direct, indirect, incidental, special, exemplary, or consequential
171ddf079eSJoseph Koshy.\" damages (including, but not limited to, procurement of substitute goods
181ddf079eSJoseph Koshy.\" or services; loss of use, data, or profits; or business interruption)
191ddf079eSJoseph Koshy.\" however caused and on any theory of liability, whether in contract, strict
201ddf079eSJoseph Koshy.\" liability, or tort (including negligence or otherwise) arising in any way
211ddf079eSJoseph Koshy.\" out of the use of this software, even if advised of the possibility of
221ddf079eSJoseph Koshy.\" such damage.
231ddf079eSJoseph Koshy.\"
241ddf079eSJoseph Koshy.\" $FreeBSD$
251ddf079eSJoseph Koshy.\"
266455febbSJoseph Koshy.Dd September 22, 2008
271ddf079eSJoseph Koshy.Os
281ddf079eSJoseph Koshy.Dt PMC_ENABLE 3
291ddf079eSJoseph Koshy.Sh NAME
301ddf079eSJoseph Koshy.Nm pmc_disable ,
311ddf079eSJoseph Koshy.Nm pmc_enable
321ddf079eSJoseph Koshy.Nd administrative control of hardware performance counters
331ddf079eSJoseph Koshy.Sh LIBRARY
341ddf079eSJoseph Koshy.Lb libpmc
351ddf079eSJoseph Koshy.Sh SYNOPSIS
361ddf079eSJoseph Koshy.In pmc.h
371ddf079eSJoseph Koshy.Ft int
381ddf079eSJoseph Koshy.Fn pmc_disable "int cpu" "int pmc"
391ddf079eSJoseph Koshy.Ft int
401ddf079eSJoseph Koshy.Fn pmc_enable "int cpu" "int pmc"
411ddf079eSJoseph Koshy.Sh DESCRIPTION
421ddf079eSJoseph KoshyThese functions allow specific hardware performance monitoring
431ddf079eSJoseph Koshycounters in a system to be disabled and enabled administratively.
441ddf079eSJoseph KoshyThe hardware performance counters available on each CPU are numbered
451ddf079eSJoseph Koshyusing small non-negative integers, in a system dependent manner.
461ddf079eSJoseph KoshyDisabled counters will not be available to applications for use.
471ddf079eSJoseph Koshy.Pp
481ddf079eSJoseph KoshyThe invoking process needs to have the
491ddf079eSJoseph Koshy.Dv PRIV_PMC_MANAGE
501ddf079eSJoseph Koshyprivilege to perform these operations.
511ddf079eSJoseph Koshy.Pp
521ddf079eSJoseph KoshyFunction
531ddf079eSJoseph Koshy.Fn pmc_disable
541ddf079eSJoseph Koshydisables the hardware counter numbered by argument
551ddf079eSJoseph Koshy.Fa pmc
561ddf079eSJoseph Koshyon CPU number
571ddf079eSJoseph Koshy.Fa cpu .
581ddf079eSJoseph Koshy.Pp
591ddf079eSJoseph KoshyFunction
601ddf079eSJoseph Koshy.Fn pmc_enable
611ddf079eSJoseph Koshyenables the hardware counter numbered by argument
621ddf079eSJoseph Koshy.Fa pmc
631ddf079eSJoseph Koshyon CPU number
641ddf079eSJoseph Koshy.Fa cpu .
651ddf079eSJoseph Koshy.Sh IMPLEMENTATION NOTES
661ddf079eSJoseph KoshyHardware PMCs that are currently in use by applications cannot be
671ddf079eSJoseph Koshydisabled.
681ddf079eSJoseph KoshyAllocation of a process scope software PMC marks all
691ddf079eSJoseph Koshyhardware PMCs in the system with the same pmc number as being in-use.
701ddf079eSJoseph Koshy.Sh RETURN VALUES
711ddf079eSJoseph Koshy.Rv -std
721ddf079eSJoseph Koshy.Sh ERRORS
731ddf079eSJoseph KoshyA call to these functions may fail with the following errors:
741ddf079eSJoseph Koshy.Bl -tag -width Er
751ddf079eSJoseph Koshy.It Bq Er EBUSY
761ddf079eSJoseph KoshyFunction
771ddf079eSJoseph Koshy.Fn pmc_disable
781ddf079eSJoseph Koshyspecified a hardware PMC is currently in use.
791ddf079eSJoseph Koshy.It Bq Er EINVAL
801ddf079eSJoseph KoshyArguments
811ddf079eSJoseph Koshy.Fa cpu
821ddf079eSJoseph Koshyor
831ddf079eSJoseph Koshy.Fa pmc
841ddf079eSJoseph Koshywere invalid.
851ddf079eSJoseph Koshy.It Bq Er ENXIO
861ddf079eSJoseph KoshyArgument
871ddf079eSJoseph Koshy.Fa cpu
886455febbSJoseph Koshyspecified a disabled or absent CPU.
891ddf079eSJoseph Koshy.It Bq Er EPERM
901ddf079eSJoseph KoshyThe current process lacks sufficient privilege to perform this
911ddf079eSJoseph Koshyoperation.
921ddf079eSJoseph Koshy.El
931ddf079eSJoseph Koshy.Sh SEE ALSO
941ddf079eSJoseph Koshy.Xr pmc 3 ,
951ddf079eSJoseph Koshy.Xr pmc_cpuinfo 3 ,
961ddf079eSJoseph Koshy.Xr pmc_pmcinfo 3 ,
971ddf079eSJoseph Koshy.Xr hwpmc 4 ,
981ddf079eSJoseph Koshy.Xr pmccontrol 8 ,
991ddf079eSJoseph Koshy.Xr priv_check 9
100