Re: Cpu usage %

From: Erik de Castro Lopo (nospam_at_mega-nerd.com)
Date: 07/22/03


Date: Tue, 22 Jul 2003 20:51:12 GMT

Kasper Dupont wrote:
>
> Teemu wrote:
> >
> > Does anyone know how to obtain %idle cpu time using c/c++?
>
> 1) Read the cpu lines from /proc/stat
> 2) Wait one second
> 3) Read the cpu lines again
> 4) Compute the differences
> 5) Compute the idle percentage

Thats interesting, but what does all this mean?

   cpu 2977523 0 557054 58215889
   cpu0 1492731 0 276870 29105632
   cpu1 1484792 0 280184 29110257
   page 1508280 3657003
   swap 0 0
   intr 39016595 30875233 116092
   .....
   .....
   .....
    

Erik

-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  nospam@mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"He who writes the code gets to choose his license, and nobody 
else gets to complain" -- Linus Torvalds


Relevant Pages