projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix typographical mistake in warning message
[collectd.git]
/
src
/
write_riemann_threshold.c
diff --git
a/src/write_riemann_threshold.c
b/src/write_riemann_threshold.c
index
6d5af03
..
f2ba9dc
100644
(file)
--- a/
src/write_riemann_threshold.c
+++ b/
src/write_riemann_threshold.c
@@
-26,15
+26,13
@@
**/
#include "collectd.h"
**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "utils_avltree.h"
#include "utils_cache.h"
#include "utils_threshold.h"
#include "common.h"
#include "plugin.h"
#include "utils_avltree.h"
#include "utils_cache.h"
#include "utils_threshold.h"
-
-#include <assert.h>
-#include <ltdl.h>
-#include <pthread.h>
+#include "write_riemann_threshold.h"
/*
* Threshold management
/*
* Threshold management
@@
-133,7
+131,6
@@
static int ut_check_one_threshold (const data_set_t *ds,
int *statuses)
{ /* {{{ */
int ret = -1;
int *statuses)
{ /* {{{ */
int ret = -1;
- int i;
int status;
gauge_t values_copy[ds->ds_num];
int status;
gauge_t values_copy[ds->ds_num];
@@
-153,7
+150,7
@@
static int ut_check_one_threshold (const data_set_t *ds,
}
/* Prepare `sum' and `num'. */
}
/* Prepare `sum' and `num'. */
- for (i = 0; i < ds->ds_num; i++)
+ for (
size_t
i = 0; i < ds->ds_num; i++)
if (!isnan (values[i]))
{
num++;
if (!isnan (values[i]))
{
num++;
@@
-163,17
+160,17
@@
static int ut_check_one_threshold (const data_set_t *ds,
if ((num == 0) /* All data sources are undefined. */
|| (sum == 0.0)) /* Sum is zero, cannot calculate percentage. */
{
if ((num == 0) /* All data sources are undefined. */
|| (sum == 0.0)) /* Sum is zero, cannot calculate percentage. */
{
- for (i = 0; i < ds->ds_num; i++)
+ for (
size_t
i = 0; i < ds->ds_num; i++)
values_copy[i] = NAN;
}
else /* We can actually calculate the percentage. */
{
values_copy[i] = NAN;
}
else /* We can actually calculate the percentage. */
{
- for (i = 0; i < ds->ds_num; i++)
+ for (
size_t
i = 0; i < ds->ds_num; i++)
values_copy[i] = 100.0 * values[i] / sum;
}
} /* if (UT_FLAG_PERCENTAGE) */
values_copy[i] = 100.0 * values[i] / sum;
}
} /* if (UT_FLAG_PERCENTAGE) */
- for (i = 0; i < ds->ds_num; i++)
+ for (
size_t
i = 0; i < ds->ds_num; i++)
{
status = ut_check_one_data_source (ds, vl, th, values_copy, i);
if (status != -1) {
{
status = ut_check_one_data_source (ds, vl, th, values_copy, i);
if (status != -1) {
@@
-202,7
+199,9
@@
int write_riemann_threshold_check (const data_set_t *ds, const value_list_t *vl,
gauge_t *values;
int status;
gauge_t *values;
int status;
+ assert (vl->values_len > 0);
memset(statuses, 0, vl->values_len * sizeof(*statuses));
memset(statuses, 0, vl->values_len * sizeof(*statuses));
+
if (threshold_tree == NULL)
return 0;
if (threshold_tree == NULL)
return 0;