summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e81c851)
raw | patch | inline | side by side (parent: e81c851)
author | Florian Forster <octo@huhu.verplant.org> | |
Wed, 1 Jul 2009 14:55:38 +0000 (16:55 +0200) | ||
committer | Florian Forster <octo@noris.net> | |
Wed, 1 Jul 2009 14:55:38 +0000 (16:55 +0200) |
src/csv.c | patch | blob | history |
diff --git a/src/csv.c b/src/csv.c
index f38599dc7b32be95dbad169a98822fabbeff286e..78037a940ca3981a150a3fa84055c490b83c955b 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
&& (ds->ds[i].type != DS_TYPE_ABSOLUTE))
return (-1);
- if (ds->ds[i].type == DS_TYPE_COUNTER)
- {
- if (store_rates == 0)
- {
- status = ssnprintf (buffer + offset,
- buffer_len - offset,
- ",%llu",
- vl->values[i].counter);
- }
- else /* if (store_rates == 1) */
- {
- if (rates == NULL)
- rates = uc_get_rate (ds, vl);
- if (rates == NULL)
- {
- WARNING ("csv plugin: "
- "uc_get_rate failed.");
- return (-1);
- }
- status = ssnprintf (buffer + offset,
- buffer_len - offset,
- ",%lf", rates[i]);
- }
- }
- else if (ds->ds[i].type == DS_TYPE_GAUGE)
+ if (ds->ds[i].type == DS_TYPE_GAUGE)
{
status = ssnprintf (buffer + offset, buffer_len - offset,
",%lf", vl->values[i].gauge);
}
- else if (ds->ds[i].type == DS_TYPE_DERIVE)
+ else if (store_rates != 0)
{
- if (store_rates == 0)
+ if (rates == NULL)
+ rates = uc_get_rate (ds, vl);
+ if (rates == NULL)
{
- status = ssnprintf (buffer + offset,
- buffer_len - offset,
- ",%llu",
- vl->values[i].derive);
- }
- else /* if (store_rates == 1) */
- {
- if (rates == NULL)
- rates = uc_get_rate (ds, vl);
- if (rates == NULL)
- {
- WARNING ("csv plugin: "
- "uc_get_rate failed.");
- return (-1);
- }
- status = ssnprintf (buffer + offset,
- buffer_len - offset,
- ",%lf", rates[i]);
+ WARNING ("csv plugin: "
+ "uc_get_rate failed.");
+ return (-1);
}
+ status = ssnprintf (buffer + offset,
+ buffer_len - offset,
+ ",%lf", rates[i]);
+ }
+ else if (ds->ds[i].type == DS_TYPE_COUNTER)
+ {
+ status = ssnprintf (buffer + offset,
+ buffer_len - offset,
+ ",%llu",
+ vl->values[i].counter);
+ }
+ else if (ds->ds[i].type == DS_TYPE_DERIVE)
+ {
+ status = ssnprintf (buffer + offset,
+ buffer_len - offset,
+ ",%"PRIi64,
+ vl->values[i].derive);
}
else if (ds->ds[i].type == DS_TYPE_ABSOLUTE)
{
- if (store_rates == 0)
- {
- status = ssnprintf (buffer + offset,
- buffer_len - offset,
- ",%llu",
- vl->values[i].absolute);
- }
- else /* if (store_rates == 1) */
- {
- if (rates == NULL)
- rates = uc_get_rate (ds, vl);
- if (rates == NULL)
- {
- WARNING ("csv plugin: "
- "uc_get_rate failed.");
- return (-1);
- }
- status = ssnprintf (buffer + offset,
- buffer_len - offset,
- ",%lf", rates[i]);
- }
+ status = ssnprintf (buffer + offset,
+ buffer_len - offset,
+ ",%"PRIu64,
+ vl->values[i].absolute);
}
if ((status < 1) || (status >= (buffer_len - offset)))