PMC_ENABLE(3)
π NAME π
Okay so welcome to the PMC_ENABLE(3) page from the Library Functions Manual, bestie β this is the whole administrative control of hardware performance counters situation.
pmc_disable, pmc_enable β administrative control of hardware performance counters π
π LIBRARY π
Performance Counters Library (libpmc, -lpmc) β¨
πΈ SYNOPSIS πΈ
#include <pmc.h>
int
pmc_disable(int cpu, int pmc);
int
pmc_enable(int cpu, int pmc);
π¦ DESCRIPTION π¦
These functions let you disable and enable specific hardware performance monitoring counters in a system administratively β like, you're doing admin things to the counters, no cap.
The hardware performance counters available on each CPU are numbered using small non-negative integers, in a system dependent manner. Disabled counters will not be available to applications for use β periodt, they're off the menu π.
The invoking process needs to have the PRIV_PMC_MANAGE privilege to perform these operations. No privilege, no counter management β them's the rules π₯.
Function pmc_disable() disables the hardware counter numbered by argument pmc on CPU number cpu.
Function pmc_enable() enables the hardware counter numbered by argument pmc on CPU number cpu.
π§ IMPLEMENTATION NOTES π§
Heads up, bestie: hardware PMCs that are currently in use by applications cannot be disabled.
Allocation of a process scope software PMC marks all hardware PMCs in the system with the same pmc number as being in-use. So yeah, that's a whole vibe check for the counters π.
π«Ά RETURN VALUES π«Ά
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error. Slay when it's zero, sigh when it's minus one π.
π ERRORS π
A call to these functions may fail with the following errors:
[EBUSY]β Functionpmc_disable()specified a hardware PMC that is currently in use.[EINVAL]β Argumentscpuorpmcwere invalid.[ENXIO]β Argumentcpuspecified a disabled or absent CPU.[EPERM]β The current process lacks sufficient privilege to perform this operation.
π₯ SEE ALSO π₯
Go peek at these, iykyk: pmc(3), pmc_cpuinfo(3), pmc_pmcinfo(3), hwpmc(4), pmccontrol(8), priv_check(9) π¦β¨
And that's the tea β: this is the Debian edition, dated September 22, 2008, for PMC_ENABLE(3) β stay iconic and keep those counters handled, bestie ππ«Άπ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2007-2008 Joseph Koshy. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms