after reading the proc.txt file i come to the following conclusion
Please read the QA part of Erik's response below. If you don't bother to read the responses, I'm pretty sure the responses will stop coming.
i get the total clock speed of the cpu from /proc/cpuinfo from cpu MHz entry
now i add the values of all the colomns in the first row of /proc/stat(the row which starts with cpu).this gives the total cpu usage.
then i am dividing the above value with 1000 and the resulting answer is again divided with the total clock speed to get the percentage of cpu usage.
is my approach correct.
i am checking my results with system moniter but there is a variation
plz rectify me
if i am wrong
thanks sounak
On Mon, 07 Mar 2005 Erik Mouw wrote : >A: Because it messes up the order in which people normally read text. >Q: Why is top-posting such a bad thing? >A: Top-posting. >Q: What is the most annoying thing in e-mail? > >A: No. >Q: Should I include quotations after my reply? > >(Oh, and don't use HTML for email, and get a real mailer that doesn't >mess up threading). > >On Mon, Mar 07, 2005 at 12:18:44PM -0000, sounak chakraborty wrote: > > i read the /proc/stat file but there were 7 entries along the first > > line beginning with CPU but it is not specified what information they > > are providing. > >Either read the kernel source (which always is the ultimate >documentation), or read Documentation/filesystems/proc.txt. Or read the >source of top and vmstat. > > >Erik > >-- >Erik Mouw >J.A.K.Mouw@xxxxxxxxxxxxxx mouw@xxxxxxxxxxxx
<http://clients.rediff.com/signature/track_sig.asp>
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/