X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fdaemon%2Futils_cache.c;h=ea7c3e33b4ab9e064b26e26ae6657d983dc605ea;hp=18aa66b74ad14c6b869b298992d3540c85a34e64;hb=1159cb5d383c55a80a0db100b8f7aadcf44740a5;hpb=c144ae4659e129a929afb67706a54604220fef43 diff --git a/src/daemon/utils_cache.c b/src/daemon/utils_cache.c index 18aa66b7..ea7c3e33 100644 --- a/src/daemon/utils_cache.c +++ b/src/daemon/utils_cache.c @@ -222,8 +222,6 @@ int uc_init(void) { } /* int uc_init */ int uc_check_timeout(void) { - cdtime_t now = cdtime(); - struct { char *key; cdtime_t time; @@ -232,6 +230,7 @@ int uc_check_timeout(void) { size_t expired_num = 0; pthread_mutex_lock(&cache_lock); + cdtime_t now = cdtime(); /* Build a list of entries to be flushed */ c_avl_iterator_t *iter = c_avl_get_iterator(cache_tree); @@ -423,6 +422,9 @@ int uc_get_rate_by_name(const char *name, gauge_t **ret_values, /* remove missing values from getval */ if (ce->state == STATE_MISSING) { + DEBUG("utils_cache: uc_get_rate_by_name: requested metric \"%s\" is in " + "state \"missing\".", + name); status = -1; } else { ret_num = ce->values_num; @@ -466,7 +468,7 @@ gauge_t *uc_get_rate(const data_set_t *ds, const value_list_t *vl) { /* This is important - the caller has no other way of knowing how many * values are returned. */ - if (ret_num != (size_t)ds->ds_num) { + if (ret_num != ds->ds_num) { ERROR("utils_cache: uc_get_rate: ds[%s] has %zu values, " "but uc_get_rate_by_name returned %zu.", ds->type, ds->ds_num, ret_num); @@ -911,6 +913,15 @@ int uc_iterator_get_interval(uc_iter_t *iter, cdtime_t *ret_interval) { return 0; } /* int uc_iterator_get_name */ +int uc_iterator_get_meta(uc_iter_t *iter, meta_data_t **ret_meta) { + if ((iter == NULL) || (iter->entry == NULL) || (ret_meta == NULL)) + return -1; + + *ret_meta = meta_data_clone(iter->entry->meta); + + return 0; +} /* int uc_iterator_get_meta */ + /* * Meta data interface */