LIBPFM(3)

πŸ’– LIBPFM πŸ’–

okay bestie, welcome to the Linux Programmer's Manual glow-up of libpfm(3) β€” yes it's a section 3 man page, yes it's giving "I just need one tiny function," and yes it absolutely ate. πŸŽ€


✨ NAME ✨

pfm_get_version β€” get library version 🌸


✨ SYNOPSIS ✨

#include <perfmon/pfmlib.h>

int pfm_get_version(void);

literally that's it. one line of C and you're done, iykyk πŸ’…


✨ DESCRIPTION ✨

so this function πŸ‘‘ β€” you can call it whenever. like, any time. no prep, no warm-up, no vibe check needed. you do not have to call pfm_initialize() first before calling this one. it's the low-maintenance bestie of the library fr fr. πŸ¦‹

what it gives you back is the revision level of the library. and that revision number is made of two fields:

  • a major number
  • a minor number

both of them can be pulled out using the macros that live in the header file:

  • PFMLIB_MAJ_VERSION(v) β€” returns the major number encoded in v.
  • PFMLIB_MIN_VERSION(v) β€” returns the minor number encoded in v.

so you grab the version, then you crack it open with those macros. iconic behavior honestly. ✨


✨ RETURN ✨

the function is always successful. like, always always. it never fails, it never ghosts you, it always returns the 32-bit version number. periodt. πŸ’–


✨ ERRORS ✨

none babe. nothing. empty. the void. not a single error to report β€” it's that girl. 🫢


✨ AUTHOR ✨

Stephane Eranian <eranian@gmail.com> β€” thank you for your service king πŸ‘‘


this page is from September, 2009, and it's part of LIBPFM in the Linux Programmer's Manual (section 3). mwah, slay, bye bestie πŸ’…πŸŒˆ
πŸ“¦ where this page comes from