Re: processor utilization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 25 May 2003, learner linux wrote:

> I would like to measure how much is the processor utilization when a
> series of events occur. I know that we have a "top" command to see the
> load on a per second basis.I don't want a per second utilization but
> utilization under a given test scenario.

Get the procps package and look at how it calculates CPU utilization
from information in /proc/uptime, /proc/loadavg, and most important
/proc/stat. Create a simply library routine that can populate a structure
with this information and call it a strategic times. The package might
also be available on your system as libproc in which case you might just
use the provided functions but beware -- some of the code is sub-optimal
(it leaks memory).

Mike

-- 
A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and, more important, to tasks that have not
yet been conceived. 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux