xref: /freebsd/lib/libpmc/pmc_disable.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
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.\"
12*026dbd29SChristian Brueffer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13*026dbd29SChristian Brueffer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14*026dbd29SChristian Brueffer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15*026dbd29SChristian Brueffer.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16*026dbd29SChristian Brueffer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17*026dbd29SChristian Brueffer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18*026dbd29SChristian Brueffer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19*026dbd29SChristian Brueffer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20*026dbd29SChristian Brueffer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21*026dbd29SChristian Brueffer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22*026dbd29SChristian Brueffer.\" SUCH DAMAGE.
231ddf079eSJoseph Koshy.\"
246455febbSJoseph Koshy.Dd September 22, 2008
251ddf079eSJoseph Koshy.Dt PMC_ENABLE 3
26aa12cea2SUlrich Spörlein.Os
271ddf079eSJoseph Koshy.Sh NAME
281ddf079eSJoseph Koshy.Nm pmc_disable ,
291ddf079eSJoseph Koshy.Nm pmc_enable
301ddf079eSJoseph Koshy.Nd administrative control of hardware performance counters
311ddf079eSJoseph Koshy.Sh LIBRARY
321ddf079eSJoseph Koshy.Lb libpmc
331ddf079eSJoseph Koshy.Sh SYNOPSIS
341ddf079eSJoseph Koshy.In pmc.h
351ddf079eSJoseph Koshy.Ft int
361ddf079eSJoseph Koshy.Fn pmc_disable "int cpu" "int pmc"
371ddf079eSJoseph Koshy.Ft int
381ddf079eSJoseph Koshy.Fn pmc_enable "int cpu" "int pmc"
391ddf079eSJoseph Koshy.Sh DESCRIPTION
401ddf079eSJoseph KoshyThese functions allow specific hardware performance monitoring
411ddf079eSJoseph Koshycounters in a system to be disabled and enabled administratively.
421ddf079eSJoseph KoshyThe hardware performance counters available on each CPU are numbered
431ddf079eSJoseph Koshyusing small non-negative integers, in a system dependent manner.
441ddf079eSJoseph KoshyDisabled counters will not be available to applications for use.
451ddf079eSJoseph Koshy.Pp
461ddf079eSJoseph KoshyThe invoking process needs to have the
471ddf079eSJoseph Koshy.Dv PRIV_PMC_MANAGE
481ddf079eSJoseph Koshyprivilege to perform these operations.
491ddf079eSJoseph Koshy.Pp
501ddf079eSJoseph KoshyFunction
511ddf079eSJoseph Koshy.Fn pmc_disable
521ddf079eSJoseph Koshydisables the hardware counter numbered by argument
531ddf079eSJoseph Koshy.Fa pmc
541ddf079eSJoseph Koshyon CPU number
551ddf079eSJoseph Koshy.Fa cpu .
561ddf079eSJoseph Koshy.Pp
571ddf079eSJoseph KoshyFunction
581ddf079eSJoseph Koshy.Fn pmc_enable
591ddf079eSJoseph Koshyenables the hardware counter numbered by argument
601ddf079eSJoseph Koshy.Fa pmc
611ddf079eSJoseph Koshyon CPU number
621ddf079eSJoseph Koshy.Fa cpu .
631ddf079eSJoseph Koshy.Sh IMPLEMENTATION NOTES
641ddf079eSJoseph KoshyHardware PMCs that are currently in use by applications cannot be
651ddf079eSJoseph Koshydisabled.
661ddf079eSJoseph KoshyAllocation of a process scope software PMC marks all
671ddf079eSJoseph Koshyhardware PMCs in the system with the same pmc number as being in-use.
681ddf079eSJoseph Koshy.Sh RETURN VALUES
691ddf079eSJoseph Koshy.Rv -std
701ddf079eSJoseph Koshy.Sh ERRORS
711ddf079eSJoseph KoshyA call to these functions may fail with the following errors:
721ddf079eSJoseph Koshy.Bl -tag -width Er
731ddf079eSJoseph Koshy.It Bq Er EBUSY
741ddf079eSJoseph KoshyFunction
751ddf079eSJoseph Koshy.Fn pmc_disable
761ddf079eSJoseph Koshyspecified a hardware PMC is currently in use.
771ddf079eSJoseph Koshy.It Bq Er EINVAL
781ddf079eSJoseph KoshyArguments
791ddf079eSJoseph Koshy.Fa cpu
801ddf079eSJoseph Koshyor
811ddf079eSJoseph Koshy.Fa pmc
821ddf079eSJoseph Koshywere invalid.
831ddf079eSJoseph Koshy.It Bq Er ENXIO
841ddf079eSJoseph KoshyArgument
851ddf079eSJoseph Koshy.Fa cpu
866455febbSJoseph Koshyspecified a disabled or absent CPU.
871ddf079eSJoseph Koshy.It Bq Er EPERM
881ddf079eSJoseph KoshyThe current process lacks sufficient privilege to perform this
891ddf079eSJoseph Koshyoperation.
901ddf079eSJoseph Koshy.El
911ddf079eSJoseph Koshy.Sh SEE ALSO
921ddf079eSJoseph Koshy.Xr pmc 3 ,
931ddf079eSJoseph Koshy.Xr pmc_cpuinfo 3 ,
941ddf079eSJoseph Koshy.Xr pmc_pmcinfo 3 ,
951ddf079eSJoseph Koshy.Xr hwpmc 4 ,
961ddf079eSJoseph Koshy.Xr pmccontrol 8 ,
971ddf079eSJoseph Koshy.Xr priv_check 9
98