[tarantool-patches] Re: [PATCH 12/18] histogram: add function for computing lower bound percentile estimate

Vladimir Davydov vdavydov.dev at gmail.com
Fri Aug 24 11:30:08 MSK 2018


On Mon, Aug 20, 2018 at 02:29:16PM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev at gmail.com> [18/08/16 23:03]:
> > The value returned by histogram_percentile() is an upper bound estimate.
> > This is fine for measuring latency, because we are interested in the
> > worst, i.e. highest, observations, but doesn't suit particularly well
> > if we want to keep track of the lowest observations, as it is the case
> > with bandwidth. So this patch introduces histogram_percentile_lower(),
> > a function that is similar to histogram_percentile(), but returns a
> > lower bound estimate of the requested percentile.
> > ---
> 
> I need you to explain to me what's going on here (add comment?), sorry.

There's a comment to the function declaration.

Sorry, but I don't quite understand what else you want me to write here.
This function simply calculates a histogram percentile, similarly to
histogram_percentile(), but uses the lower bound estimate. I don't know
what else to say...

> 
>   
> > +int64_t
> > +histogram_percentile_lower(struct histogram *hist, int pct)
> > +{
> > +	size_t count = 0;
> > +
> > +	for (size_t i = 0; i < hist->n_buckets; i++) {
> > +		count += hist->buckets[i].count;
> > +		if (count * 100 > hist->total * pct)
> > +			return hist->buckets[i > 0 ? i - 1 : 0].max;
> > +	}
> > +	return hist->max;
> > +}



More information about the Tarantool-patches mailing list