From 7134cf10f759b177fa0410dcc9caeaaf09dd0336 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 11 Sep 2010 11:04:44 +0200 Subject: [PATCH] lpar plugin: Introduce a "NS_TO_TICKS" macro. This makes the code easier to read, IMHO. --- src/lpar.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); -- 2.11.0