*
* @param percentile A floating point number between 0.0 and 1.0.
* @return An estimate of k-percentile latency in whole milliseconds.
*/
public int kPercentileLatency(double percentile) {
final HistogramData data = m_latencyHistogram.getHistogramData();
if (data.getTotalCount() == 0) return 0;
percentile = Math.max(0.0, percentile);
//Convert from micros to millis for return value, round to nearest integer
return (int) (Math.round(data.getValueAtPercentile(percentile * 100.0)) / 1000.0);
}