ce = calloc(1, sizeof(*ce));
if (ce == NULL) {
ERROR("utils_cache: cache_alloc: calloc failed.");
ce = calloc(1, sizeof(*ce));
if (ce == NULL) {
ERROR("utils_cache: cache_alloc: calloc failed.");
}
ce = cache_alloc(ds->ds_num);
if (ce == NULL) {
sfree(key_copy);
ERROR("uc_insert: cache_alloc (%zu) failed.", ds->ds_num);
}
ce = cache_alloc(ds->ds_num);
if (ce == NULL) {
sfree(key_copy);
ERROR("uc_insert: cache_alloc (%zu) failed.", ds->ds_num);
if (c_avl_insert(cache_tree, key_copy, ce) != 0) {
sfree(key_copy);
ERROR("uc_insert: c_avl_insert failed.");
if (c_avl_insert(cache_tree, key_copy, ce) != 0) {
sfree(key_copy);
ERROR("uc_insert: c_avl_insert failed.");
} /* int uc_check_timeout */
int uc_update(const data_set_t *ds, const value_list_t *vl) {
} /* int uc_check_timeout */
int uc_update(const data_set_t *ds, const value_list_t *vl) {
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("uc_update: FORMAT_VL failed.");
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("uc_update: FORMAT_VL failed.");
{
status = uc_insert(ds, vl, name);
pthread_mutex_unlock(&cache_lock);
{
status = uc_insert(ds, vl, name);
pthread_mutex_unlock(&cache_lock);
"last cache update = %.3f;",
name, CDTIME_T_TO_DOUBLE(vl->time),
CDTIME_T_TO_DOUBLE(ce->last_time));
"last cache update = %.3f;",
name, CDTIME_T_TO_DOUBLE(vl->time),
CDTIME_T_TO_DOUBLE(ce->last_time));
pthread_mutex_unlock(&cache_lock);
ERROR("uc_update: Don't know how to handle data source type %i.",
ds->ds[i].type);
pthread_mutex_unlock(&cache_lock);
ERROR("uc_update: Don't know how to handle data source type %i.",
ds->ds[i].type);
} /* switch (ds->ds[i].type) */
DEBUG("uc_update: %s: ds[%zu] = %lf", name, i, ce->values_gauge[i]);
} /* switch (ds->ds[i].type) */
DEBUG("uc_update: %s: ds[%zu] = %lf", name, i, ce->values_gauge[i]);
} /* gauge_t *uc_get_rate_by_name */
gauge_t *uc_get_rate(const data_set_t *ds, const value_list_t *vl) {
} /* gauge_t *uc_get_rate_by_name */
gauge_t *uc_get_rate(const data_set_t *ds, const value_list_t *vl) {
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("utils_cache: uc_get_rate: FORMAT_VL failed.");
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("utils_cache: uc_get_rate: FORMAT_VL failed.");
"but uc_get_rate_by_name returned %zu.",
ds->type, ds->ds_num, ret_num);
sfree(ret);
"but uc_get_rate_by_name returned %zu.",
ds->type, ds->ds_num, ret_num);
sfree(ret);
/* Handle the "no values" case here, to avoid the error message when
* calloc() returns NULL. */
pthread_mutex_unlock(&cache_lock);
/* Handle the "no values" case here, to avoid the error message when
* calloc() returns NULL. */
pthread_mutex_unlock(&cache_lock);
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("uc_get_state: FORMAT_VL failed.");
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("uc_get_state: FORMAT_VL failed.");
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("uc_set_state: FORMAT_VL failed.");
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("uc_set_state: FORMAT_VL failed.");
status = c_avl_get(cache_tree, name, (void *)&ce);
if (status != 0) {
pthread_mutex_unlock(&cache_lock);
status = c_avl_get(cache_tree, name, (void *)&ce);
if (status != 0) {
pthread_mutex_unlock(&cache_lock);
realloc(ce->history, sizeof(*ce->history) * num_steps * ce->values_num);
if (tmp == NULL) {
pthread_mutex_unlock(&cache_lock);
realloc(ce->history, sizeof(*ce->history) * num_steps * ce->values_num);
if (tmp == NULL) {
pthread_mutex_unlock(&cache_lock);
} /* int uc_get_history_by_name */
int uc_get_history(const data_set_t *ds, const value_list_t *vl,
} /* int uc_get_history_by_name */
int uc_get_history(const data_set_t *ds, const value_list_t *vl,
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("utils_cache: uc_get_history: FORMAT_VL failed.");
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("utils_cache: uc_get_history: FORMAT_VL failed.");
- return (uc_get_history_by_name(name, ret_history, num_steps, num_ds));
+ return uc_get_history_by_name(name, ret_history, num_steps, num_ds);
} /* int uc_get_history */
int uc_get_hits(const data_set_t *ds, const value_list_t *vl) {
} /* int uc_get_history */
int uc_get_hits(const data_set_t *ds, const value_list_t *vl) {
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("uc_get_hits: FORMAT_VL failed.");
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("uc_get_hits: FORMAT_VL failed.");
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("uc_set_hits: FORMAT_VL failed.");
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("uc_set_hits: FORMAT_VL failed.");
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("uc_inc_hits: FORMAT_VL failed.");
if (FORMAT_VL(name, sizeof(name), vl) != 0) {
ERROR("uc_inc_hits: FORMAT_VL failed.");
pthread_mutex_lock(&cache_lock);
iter->iter = c_avl_get_iterator(cache_tree);
if (iter->iter == NULL) {
free(iter);
pthread_mutex_lock(&cache_lock);
iter->iter = c_avl_get_iterator(cache_tree);
if (iter->iter == NULL) {
free(iter);
} /* uc_iter_t *uc_get_iterator */
int uc_iterator_next(uc_iter_t *iter, char **ret_name) {
int status;
if (iter == NULL)
} /* uc_iter_t *uc_get_iterator */
int uc_iterator_next(uc_iter_t *iter, char **ret_name) {
int status;
if (iter == NULL)
while ((status = c_avl_iterator_next(iter->iter, (void *)&iter->name,
(void *)&iter->entry)) == 0) {
while ((status = c_avl_iterator_next(iter->iter, (void *)&iter->name,
(void *)&iter->entry)) == 0) {
int uc_iterator_get_time(uc_iter_t *iter, cdtime_t *ret_time) {
if ((iter == NULL) || (iter->entry == NULL) || (ret_time == NULL))
int uc_iterator_get_time(uc_iter_t *iter, cdtime_t *ret_time) {
if ((iter == NULL) || (iter->entry == NULL) || (ret_time == NULL))
} /* int uc_iterator_get_name */
int uc_iterator_get_values(uc_iter_t *iter, value_t **ret_values,
size_t *ret_num) {
if ((iter == NULL) || (iter->entry == NULL) || (ret_values == NULL) ||
(ret_num == NULL))
} /* int uc_iterator_get_name */
int uc_iterator_get_values(uc_iter_t *iter, value_t **ret_values,
size_t *ret_num) {
if ((iter == NULL) || (iter->entry == NULL) || (ret_values == NULL) ||
(ret_num == NULL))
for (size_t i = 0; i < iter->entry->values_num; ++i)
*ret_values[i] = iter->entry->values_raw[i];
*ret_num = iter->entry->values_num;
for (size_t i = 0; i < iter->entry->values_num; ++i)
*ret_values[i] = iter->entry->values_raw[i];
*ret_num = iter->entry->values_num;
} /* int uc_iterator_get_values */
int uc_iterator_get_interval(uc_iter_t *iter, cdtime_t *ret_interval) {
if ((iter == NULL) || (iter->entry == NULL) || (ret_interval == NULL))
} /* int uc_iterator_get_values */
int uc_iterator_get_interval(uc_iter_t *iter, cdtime_t *ret_interval) {
if ((iter == NULL) || (iter->entry == NULL) || (ret_interval == NULL))
status = FORMAT_VL(name, sizeof(name), vl);
if (status != 0) {
ERROR("utils_cache: uc_get_meta: FORMAT_VL failed.");
status = FORMAT_VL(name, sizeof(name), vl);
if (status != 0) {
ERROR("utils_cache: uc_get_meta: FORMAT_VL failed.");
status = c_avl_get(cache_tree, name, (void *)&ce);
if (status != 0) {
pthread_mutex_unlock(&cache_lock);
status = c_avl_get(cache_tree, name, (void *)&ce);
if (status != 0) {
pthread_mutex_unlock(&cache_lock);
} /* }}} meta_data_t *uc_get_meta */
/* Sorry about this preprocessor magic, but it really makes this file much
} /* }}} meta_data_t *uc_get_meta */
/* Sorry about this preprocessor magic, but it really makes this file much
status = wrap_function(meta, key); \
pthread_mutex_unlock(&cache_lock); \
status = wrap_function(meta, key); \
pthread_mutex_unlock(&cache_lock); \
}
int uc_meta_data_exists(const value_list_t *vl,
const char *key) UC_WRAP(meta_data_exists)
}
int uc_meta_data_exists(const value_list_t *vl,
const char *key) UC_WRAP(meta_data_exists)
status = wrap_function(meta, key, value); \
pthread_mutex_unlock(&cache_lock); \
status = wrap_function(meta, key, value); \
pthread_mutex_unlock(&cache_lock); \