X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Futils_latency.h;h=9d878dabcda3ff0d7287f8a3dc332c73b2e3171e;hp=7c339c6068e814f90800cd9adc2c294e2f30febf;hb=da11ce02eb202b3e01d3e2d1b40f248a84430973;hpb=2079ee1517e34de372f58e7e2267ad5c71a8a41f diff --git a/src/utils_latency.h b/src/utils_latency.h index 7c339c60..9d878dab 100644 --- a/src/utils_latency.h +++ b/src/utils_latency.h @@ -28,6 +28,10 @@ #include "utils_time.h" +#ifndef HISTOGRAM_NUM_BINS +#define HISTOGRAM_NUM_BINS 1000 +#endif + struct latency_counter_s; typedef struct latency_counter_s latency_counter_t; @@ -44,4 +48,16 @@ size_t latency_counter_get_num(latency_counter_t *lc); cdtime_t latency_counter_get_average(latency_counter_t *lc); cdtime_t latency_counter_get_percentile(latency_counter_t *lc, double percent); -/* vim: set sw=2 sts=2 et : */ +/* + * NAME + * latency_counter_get_rate(counter,lower,upper,now) + * + * DESCRIPTION + * Calculates rate of latency values fall within requested interval. + * Interval specified as (lower,upper], i.e. the lower boundary is exclusive, + * the upper boundary is inclusive. + * When lower is zero, then the interval is (0, upper]. + * When upper is zero, then the interval is (lower, infinity). + */ +double latency_counter_get_rate(const latency_counter_t *lc, cdtime_t lower, + cdtime_t upper, const cdtime_t now);