[collectd] (maybe silly) Question about get_kstat

Florian Forster octo at verplant.org
Thu Mar 19 09:12:19 CET 2009


Hi Marco,

On Wed, Mar 18, 2009 at 04:48:00PM +0100, Marco Chiappero wrote:
> finally I have found some time to write the uptime plugin and I'm going 
> to decide whether to use directly kstat_lookup or get_kstat. The latter 
> avoids error handling in the plugin but I have a little doubt about it: 
> is there a reason for filtering everything but KSTAT_TYPE_NAMED (and 
> check it twice)? Moreover, at the moment I don't know exactely the 
> boot_time type...

Checking the KSTAT_TYPE_NAMED twice (three times if you count the
assertion) is of course not necessary. I suspect a copy'n'paste error ;)

A quick `grep' revealed that `get_kstat' is only used in two places, the
memory and the swap plugin - both trying to figure out the pagesize. If
you need something else than `KSTAT_TYPE_NAMED', I'd suggest to move the
checks to a new function `get_kstat_pagesize' and use that function in
the two plugins.

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/20090319/0fe393b8/attachment.pgp 


More information about the collectd mailing list