How to get cpu utilization


Hi,

How to get cpu utilization for solaris using c or c++ ?
Any API ?
You should be able to read the required info from /proc I guess...
I don't know of any API...
good luck
Last edited on
AFAIK /proc isn't required by POSIX though; so that might not work on all UNIXes. Also, not all UNIXes store the same information there... And at any rate, that doesn't sound like something that would be stored in /proc.
Last edited on
There is no posix api call I'm aware of to get that information.

Is this for all processes on the CPU or do you just want to measure utilization within a specific program? That is, are you looking for something like the load average you get out of uptime(1), or the CPU utilization from time(1) command?
check out

http://www.i-scream.org/libstatgrab/

usefull little library to get all sort of utilization
Topic archived. No new replies allowed.