mozilla/telemetry-dashboard — pull request #6 by jonasfj (2013-09-03 15:25:55+00:00)
Title: Adding an estimate for percentiles

As the summary says this function computes **an** estimate for percentiles, this estimate is reasonable in most cases...

I'm certainly open to other ideas as to what would make a good estimate for percentiles.
The function `estimatePercentile` in this patch works by counting occurrences until we find the bucket that contains the occurrence of interest. If we're looking for the median (50th percentile) in a histogram with 300 occurrences, we'll get the bucket containing the 150th occurrence. Once this bucket is found, we'll assume occurrences inside the bucket is uniformly distributed and interpolate the median from this.