summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 51f35f0)
raw | patch | inline | side by side (parent: 51f35f0)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 3 Sep 2010 10:48:26 +0000 (12:48 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 3 Sep 2010 10:48:26 +0000 (12:48 +0200) |
According to the documentation the function returns -1 on error. The
code now assumes anything but one (the number of structures filled) as
error.
code now assumes anything but one (the number of structures filled) as
error.
src/lpar.c | patch | blob | history |
diff --git a/src/lpar.c b/src/lpar.c
index 113dff9330fb8951135e02f9a4d63548e6c59a6e..be4738bb7573f88e9b3cfa942d2feee40059f4c2 100644 (file)
--- a/src/lpar.c
+++ b/src/lpar.c
@@ -190,6 +190,8 @@ static int lpar_read_dedicated_partition (const perfstat_partition_total_t *data
if (data->type.b.donate_enabled)
{
+ /* FYI: PURR == Processor Utilization of Resources Register
+ * SPURR == Scaled PURR */
lpar_submit ("idle_donated", (counter_t) data->idle_donated_purr);
lpar_submit ("busy_donated", (counter_t) data->busy_donated_purr);
lpar_submit ("idle_stolen", (counter_t) data->idle_stolen_purr);
@@ -202,12 +204,18 @@ static int lpar_read_dedicated_partition (const perfstat_partition_total_t *data
static int lpar_read (void)
{
perfstat_partition_total_t lparstats;
+ int status;
- /* Retrieve the current metrics */
- if (!perfstat_partition_total (NULL, &lparstats,
- sizeof (perfstat_partition_total_t), 1))
+ /* Retrieve the current metrics. Returns the number of structures filled. */
+ status = perfstat_partition_total (/* name = */ NULL, /* (must be NULL) */
+ &lparstats, sizeof (perfstat_partition_total_t),
+ /* number = */ 1 /* (must be 1) */);
+ if (status != 1)
{
- ERROR ("lpar plugin: perfstat_partition_total failed.");
+ char errbuf[1024];
+ ERROR ("lpar plugin: perfstat_partition_total failed: %s (%i)",
+ sstrerror (errno, errbuf, sizeof (errbuf)),
+ status);
return (-1);
}