From: Florian Forster Date: Sat, 10 Apr 2010 10:25:24 +0000 (+0200) Subject: pinba plugin: Multiply the derive data sources by a factor. X-Git-Tag: collectd-4.10.0~7^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=60c387cb3adda350ac8607afd87a282857109a57;p=collectd.git pinba plugin: Multiply the derive data sources by a factor. Otherwise the change is too slow to be really useful. --- diff --git a/src/pinba.c b/src/pinba.c index 9697cf27..8ddd9966 100644 --- a/src/pinba.c +++ b/src/pinba.c @@ -135,12 +135,15 @@ static void float_counter_add (float_counter_t *fc, float val) /* {{{ */ } } /* }}} 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) /* {{{ */ @@ -697,16 +700,16 @@ static int plugin_submit (const pinba_statnode_t *res) /* {{{ */ 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 29916027..a1bcc28d 100644 --- a/src/types.db +++ b/src/types.db @@ -156,7 +156,6 @@ timeleft timeleft:GAUGE:0:3600 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