X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Flpar.c;h=4d534476f62c76754433b2c73d313967595e5843;hb=793bec1c1dc3e6bb9479ed5be3c37d58119778dd;hp=b9471fb72a20bf20a5257fb461df2f31a7325887;hpb=74dbb25f6756bceced459c3fefbdbc678739004a;p=collectd.git diff --git a/src/lpar.c b/src/lpar.c index b9471fb7..4d534476 100644 --- a/src/lpar.c +++ b/src/lpar.c @@ -34,7 +34,7 @@ (double)(_system_configuration.Xfrac)) #endif -#define NS_TO_TICKS(ns) ((ns) / XINTFRAC) +#define CLOCKTICKS_TO_TICKS(cticks) ((cticks) / XINTFRAC) static const char *config_keys[] = { @@ -236,16 +236,15 @@ static int lpar_read (void) if (pool_stats) { char typinst[DATA_MAX_NAME_LEN]; - u_longlong_t pool_idle_ns; + u_longlong_t pool_idle_cticks; double pool_idle_cpus; double pool_busy_cpus; /* We're calculating "busy" from "idle" and the total number of - * CPUs, because according to Aurélien Reynaud using the "busy" - * member yields values that differ from the values produced by - * the LPAR command line tools. --octo */ - pool_idle_ns = lparstats.pool_idle_time - lparstats_old.pool_idle_time; - pool_idle_cpus = NS_TO_TICKS ((double) pool_idle_ns) / (double) ticks; + * CPUs, because the "busy" member didn't exist in early versions + * of libperfstat. It was added somewhere between AIX 5.3 ML5 and ML9. */ + pool_idle_cticks = lparstats.pool_idle_time - lparstats_old.pool_idle_time; + pool_idle_cpus = CLOCKTICKS_TO_TICKS ((double) pool_idle_cticks) / (double) ticks; pool_busy_cpus = ((double) lparstats.phys_cpus_pool) - pool_idle_cpus; if (pool_busy_cpus < 0.0) pool_busy_cpus = 0.0;