cplusplus.com
C++ : Forum : UNIX/Linux Programming : How to get cpu utilization
 
cplusplus.com
Information
Documentation
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs


post How to get cpu utilization

macla (13)

Hi,

How to get cpu utilization for solaris using c or c++ ?
Any API ?
attaboy (72)
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
chrisname (4925)
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
jsmith (5804)
There is no posix api call I'm aware of to get that information.

PanGalactic (1558)
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?
enjoydownunder (1)
check out

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

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