I've got a problem getting a real-time CPU usage of a single process (by its PID). I'd like to setup a watchdog for the CPU usage of a process because it's suddenly reaching 100% of the CPU usage sometimes.
What I have tried:
top -p $PID,
top -pid $PID - seems like those two are not working on FreeBSD
ps h -p $PID -o %cpu - works, but returned CPU usage percentage is always
The question is - how can I get a real time CPU usage for a single process by its PID on FreeBSD?