[collectd] [PATCH 1/3] lpar plugin: check for donation support in libperfstat
Aurélien Reynaud
collectd at wattapower.net
Thu Oct 14 22:09:27 CEST 2010
From: Aurelien Reynaud <collectd at wattapower.net>
Signed-off-by: Aurelien Reynaud <collectd at wattapower.net>
---
configure.in | 6 ++++++
src/lpar.c | 6 ++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/configure.in b/configure.in
index fcbd57c..5abca73 100644
--- a/configure.in
+++ b/configure.in
@@ -1193,6 +1193,12 @@ fi
if test "x$with_perfstat" = "xyes"
then
AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
+ # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
+ AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
+ if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
+ then
+ AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
+ fi
fi
AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
diff --git a/src/lpar.c b/src/lpar.c
index 146aaf2..b9471fb 100644
--- a/src/lpar.c
+++ b/src/lpar.c
@@ -45,7 +45,9 @@ static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
static _Bool pool_stats = 0;
static _Bool report_by_serial = 0;
+#if PERFSTAT_SUPPORTS_DONATION
static _Bool donate_flag = 0;
+#endif
static char serial[SYS_NMLN];
static perfstat_partition_total_t lparstats_old;
@@ -91,11 +93,13 @@ static int lpar_init (void)
return (-1);
}
+#if PERFSTAT_SUPPORTS_DONATION
if (!lparstats_old.type.b.shared_enabled
&& lparstats_old.type.b.donate_enabled)
{
donate_flag = 1;
}
+#endif
if (pool_stats && !lparstats_old.type.b.pool_util_authority)
{
@@ -202,6 +206,7 @@ static int lpar_read (void)
lpar_submit ("wait", (double) wait_ticks / (double) ticks);
lpar_submit ("idle", (double) idle_ticks / (double) ticks);
+#if PERFSTAT_SUPPORTS_DONATION
if (donate_flag)
{
/* donated => ticks given to another partition
@@ -224,6 +229,7 @@ static int lpar_read (void)
/* Donated ticks will be accounted for as stolen ticks in other LPARs */
consumed_ticks += idle_stolen_ticks + busy_stolen_ticks;
}
+#endif
lpar_submit ("consumed", (double) consumed_ticks / (double) ticks);
--
1.7.2.2
More information about the collectd
mailing list