LIBPFM(3)
π LIBPFM π
ok so bestie, welcome to libpfm, aka the Linux Programmer's Manual page for the perfmon library. sit down, grab a strawberry, we're gonna talk about the very first thing you have to do. πβ¨
πΈ NAME πΈ
pfm_initialize β initialize library
β¨ SYNOPSIS β¨
#include <perfmon/pfmlib.h>
int pfm_initialize(void);
π¦ DESCRIPTION π¦
okay so this is the function. like, the one you literally have to call first. if you don't, the library just... does not operate. it's giving "you can't sit with us" energy. π
so what does it actually do? it goes poking around in the underlying hardware, looking for valid PMU event tables to activate. and here's the slay part: multiple distinct PMU tables can be activated at the same time. not just one. several. at once. obsessed. π
real talk though: this function must be called only once. if you call it more than once, it does not run the initialization multiple times β it just returns the same value as the first call. so don't be out here thinking you're re-initializing anything. you're not.
also, and this is important, this is not a reentrant function. only one thread at a time can call it. one. single. thread. no tag-teaming, no group chat, no parallel chaos. π
π₯ RETURN π₯
it tells you whether it worked or not β i.e. whether at least one PMU was activated.
- a return value of
PFMLIB_SUCCESS= success, we ate β¨ - anything else = that value is an error code
π ERRORS π
PFMLIB_ERR_NOTSUPPβ no PMU was activated. that's it, that's the whole vibe. nothing got turned on. π
π AUTHOR π
Stephane Eranian <eranian@gmail.com>
and that's the whole page, bestie!! go call pfm_initialize once, from one thread, and then go live your main character life. iykyk π«Ά
π this was LIBPFM(3), from the Linux Programmer's Manual, dated September, 2009 β mwah, bye!! π
π¦ where this page comes from
- arch rolling: libpfm 4.14.1-1 Β· MIT
- centos-stream 10: libpfm-devel 4.14.1-1.el10 Β· MIT
- centos-stream 9: libpfm-devel 4.14.1-1.el9 Β· MIT
- centos-stream 9: libpfm-devel 4.14.1-1.el9 Β· MIT
- debian trixie: libpfm4-dev 4.13.0+git99-gc5587f9-1 Β· MIT
- fedora 43: libpfm-devel 4.14.1-2.fc43 Β· MIT
- fedora 43: libpfm-devel 4.14.1-2.fc43 Β· MIT
- fedora 44: libpfm-devel 4.14.1-2.fc44 Β· MIT
- fedora 44: libpfm-devel 4.14.1-2.fc44 Β· MIT
- nixos 26.05: papi 7.2.0
- nixpkgs unstable: libpfm 4.14.1
- nixpkgs unstable: papi 7.2.0
- ubuntu questing: libpfm4-dev 4.13.0+git99-gc5587f9-1
- ubuntu resolute: libpfm4-dev 4.13.0+git106-g3e4031b-1 Β· MIT
- ubuntu resolute: libpfm4-dev 4.13.0+git106-g3e4031b-1ubuntu0.1 Β· MIT
- ubuntu stonking: libpfm4-dev 4.13.0+git106-g3e4031b-1ubuntu1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms