return comparison;
}
for (size_t i = 0; i < tree_size(d1->num_buckets); i++) {
- if (d1->tree[i].maximum != d2->tree[i].maximum) { // will it work with doubles?
+ if (d1->tree[i].maximum !=
+ d2->tree[i].maximum) { // will it work with doubles?
comparison[0] = EINVAL;
return comparison;
}
}
- int res = compare_longint(d1->tree[0].bucket_counter, d2->tree[0].bucket_counter);
+ int res =
+ compare_longint(d1->tree[0].bucket_counter, d2->tree[0].bucket_counter);
for (size_t i = 1; i < tree_size(d1->num_buckets); i++) {
- int cur_res = compare_longint(d1->tree[i].bucket_counter, d2->tree[i].bucket_counter);
+ int cur_res =
+ compare_longint(d1->tree[i].bucket_counter, d2->tree[i].bucket_counter);
if (res != cur_res) {
if (cur_res == 0)
continue;
pthread_mutex_lock(&d2->mutex);
int *cmp_status = distribution_cmp(d1, d2);
- if (cmp_status[0] != 0 || cmp_status[1] == -1) { // i.e. d1 < d2 or can't compare
+ if (cmp_status[0] != 0 ||
+ cmp_status[1] == -1) { // i.e. d1 < d2 or can't compare
int status = cmp_status[0];
if (cmp_status[1] == -1)
status = ERANGE;
free(cmp_status);
return 0;
}
-
void destroy_buckets_array(buckets_array_t buckets_array);
/** @return true if distributions are equal false otherwise
- * This function holds both mutexes for d1 and d2. Be sure that you call the function with the same order of arguments everytime **/
+ * This function holds both mutexes for d1 and d2. Be sure that you call the
+ * function with the same order of arguments everytime **/
bool distribution_equals(distribution_t *d1, distribution_t *d2);
/** This function subtracts d2 from d1 if arguments are correct
- * if arguments are NULL pointers or the structure of distributions is different then EINVAL is returned
- * if distributions have the same structure but the second distribution is not less then the first then ERANGE is returned
- * in case of success returns 0
- * This function holds both mutexes for d1 and d2. Be sure that you call the function with the same order of arguments everytime **/
+ * if arguments are NULL pointers or the structure of distributions is
+ * different then EINVAL is returned if distributions have the same structure
+ * but the second distribution is not less then the first then ERANGE is
+ * returned in case of success returns 0
+ * This function holds both mutexes for d1 and d2. Be sure that you call the
+ * function with the same order of arguments everytime **/
int distribution_sub(distribution_t *d1, distribution_t *d2);
#endif // COLLECTD_DISTRIBUTION_H
\ No newline at end of file
case METRIC_TYPE_DISTRIBUTION: {
distribution_destroy(ce->distribution_increase);
ce->distribution_increase = distribution_clone(m->value.distribution);
- status =
- distribution_sub(ce->distribution_increase, ce->values_raw.distribution);
+ status = distribution_sub(ce->distribution_increase,
+ ce->values_raw.distribution);
if (status == ERANGE) {
distribution_destroy(ce->distribution_increase);
ce->distribution_increase = distribution_clone(m->value.distribution);
name);
status = -1;
} else {
- if (ce->distribution_increase == NULL &&
+ if (ce->distribution_increase == NULL &&
ce->values_raw.distribution !=
NULL) { /* check if the cache entry is not the distribution */
pthread_mutex_unlock(&cache_lock);
return status;
} /* value_t *uc_get_value */
-int uc_get_start_value_by_name(const char *name, value_t *ret_start_value, cdtime_t *ret_start_time) {
+int uc_get_start_value_by_name(const char *name, value_t *ret_start_value,
+ cdtime_t *ret_start_time) {
pthread_mutex_lock(&cache_lock);
cache_entry_t *ce = NULL;
int status = 0;
- if (c_avl_get(cache_tree, name, (void *) &ce) == 0) {
+ if (c_avl_get(cache_tree, name, (void *)&ce) == 0) {
assert(ce != NULL);
/* remove missing values from getval */
return status;
}
-int uc_get_start_value(metric_t const *m, value_t *ret_start_value, cdtime_t *ret_start_time) {
+int uc_get_start_value(metric_t const *m, value_t *ret_start_value,
+ cdtime_t *ret_start_time) {
strbuf_t buf = STRBUF_CREATE;
int status = metric_identity(&buf, m);
if (status != 0) {
int uc_get_rate(metric_t const *m, gauge_t *ret_value);
int uc_get_value_by_name(const char *name, value_t *ret_value);
int uc_get_value(metric_t const *m, value_t *ret_value);
-int uc_get_start_value_by_name(const char *name, value_t *ret_start_value, cdtime_t *ret_start_time);
-int uc_get_start_value(metric_t const *m, value_t *ret_start_value, cdtime_t *ret_start_time);
+int uc_get_start_value_by_name(const char *name, value_t *ret_start_value,
+ cdtime_t *ret_start_time);
+int uc_get_start_value(metric_t const *m, value_t *ret_start_value,
+ cdtime_t *ret_start_time);
size_t uc_get_size(void);
int uc_get_names(char ***ret_names, cdtime_t **ret_times, size_t *ret_number);