Add response time stats

This commit is contained in:
Justin Li
2014-07-22 14:57:36 -04:00
parent 0a4c290ecb
commit 7fce8c9ad4
3 changed files with 47 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package stats
import (
"encoding/json"
"math"
"sort"
"sync/atomic"
@@ -78,6 +79,10 @@ func (p *Percentile) index() int64 {
return idx
}
func (p *Percentile) MarshalJSON() ([]byte, error) {
return json.Marshal(p.Value())
}
func round(value float64) int64 {
if value < 0.0 {
value -= 0.5