summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: abb4b5e)
raw | patch | inline | side by side (parent: abb4b5e)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 10 Apr 2010 10:25:24 +0000 (12:25 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 10 Apr 2010 10:25:24 +0000 (12:25 +0200) |
Otherwise the change is too slow to be really useful.
src/pinba.c | patch | blob | history | |
src/types.db | patch | blob | history |
diff --git a/src/pinba.c b/src/pinba.c
index 9697cf277cd6d9e1cf84f21fc71c9d9cb586aca8..8ddd9966c71d890b3b5e8e4319b4f32b7dd601e3 100644 (file)
--- a/src/pinba.c
+++ b/src/pinba.c
}
} /* }}} void float_counter_add */
-static derive_t float_counter_get (const float_counter_t *fc) /* {{{ */
+static derive_t float_counter_get (const float_counter_t *fc, /* {{{ */
+ uint64_t factor)
{
- if (fc->n >= 500000000)
- return ((derive_t) (fc->i + 1));
- else
- return ((derive_t) fc->i);
+ derive_t ret;
+
+ ret = (derive_t) (fc->i * factor);
+ ret += (derive_t) (fc->n / (1000000000 / factor));
+
+ return (ret);
} /* }}} derive_t float_counter_get */
static void strset (char **str, const char *new) /* {{{ */
sstrncpy (vl.type, "requests", sizeof (vl.type));
plugin_dispatch_values (&vl);
- value.derive = float_counter_get (&res->req_time);
- sstrncpy (vl.type, "total_time", sizeof (vl.type));
+ value.derive = float_counter_get (&res->req_time, /* factor = */ 1000);
+ sstrncpy (vl.type, "total_time_in_ms", sizeof (vl.type));
plugin_dispatch_values (&vl);
- value.derive = float_counter_get (&res->ru_utime);
+ value.derive = float_counter_get (&res->ru_utime, /* factor = */ 100);
sstrncpy (vl.type, "cpu", sizeof (vl.type));
sstrncpy (vl.type_instance, "user", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
- value.derive = float_counter_get (&res->ru_stime);
+ value.derive = float_counter_get (&res->ru_stime, /* factor = */ 100);
sstrncpy (vl.type, "cpu", sizeof (vl.type));
sstrncpy (vl.type_instance, "system", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
diff --git a/src/types.db b/src/types.db
index 29916027579d65937e0678c41c76641d4e35e9e8..a1bcc28d67880c12408310c806dd641d538976a8 100644 (file)
--- a/src/types.db
+++ b/src/types.db
time_offset seconds:GAUGE:-1000000:1000000
total_requests value:DERIVE:0:U
total_time_in_ms value:DERIVE:0:U
-total_time value:DERIVE:0:U
total_values value:DERIVE:0:U
uptime value:GAUGE:0:4294967295
users users:GAUGE:0:65535