PMC_SET(3)

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

πŸ’… NAME πŸ’…

okay so bestie, meet pmc_set(3) β€” the function that sets the reload count of a sampling PMC. Yes, we’re starting with the manual name folded right in, because we’re cute and organized 🫢. This one lives in the Performance Counters Library, so let’s get into it.

πŸŽ€ LIBRARY πŸŽ€

Performance Counters Library (libpmc, -lpmc) ✨. That’s the whole vibe β€” link it and you’re in.

✨ SYNOPSIS ✨

#include <pmc.h>

int
pmc_set(pmc_id_t pmc, pmc_value_t value);

🌸 DESCRIPTION 🌸

Function pmc_set() is used to set the reload value of sampling PMCs. πŸ’–

Argument pmc specifies the handle for a sampling-mode PMC you previously allocated. Argument value specifies the reload count. No cap.

Sampling PMCs will interrupt the CPU after the number of hardware events specified by the reload count are seen. 🚨 After the sampling interrupt is processed, the underlying hardware will be reloaded with the specified count, and the hardware is automatically restarted by hwpmc(4). That’s the little loop-de-loop, iykyk.

Function pmc_set() should be called on a PMC in a quiescent state. 🌿

Bestie, lowkey do not skip the quiescent-state part β€” the page says it should be called that way.

πŸ’œ RETURN VALUES πŸ’œ

The pmc_set() function returns the value 0 if successful. Otherwise, the value -1 is returned, and the global variable errno is set to indicate the error. πŸ’€

😭 ERRORS 😭

A call to pmc_set() may fail with the following errors:

  • [EINVAL] β€” The current process did not own a PMC with the specified handle. πŸ™ˆ
  • [EBUSY] β€” The specified PMC was already running. 😭

πŸ¦‹ SEE ALSO πŸ¦‹

pmc(3), hwpmc(4) πŸ’…


xoxo, your Debian bestie πŸ’– β€” source/version: Debian; date: November 25, 2007. periodt πŸŽ€

πŸ“¦ where this page comes from