From: Manuel Luis SanmartĂ­n Rozada Date: Wed, 5 Sep 2012 11:48:03 +0000 (+0200) Subject: AIX suport in contextswitch plugin. X-Git-Tag: collectd-5.2.0~52 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d4195dfbd9a1616ca1349150ec2496903b690b31;p=collectd.git AIX suport in contextswitch plugin. --- diff --git a/configure.in b/configure.in index 50f5fd5a..fec588da 100644 --- a/configure.in +++ b/configure.in @@ -4637,6 +4637,7 @@ fi if test "x$with_perfstat" = "xyes" then plugin_cpu="yes" + plugin_contextswitch="yes" plugin_disk="yes" plugin_memory="yes" plugin_swap="yes" diff --git a/src/contextswitch.c b/src/contextswitch.c index c207318f..d3e6fe63 100644 --- a/src/contextswitch.c +++ b/src/contextswitch.c @@ -37,6 +37,11 @@ /* no global variables */ /* #endif KERNEL_LINUX */ +#elif HAVE_PERFSTAT +# include +# include +/* #endif HAVE_PERFSTAT */ + #else # error "No applicable input method." #endif @@ -121,7 +126,24 @@ static int cs_read (void) if (status == -2) ERROR ("contextswitch plugin: Unable to find context switch value."); -#endif /* KERNEL_LINUX */ +/* #endif KERNEL_LINUX */ + +#elif HAVE_PERFSTAT + int status = 0; + perfstat_cpu_total_t perfcputotal; + + status = perfstat_cpu_total(NULL, &perfcputotal, sizeof(perfstat_cpu_total_t), 1); + if (status < 0); + { + char errbuf[1024]; + ERROR ("contextswitch plugin: perfstat_cpu_total: %s", + sstrerror (errno, errbuf, sizeof (errbuf))); + return (-1); + } + + cs_submit(perfcputotal.pswitch); + return (0); +#endif /* defined(HAVE_PERFSTAT) */ return status; }