[collectd] cpu module and saving jiffies / OpenBSD

Florian Forster octo at verplant.org
Tue Aug 12 09:38:46 CEST 2008


Hi Michael,

On Mon, Aug 11, 2008 at 05:02:30PM +0200, Michael Stapelberg wrote:
> > Why?
> Because the values don't add up to 100 like on linux and I'd like to
> keep using my simple rrdtool-calls to generate graphs instead of
> having to use a frontend :-).

actually the values don't add up to 100 on Linux either - they add up to
`HZ' which is often set to 100. And, as I have pointed out in an earlier
mail, the values don't cleanly add up to that value either. With fast
CPUs available and people using Linux for interactive stuff, it's
perfectly reasonable to set `HZ' to 250 or 1000, other common values. I
wouldn't be surprised if distributions that target the desktop market
ship their kernels with one of those values..

> Did you notice the patch I've attached? It saves the values in percent
> in a GAUGE and it works just fine.

Your patch only works for the statgrab library and breaks backwards
compatibility. If you really want to do this right, you should:
- Add a configuration option ``Percent true|false''
- Add a type ``cpu_percent''
- Make *all* implementations honor that option by
  - Converting the counter to a rate:
    (current - old) / time difference, make sure to detect counter
    overflows
  - Convert the rates to percentages:
    total = idle + user + system + ...
    idle = 100 * idle / total;
    user = 100 * user / total;
    ...

If done like that or any other reasonable, clean and backwards
compatible way, I'll gladly accept that patch.

Regards,
-octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080812/064a0c3d/attachment.pgp 


More information about the collectd mailing list