[collectd] Questions about coding standards & writing plugins

Florian Forster octo at verplant.org
Fri Nov 2 17:33:11 CET 2007

Hi again :)

On Fri, Nov 02, 2007 at 02:32:02PM +0000, Richard W.M. Jones wrote:
> The data we collect in libvirt comes from Xen, and it includes the CPU
> time used in nanoseconds as a 64 bit signed quantity.

A signed counter? That's odd ;) But since it takes about 290 years to
overflow into the negative range it probably doesn't matter ;)

> Should I define a new type (eg. 'virt_cpu_time_ns') setting the max
> value to whatever 2^63-1 is?  Or would it be preferable to divide
> through, eg. to convert to us, ms, or even seconds?  Can I pass float
> values?

The CPU plugin, at least under Linux, reports ``Jiffies'', i. e.
timeticks that are defined by the `HZ' value in the kernel, usually
either 1/100th, 1/250th or 1/1000th of a second. So the values should be
seen in relation to each other anyways, so if for example `system' is
25, `user' is 150 and `idle' is 75, you'd get 10%, 60% and 30%
This may not be implemented in that `collection.cgi' correctly though.
I'll look into it.

As for the maximum value: This value is checked after the counter value
has been converted to a rate. So the maximum value should be 10^9 in
your case (possibly plus 5% so account for measurement errors), because
the (theoretical) maximum is 10^9 nanoseconds per second.

Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2567 bytes
Desc: not available
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20071102/95ad1e57/attachment.bin 

More information about the collectd mailing list