projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-4.10' into collectd-5.0
[collectd.git]
/
src
/
target_scale.c
diff --git
a/src/target_scale.c
b/src/target_scale.c
index
6b261c7
..
af224f1
100644
(file)
--- a/
src/target_scale.c
+++ b/
src/target_scale.c
@@
-96,7
+96,7
@@
static int ts_invoke_counter (const data_set_t *ds, value_list_t *vl, /* {{{ */
{
difference = curr_counter - prev_counter;
}
{
difference = curr_counter - prev_counter;
}
- rate = ((double) difference) /
((double)
vl->interval);
+ rate = ((double) difference) /
CDTIME_T_TO_DOUBLE (
vl->interval);
/* Modify the rate. */
if (!isnan (data->factor))
/* Modify the rate. */
if (!isnan (data->factor))
@@
-105,7
+105,7
@@
static int ts_invoke_counter (const data_set_t *ds, value_list_t *vl, /* {{{ */
rate += data->offset;
/* Calculate the internal counter. */
rate += data->offset;
/* Calculate the internal counter. */
- int_fraction += (rate *
((double)
vl->interval));
+ int_fraction += (rate *
CDTIME_T_TO_DOUBLE (
vl->interval));
difference = (uint64_t) int_fraction;
int_fraction -= ((double) difference);
int_counter += difference;
difference = (uint64_t) int_fraction;
int_fraction -= ((double) difference);
int_counter += difference;
@@
-199,7
+199,7
@@
static int ts_invoke_derive (const data_set_t *ds, value_list_t *vl, /* {{{ */
/* Calcualte the rate */
difference = curr_derive - prev_derive;
/* Calcualte the rate */
difference = curr_derive - prev_derive;
- rate = ((double) difference) /
((double)
vl->interval);
+ rate = ((double) difference) /
CDTIME_T_TO_DOUBLE (
vl->interval);
/* Modify the rate. */
if (!isnan (data->factor))
/* Modify the rate. */
if (!isnan (data->factor))
@@
-208,7
+208,7
@@
static int ts_invoke_derive (const data_set_t *ds, value_list_t *vl, /* {{{ */
rate += data->offset;
/* Calculate the internal derive. */
rate += data->offset;
/* Calculate the internal derive. */
- int_fraction += (rate *
((double)
vl->interval));
+ int_fraction += (rate *
CDTIME_T_TO_DOUBLE (
vl->interval));
if (int_fraction < 0.0) /* handle negative integer rounding correctly */
difference = ((int64_t) int_fraction) - 1;
else
if (int_fraction < 0.0) /* handle negative integer rounding correctly */
difference = ((int64_t) int_fraction) - 1;
else
@@
-263,7
+263,7
@@
static int ts_invoke_absolute (const data_set_t *ds, value_list_t *vl, /* {{{ */
if (status != 0)
int_fraction = 0.0;
if (status != 0)
int_fraction = 0.0;
- rate = ((double) curr_absolute) /
((double)
vl->interval);
+ rate = ((double) curr_absolute) /
CDTIME_T_TO_DOUBLE (
vl->interval);
/* Modify the rate. */
if (!isnan (data->factor))
/* Modify the rate. */
if (!isnan (data->factor))
@@
-272,7
+272,7
@@
static int ts_invoke_absolute (const data_set_t *ds, value_list_t *vl, /* {{{ */
rate += data->offset;
/* Calculate the new absolute. */
rate += data->offset;
/* Calculate the new absolute. */
- int_fraction += (rate *
((double)
vl->interval));
+ int_fraction += (rate *
CDTIME_T_TO_DOUBLE (
vl->interval));
curr_absolute = (uint64_t) int_fraction;
int_fraction -= ((double) curr_absolute);
curr_absolute = (uint64_t) int_fraction;
int_fraction -= ((double) curr_absolute);
@@
-302,11
+302,15
@@
static int ts_config_set_double (double *ret, oconfig_item_t *ci) /* {{{ */
static int ts_destroy (void **user_data) /* {{{ */
{
static int ts_destroy (void **user_data) /* {{{ */
{
+ ts_data_t **data;
+
if (user_data == NULL)
return (-EINVAL);
if (user_data == NULL)
return (-EINVAL);
- free (*user_data);
- *user_data = NULL;
+ data = (ts_data_t **) user_data;
+
+ free (*data);
+ *data = NULL;
return (0);
} /* }}} int ts_destroy */
return (0);
} /* }}} int ts_destroy */