cpu usage display conky vs. top
Mateusz Marzantowicz
mmarzantowicz at osdf.com.pl
Sun Jul 21 07:19:37 UTC 2013
On 19.07.2013 12:32, lee wrote:
> Suvayu Ali <fatkasuvayu+linux at gmail.com> writes:
>
>> On Thu, Jul 18, 2013 at 05:13:12PM +0200, lee wrote:
>>> Hi,
>>>
>>> does anyone know what conky displays as CPU usage for a process? The
>>> values are different in conky and top, for example, top might show 11.6
>>> for a process while conky says 3.01.
>> Not on my system. The polling times are a bit different I think, so I
>> see same ballpark numbers: 2.53 vs 2.4, etc.
> Yes, top has 3 seconds update interval by default, and I have conky at
> 10 seconds. I wish I knew what the effect of that actually is,
> i. e. will it display averages for the last 10 seconds, or does it
> always display what it is seeing at the very moment the information is
> displayed?
>
>> Maybe you could fiddle with these two:
>>
>> cpu_avg_samples 2
> Do you know what this actually does? Google hasn't been helpful at all
> with it.
>
> It didn't seem to change anything. The documentation only says "The
> number of samples to average for CPU monitoring.".
>
> Afaik, the cpu load is read from /proc/stat. Does conky read this file
> more often per update interval when you increase cpu_avg_samples?
>
>> update_interval 1.0
> Even with an update interval of one second in both conky and top, there
> is no correlation between the cpu usage for the process. With
> 'cpu_avg_samples 4', conky shows something between 0.5 and 1.10 for a
> process that is around 3% in top.
>
>
> BTW, conky also ignores an update interval specified for mail checking.
> I specified an hour and it updates every 10 seconds. Maybe I'll write
> my own monitor so I do know what it does, or stay with xosview ...
>
>
Answer for all your questions is in conky's source code. In file
src/linux.cc, there is a function called get_cpu_count which grabs data
from /proc/stat . After this function you'll find several other
functions that open /proc/stat .
Mateusz Marzantowicz
More information about the users
mailing list