API / function for checking CPU usage by a process

what is the API / function for getting the percentage of CPU utilisation by a given process?
man 2 getrusage

This C function will give you a lot of information including the total user CPU time used by your process. You can calculate how much it's using currently by observing a change in this value over time.
Topic archived. No new replies allowed.