in src/Histogram.h [101:123]
T GetPercentile(double p) const
{
// ISSUE-REVIEW
// What do the 0th and 100th percentile really mean?
if ((p < 0) || (p > 1))
{
throw std::invalid_argument("Percentile must be >= 0 and <= 1");
}
const double target = GetSampleSize() * p;
unsigned cur = 0;
for (auto i : _GetSortedData())
{
cur += i.second;
if (cur >= target)
{
return i.first;
}
}
throw std::runtime_error("Percentile is undefined");
}