getpriority

getpriorityWHICH,WHO
This function returns the current priority for a process, a
process group, or a user. See getpriority(2).
Invoking getpriority will raise an
exception if used on a machine that doesn’t implement
getpriority(2).
The BSD::Resource module from CPAN provides a more convenient interface,
including the PRIO_PROCESS, PRIO_PGRP, and PRIO_USER symbolic constants to supply for the
WHICH argument. Although these are
traditionally set to 0, 1, and 2,
respectively, you really never know what may happen within the dark
confines of C’s #include
files.
A value of 0 for
WHO means the current process, process group,
or user. So to get the priority of the current process, use:
$curprio = getpriority(0, 0);
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access