From d4195dfbd9a1616ca1349150ec2496903b690b31 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20Luis=20Sanmart=C3=ADn=20Rozada?= Date: Wed, 5 Sep 2012 13:48:03 +0200 Subject: [PATCH] AIX suport in contextswitch plugin. --- configure.in | 1 + src/contextswitch.c | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) 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; } -- 2.11.0