busybox - how to list process priority?

Solution 1:

Busybox can be compiled with ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS which will enable nice among others. Then you can do, for example:

busybox ps -o pid,nice,user,args

POSIX

  • user, group, comm, args, pid, ppid, pgid, tty, vsz

ENABLE_FEATURE_PS_TIME

  • etime, time

ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS

  • nice, rgroup, ruser, pcpu (although pcpu seems to be commented out)

Non-POSIX

  • rss

ENABLE_SELINUX

  • label

Solution 2:

If you have a cut-down Linux distribution where ps and top does not give you priority information, you can parse the stat file of proc for your process ID to get the priority information.

cat /proc/PID/stat | awk '{print "priority " $18 " nice " $19}'

The values at position 18 and 19 of stat file represent priority and nice

For more: https://linux.die.net/man/5/proc