Hi,
I want to make some kind of monitor for my PC and i want to have CPU load in form like "top" (something% , ex 23%).
So i use C and : i'm opening the file /proc/stat and read the first line :
cpu 92208 2282668 19432 79824 739 1441 3304

the first is user, nice , system ...

So does anyone knows how this things can show me the percentage of CPU usage like "top" does?
thanks

It might be easier to just use /proc/loadavg if you only need the cpu load. This matches exactly with 'top'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.