profil(3)

✨ profil(3) β€” execution time profile ✨

okay bestie, so this is a page from the Library Functions Manual for profil(3), and it's giving "let's find out where your program is wasting its whole life" energy. it's a libc thing. let's get into it πŸ’…


🌸 NAME 🌸

profil β€” execution time profile


πŸŽ€ LIBRARY πŸŽ€

Standard C library (libc, -lc) β€” yes queen, you get it for free.


✨ SYNOPSIS ✨

#include <unistd.h>

int profil(unsigned short *buf, size_t bufsiz,
           size_t offset, unsigned int scale);

Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

profil():

  • Since glibc 2.21:
    • _DEFAULT_SOURCE
  • In glibc 2.19 and 2.20:
    • _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
  • Up to and including glibc 2.19:
    • _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)

like. yes. you have to ask for it. gatekeeping much 😭


πŸ’– DESCRIPTION πŸ’–

This routine is literally a little detective πŸ•΅οΈβ™€οΈ that shows you in what areas your program spends most of its time. main character sleuthing.

So here's the vibe:

  • The argument buf points to bufsiz bytes of core.
  • Every virtual 10 milliseconds, the user's program counter (PC) is examined:
    • offset is subtracted from it,
    • the result is multiplied by scale,
    • and then divided by 65536.
  • If the resulting value is less than bufsiz, then the corresponding entry in buf is incremented.
  • If buf is NULL, profiling is disabled. (bye bestie πŸ‘‹)

⭐ RETURN VALUE ⭐

Zero. Always zero. no notes. it never has a bad day, it never has a good day, it just returns 0. periodt.


πŸ‘‘ ATTRIBUTES πŸ‘‘

For an explanation of the terms used in this section, see attributes(7).

  • profil() β€” Thread safety: MT-Unsafe πŸ’€
so like… not thread safe. don't be sending her into a group chat of multiple threads and expecting everything to be chill, because it will not be, and I will not be surprised.

🌈 STANDARDS 🌈

None. she's unstandardized. a rogue icon. no cap.


πŸ¦‹ HISTORY πŸ¦‹

Similar to a call in SVr4.


πŸ’€ BUGS πŸ’€

  • profil() cannot be used on a program that also uses ITIMER_PROF interval timers (see setitimer(2)). like they Do Not Coexist. pick a lane.
  • True kernel profiling provides more accurate results. ngl, if you need accuracy you should be looking at kernel profiling instead β€” this one is doing its best but it's not the main event.

πŸ”₯ SEE ALSO πŸ”₯

gprof(1), sprof(1), setitimer(2), sigaction(2), signal(2)


and that's the whole page, bestie 🫢 this one came from Linux man-pages 6.20, dated 2026-02-08 β€” so go profile responsibly, and remember: if buf is NULL, it's not profiling, it's just vibes βœ¨πŸ’œ

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms