summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3c11483)
raw | patch | inline | side by side (parent: 3c11483)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 31 Oct 2010 13:36:11 +0000 (14:36 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 31 Oct 2010 13:36:11 +0000 (14:36 +0100) |
src/rrdtool.c | patch | blob | history |
diff --git a/src/rrdtool.c b/src/rrdtool.c
index 1e9e52a93cbd8e52b774f48c42c2902bb01b3b03..ca5441a8d71ec093d1052cd16084307d59f2db69 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
* ALWAYS lock `cache_lock' first! */
static cdtime_t cache_timeout = 0;
static cdtime_t cache_flush_timeout = 0;
-static cdtime_t random_timeout = 1;
+static cdtime_t random_timeout = TIME_T_TO_CDTIME_T (1);
static cdtime_t cache_flush_last;
static c_avl_tree_t *cache = NULL;
static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER;
if (negative)
ret *= -1;
- DEBUG ("rrdtool plugin: random_variation = %.3f s",
- (negative ? -1.0 : 1.0) * dbl_timeout * rand_fact);
-
return (ret);
} /* int64_t rrd_get_random_variation */
rc->values = NULL;
rc->first_value = 0;
rc->last_value = 0;
- rc->random_variation = 0;
+ rc->random_variation = rrd_get_random_variation ();
rc->flags = FLAG_NONE;
new_rc = 1;
}
filename, rc->values_num,
CDTIME_T_TO_DOUBLE (rc->last_value - rc->first_value));
- if ((rc->last_value + rc->random_variation - rc->first_value) >= cache_timeout)
+ if ((rc->last_value - rc->first_value) >= (cache_timeout + rc->random_variation))
{
/* XXX: If you need to lock both, cache_lock and queue_lock, at
* the same time, ALWAYS lock `cache_lock' first! */
}
else
{
- cache_timeout = DOUBLE_TO_CDTIME_T (tmp);
+ random_timeout = DOUBLE_TO_CDTIME_T (tmp);
}
}
else