How to get cpu utilization through code with least overhead?

Vaibhav Jain vjoss197 at gmail.com
Thu Jul 28 19:56:16 EDT 2011


Hi,

Is there any other way to do this? If I need to write a kernel module that
needs to get cpu utilization
should I still use proc/stat ? Is there a kernel function that can be used
in a module ?

Thanks
Vaibhav Jain

On Thu, Jul 28, 2011 at 10:51 AM, Vaibhav Jain <vjoss197 at gmail.com> wrote:

> Thanks! Just curious to know if  this is how "top" does it.
>
> Thanks
> Vaibhav Jain
>
>   On Thu, Jul 28, 2011 at 10:45 AM, Mulyadi Santosa <
> mulyadi.santosa at gmail.com> wrote:
>
>> On Fri, Jul 29, 2011 at 00:38, Vaibhav Jain <vjoss197 at gmail.com> wrote:
>> > Hi,
>> >
>> > I need to write code to get and record the cpu utilization in certain
>> > interval with the least overhead.
>>
>> try to derive them from /proc/loadavg or /proc/stat...
>>
>> --
>> regards,
>>
>> Mulyadi Santosa
>> Freelance Linux trainer and consultant
>>
>> blog: the-hydra.blogspot.com
>> training: mulyaditraining.blogspot.com
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110728/05531af9/attachment.html 


More information about the Kernelnewbies mailing list