PMC_START(3)

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

✨ NAME ✨

Okay so this is PMC_START(3), straight outta the Library Functions Manual, and the main characters are pmc_start, pmc_stop β€” they start and stop a PMC. Periodt. πŸŽ€

🌸 LIBRARY 🌸

Performance Counters Library (libpmc, -lpmc) β€” that's where these babies live.

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <pmc.h>

int
pmc_start(pmc_id_t pmc);

int
pmc_stop(pmc_id_t pmc);

πŸ’œ DESCRIPTION πŸ’œ

Okay so these functions are literally the on/off switch for a PMC.

pmc_start() starts the PMC specified by argument pmc. And here's the cute little detail: if the specified PMC has process scope and has not been attached to any targets, it will be attached to the current process. It's giving "you're mine now" energy. 🫢

pmc_stop() stops the PMC specified by argument pmc. That's it. That's the tea. β˜•

πŸ”₯ RETURN VALUES πŸ”₯

If it works, you get 0 back. If it doesn't, you get -1, and the global variable errno is set to indicate the error. So check errno, bestie β€” it's literally telling you what happened. 😭

πŸ’… ERRORS πŸ’…

A call to these functions may fail with the following errors:

  • EDOOFUS β€” pmc_start() specified a PMC that requires a log file and no log file was configured. Iconic error name, ngl.
  • EINVAL β€” the specified PMC is in the process of being deleted. Mid-deletion, not cute.
  • EINVAL β€” pmc_stop() specified a PMC that was never started. You can't stop what never started, bestie.
  • ENXIO β€” the specified PMC had system scope and its associated CPU was disabled or absent. Ghosted by the CPU. πŸ’€

🌈 SEE ALSO 🌈

Go read those next, iykyk. πŸ‘‘


This page is from Debian and is dated September 22, 2008. Bye bestie, go start and stop those PMCs with main character energy πŸ’–βœ¨

πŸ“¦ where this page comes from