PMC_ENABLE(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’– 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] β€” Function pmc_disable() specified a hardware PMC that is currently in use.
  • [EINVAL] β€” Arguments cpu or pmc were invalid.
  • [ENXIO] β€” Argument cpu specified 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