Set default percentile window to 256 samples

This commit is contained in:
Justin Li
2014-07-22 23:13:59 -04:00
parent b6f0fc79cb
commit 727370fedc
3 changed files with 20 additions and 10 deletions

View File

@@ -19,9 +19,19 @@ type Percentile struct {
value uint64 // These bits are really a float64.
}
// NewPercentile returns a Percentile with a given threshold
// NewPercentile returns a Percentile with a given threshold.
func NewPercentile(percentile float64) *Percentile {
return &Percentile{
percentile: percentile,
// 256 samples is fast, and accurate for most distributions.
values: make([]float64, 0, 256),
}
}
// NewPercentileWithWindow returns a Percentile with a given threshold
// and window size (accuracy).
func NewPercentile(percentile float64, sampleWindow int) *Percentile {
func NewPercentileWithWindow(percentile float64, sampleWindow int) *Percentile {
return &Percentile{
percentile: percentile,
values: make([]float64, 0, sampleWindow),