Thanks !!<br>I looked at the code for top command again and I could see /proc/stat being used. So I guess<br>that should be the best way to do it.<br><br><br><div class="gmail_quote">On Fri, Jul 29, 2011 at 12:15 PM, Jonathan Neuschäfer <span dir="ltr"><<a href="mailto:j.neuschaefer@gmx.net">j.neuschaefer@gmx.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Thu, Jul 28, 2011 at 04:56:16PM -0700, Vaibhav Jain wrote:<br>
> Hi,<br>
><br>
> Is there any other way to do this? If I need to write a kernel module that<br>
> needs to get cpu utilization<br>
> should I still use proc/stat ? Is there a kernel function that can be used<br>
> in a module ?<br>
<br>
</div>To get the information that's shown in /proc/stat, I'd suggest having a<br>
look at fs/proc/stat.c in the kernel tree.<br>
<br>
HTH,<br>
<font color="#888888"> Jonathan Neuschäfer<br>
</font></blockquote></div><br>