feedback from @nf
Blake Mizerany
10 years ago
0 | 0 |
// +build go1.1
|
|
1 |
|
1 | 2 |
package quantile_test
|
2 | 3 |
|
3 | 4 |
import (
|
|
62 | 63 |
// minute.
|
63 | 64 |
|
64 | 65 |
ch := make(chan float64)
|
65 | |
go readStreamValues(ch)
|
|
66 |
go sendStreamValues(ch)
|
66 | 67 |
|
67 | 68 |
tick := time.NewTicker(1 * time.Minute)
|
68 | 69 |
q := quantile.NewTargeted(0.90, 0.95, 0.99)
|
|
77 | 78 |
}
|
78 | 79 |
}
|
79 | 80 |
|
80 | |
func readStreamValues(ch chan float64) {
|
|
81 |
func sendStreamValues(ch chan float64) {
|
81 | 82 |
// Use your imagination
|
82 | 83 |
}
|
83 | 84 |
|
75 | 75 |
return newStream(f)
|
76 | 76 |
}
|
77 | 77 |
|
78 | |
// Stream calculates quantiles for a stream of float64s.
|
|
78 |
// Stream computes quantiles for a stream of float64s.
|
79 | 79 |
type Stream struct {
|
80 | 80 |
*stream
|
81 | 81 |
b Samples
|
|
100 | 100 |
}
|
101 | 101 |
}
|
102 | 102 |
|
103 | |
// Query returns the calculated qth percentiles value. If s was created with
|
|
103 |
// Query returns the computes qth percentiles value. If s was created with
|
104 | 104 |
// NewTargeted, and q is not in the set of quantiles provided a priori, Query
|
105 | 105 |
// will return an unspecified result.
|
106 | 106 |
func (s *Stream) Query(q float64) float64 {
|