summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c1facb5)
raw | patch | inline | side by side (parent: c1facb5)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Mon, 17 Jul 2017 04:26:04 +0000 (11:26 +0700) | ||
committer | Florian Forster <octo@collectd.org> | |
Thu, 20 Jul 2017 05:56:11 +0000 (07:56 +0200) |
The "RandomTimeout" option value check moved from rrd_get_random_variation()
to rrd_init(). This will save few CPU cycles.
to rrd_init(). This will save few CPU cycles.
src/rrdtool.c | patch | blob | history |
diff --git a/src/rrdtool.c b/src/rrdtool.c
index f09d6024a3a985693d82fcea25a4f381a734a98f..0f02ffc2e47d5fd4147d8c93c864c3fd12dfffde 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
if (random_timeout == 0)
return (0);
- /* Assure that "cache_timeout + random_variation" is never negative. */
- if (random_timeout > cache_timeout) {
- INFO("rrdtool plugin: Adjusting \"RandomTimeout\" to %.3f seconds.",
- CDTIME_T_TO_DOUBLE(cache_timeout));
- random_timeout = cache_timeout;
- }
-
return (int64_t)cdrand_range(-random_timeout, random_timeout);
} /* int64_t rrd_get_random_variation */
cache_flush_last = cdtime();
if (cache_timeout == 0) {
+ random_timeout = 0;
cache_flush_timeout = 0;
} else if (cache_flush_timeout < cache_timeout) {
INFO("rrdtool plugin: \"CacheFlush %u\" is less than \"CacheTimeout %u\". "
cache_flush_timeout = 10 * cache_timeout;
}
+ /* Assure that "cache_timeout + random_variation" is never negative. */
+ if (random_timeout > cache_timeout) {
+ INFO("rrdtool plugin: Adjusting \"RandomTimeout\" to %.3f seconds.",
+ CDTIME_T_TO_DOUBLE(cache_timeout));
+ random_timeout = cache_timeout;
+ }
+
pthread_mutex_unlock(&cache_lock);
status = plugin_thread_create(&queue_thread, /* attr = */ NULL,