X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_latency.h;h=9930b7235368ddd368bd06c7c8c99a20ea267bcc;hb=db8b1cda4841f45af22d149c6bfc575e79289f75;hp=3787c779434c191957fe60a8fefae1063567e9a2;hpb=27aeac9988dde1d53e5df697ce0e1b8a951d091a;p=collectd.git diff --git a/src/utils_latency.h b/src/utils_latency.h index 3787c779..8fdf0249 100644 --- a/src/utils_latency.h +++ b/src/utils_latency.h @@ -1,6 +1,6 @@ /** * collectd - src/utils_latency.h - * Copyright (C) 2013 Florian Forster + * Copyright (C) 2013 Florian Forster * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -25,12 +25,17 @@ **/ #include "collectd.h" + #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; -latency_counter_t *latency_counter_create (); +latency_counter_t *latency_counter_create (void); void latency_counter_destroy (latency_counter_t *lc); void latency_counter_add (latency_counter_t *lc, cdtime_t latency); @@ -44,4 +49,18 @@ cdtime_t latency_counter_get_average (latency_counter_t *lc); cdtime_t latency_counter_get_percentile (latency_counter_t *lc, double percent); +/* + * 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); + /* vim: set sw=2 sts=2 et : */