cpu usage
Hi,
It has been asked a few times before on this forum, but none of the answers gave me a statisfying solution. I want to make a function that returns the cpu usage in %. I can use getloadavg() which returns the load averages. But I dont want that because the loadavg can be bigger than 2 or 3 even with a single cpu. And this: Quote:
What is a reliable way to get the cpu usage in linux using C++ (or just the command-line)? |
Hello
You might use conky http://conky.sourceforge.net/ to compare the values you get. Bye Koen Plessers |
Compare to what?
I am only able to get the load average, and when I try to extract the % with top every computer retuns something different (system, user, waiting, etc). |
Have a look at /proc/stat to get CPU usage (user, nice, system and idle), loadavg is a different metric.
|
Hi.
Quote:
|
All times are GMT -5. The time now is 12:02 AM. |