From: Florian Forster Date: Sat, 11 Sep 2010 09:04:44 +0000 (+0200) Subject: lpar plugin: Introduce a "NS_TO_TICKS" macro. X-Git-Tag: collectd-5.0.0-beta0~27^2~8 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=7134cf10f759b177fa0410dcc9caeaaf09dd0336 lpar plugin: Introduce a "NS_TO_TICKS" macro. This makes the code easier to read, IMHO. --- diff --git a/src/lpar.c b/src/lpar.c index 7a842e07..562d2d4e 100644 --- a/src/lpar.c +++ b/src/lpar.c @@ -34,6 +34,8 @@ (double)(_system_configuration.Xfrac)) #endif +#define NS_TO_TICKS(ns) ((ns) / XINTFRAC) + static const char *config_keys[] = { "CpuPoolStats", @@ -268,10 +270,10 @@ static int lpar_read (void) /* Pool stats are in CPU x ns */ ssnprintf (typinst, sizeof (typinst), "pool-%X-busy", lparstats.pool_id); - lpar_submit (typinst, (double) pool_busy_ns / XINTFRAC / (double) ticks); + lpar_submit (typinst, NS_TO_TICKS ((double) pool_busy_ns) / (double) ticks); ssnprintf (typinst, sizeof (typinst), "pool-%X-total", lparstats.pool_id); - lpar_submit (typinst, (double) pool_max_ns / XINTFRAC / (double) ticks); + lpar_submit (typinst, NS_TO_TICKS ((double) pool_max_ns) / (double) ticks); } save_last_values (&lparstats);