summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f5177e4)
raw | patch | inline | side by side (parent: f5177e4)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Wed, 19 Jul 2017 12:28:15 +0000 (19:28 +0700) | ||
committer | Florian Forster <octo@collectd.org> | |
Thu, 20 Jul 2017 05:56:11 +0000 (07:56 +0200) |
* Handle "CacheFlush" as a double
* Updated documentation spelling
* Updated documentation spelling
src/collectd.conf.pod | patch | blob | history | |
src/rrdtool.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index f94669ada70fd77a3f8b8f57822d029592928306..784c4053f38b8815ff18bf587ddae2caf0b88bdd 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
etc.) some values may still be in the cache. If B<CacheFlush> is set, then
every I<Seconds> seconds the entire cache is searched for entries older than
B<CacheTimeout> + B<RandomTimeout> seconds. The entries found are written to
-disk. Since entire cache scan is kind of expensive and does nothing under normal
-circumstances, this value should not be too small. 900 seconds might be a good
-value, though setting this to 7200 seconds doesn't normally do much harm either.
-
-Default value for this option is 10x of B<CacheTimeout>.
-If value of B<CacheFlush> less than value of B<CacheTimeout> then default value
-used too.
+disk. Since scanning the entire cache is kind of expensive and does nothing
+under normal circumstances, this value should not be too small. 900 seconds
+might be a good value, though setting this to 7200 seconds doesn't normally
+do much harm either.
+
+Defaults to 10x B<CacheTimeout>.
+B<CacheFlush> must be larger than or equal to B<CacheTimeout>, otherwise the
+above default is used.
=item B<CacheTimeout> I<Seconds>
diff --git a/src/rrdtool.c b/src/rrdtool.c
index dd2df0fe422d62d16ab5f16f29a344f9e132e45c..f12b1ce3e2665ad9e284e6e40cc5af9808f01a13 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
}
cache_timeout = DOUBLE_TO_CDTIME_T(tmp);
} else if (strcasecmp("CacheFlush", key) == 0) {
- int tmp = atoi(value);
+ double tmp = atof(value);
if (tmp < 0) {
fprintf(stderr, "rrdtool: `CacheFlush' must "
"be greater than 0.\n");
"be greater than 0.\n");
return (1);
}
- cache_flush_timeout = TIME_T_TO_CDTIME_T(tmp);
+ cache_flush_timeout = DOUBLE_TO_CDTIME_T(tmp);
} else if (strcasecmp("DataDir", key) == 0) {
char *tmp;
size_t len;
random_timeout = 0;
cache_flush_timeout = 0;
} else if (cache_flush_timeout < cache_timeout) {
- INFO("rrdtool plugin: \"CacheFlush %u\" is less than \"CacheTimeout %u\". "
- "Ajusting \"CacheFlush\" to %u seconds.",
- (unsigned int)CDTIME_T_TO_TIME_T(cache_flush_timeout),
- (unsigned int)CDTIME_T_TO_TIME_T(cache_timeout),
- (unsigned int)CDTIME_T_TO_TIME_T(cache_timeout * 10));
+ INFO("rrdtool plugin: \"CacheFlush %.3f\" is less than \"CacheTimeout %.3f\". "
+ "Ajusting \"CacheFlush\" to %.3f seconds.",
+ CDTIME_T_TO_DOUBLE(cache_flush_timeout),
+ CDTIME_T_TO_DOUBLE(cache_timeout),
+ CDTIME_T_TO_DOUBLE(cache_timeout * 10));
cache_flush_timeout = 10 * cache_timeout;
}