The current implementation uses pool_busy_time (expressed in ns) but experience shows this metric isn't accurate: It shows lower cpu usage for the entire pool than the sum of the participating lpars. Using pool_idle_time (expressed in clock ticks) in contrast is almost a perfect match. This is also what is used by IBM in their sample code: http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.prftools/doc/prftools/prftools07.htm
Signed-off-by: Aurelien Reynaud <colle...@wattapower.net> --- src/lpar.c | 21 +++++++-------------- 1 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/lpar.c b/src/lpar.c index ec39d5c..fc60c56 100644 --- a/src/lpar.c +++ b/src/lpar.c @@ -34,8 +34,6 @@ (double)(_system_configuration.Xfrac)) #endif -#define NS_TO_TICKS(ns) ((ns) / XINTFRAC) - static const char *config_keys[] = { "CpuPoolStats", @@ -230,21 +228,16 @@ static int lpar_read (void) if (pool_stats) { char typinst[DATA_MAX_NAME_LEN]; - u_longlong_t pool_busy_ns; - u_longlong_t pool_max_ns; - u_longlong_t pool_idle_ns = 0; + double pool_idle_cpus; + double pool_busy_cpus; - pool_busy_ns = lparstats.pool_busy_time - lparstats_old.pool_busy_time; - pool_max_ns = lparstats.pool_max_time - lparstats_old.pool_max_time; - if (pool_max_ns > pool_busy_ns) - pool_idle_ns = pool_max_ns - pool_busy_ns; + pool_idle_cpus = (double) (lparstats.pool_idle_time - lparstats_old.pool_idle_time) / XINTFRAC / (double) ticks; + ssnprintf (typinst, sizeof (typinst), "pool-%X-idle", lparstats.pool_id); + lpar_submit (typinst, pool_idle_cpus); - /* Pool stats are in CPU x ns */ + pool_busy_cpus = (double) lparstats.phys_cpus_pool - pool_idle_cpus; ssnprintf (typinst, sizeof (typinst), "pool-%X-busy", lparstats.pool_id); - lpar_submit (typinst, NS_TO_TICKS ((double) pool_busy_ns) / (double) ticks); - - ssnprintf (typinst, sizeof (typinst), "pool-%X-idle", lparstats.pool_id); - lpar_submit (typinst, NS_TO_TICKS ((double) pool_idle_ns) / (double) ticks); + lpar_submit (typinst, pool_busy_cpus); } memcpy (&lparstats_old, &lparstats, sizeof (lparstats_old)); -- 1.7.2.2 _______________________________________________ collectd mailing list collectd@verplant.org http://mailman.verplant.org/listinfo/collectd