PR_TASK_PER...ENTS_DISABLE(2)
β¨ PR_TASK_PER...ENTS_DISABLE(2) β¨
System Calls Manual π bestie, this page is about the prctl() calls that switch performance counters off and on for your process. Let's get into it π
π NAME
PR_TASK_PERF_EVENTS_DISABLE, PR_TASK_PERF_EVENTS_ENABLE β disable or enable performance counters attached to the calling process π¦
π LIBRARY
Standard C library (libc, -lc) πΈ
π§© SYNOPSIS
#include <linux/prctl.h> /* Definition of PR_* constants */
#include <sys/prctl.h>
int prctl(PR_TASK_PERF_EVENTS_DISABLE);
int prctl(PR_TASK_PERF_EVENTS_ENABLE);
π₯ DESCRIPTION
okay so these two are a matching pair, no cap β¨
PR_TASK_PERF_EVENTS_DISABLEβ this one shuts off every performance counter attached to the calling process, and it doesn't matter who made them. Your process made them or some other process did, either way they're getting switched off π Counters that your process created for other processes? Those are totally unaffected, so don't panic.PR_TASK_PERF_EVENTS_ENABLEβ the total opposite of the one above! It turns the performance counters attached to the calling process back on π§
π RETURN VALUE
On success, 0 is returned π. On error, -1 is returned and errno gets set to tell you what went wrong π
π STANDARDS
Linux. π§
π°οΈ HISTORY
Linux 2.6.31 is where this started π
Fun little plot twist: these were originally called PR_TASK_PERF_COUNTERS_DISABLE and PR_TASK_PERF_COUNTERS_ENABLE. They got renamed in Linux 2.6.32, but the numerical value stayed exactly the same, so nothing actually broke π«Ά
π SEE ALSO
prctl(2) β¨
For more on performance counters, check out the Linux kernel source file tools/perf/design.txt π€
Linux man-pages 6.9.1, dated 2024-06-02, and the PR_TASK_PER...ENTS_DISABLE(2) page itself π bye bestie, go be a main character π π¦
π¦ where this page comes from
- debian trixie: manpages-dev 6.9.1-1
- ubuntu questing: manpages-dev 6.9.1-1 Β· GPL-2.0-or-later
- π the page's license: Linux-man-pages-copyleft
- Copyright 2012, 2013, 2015, Michael Kerrisk <mtk.manpages@gmail.com>
- Copyright 2024, Alejandro Colomar <alx@kernel.org>
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms