Permalink
Please sign in to comment.
Browse files
Merge pull request #30 from performancecopilot/histogram
add Histogram, closes #28
- Loading branch information...
Showing
with
996 additions
and 0 deletions.
- +2 −0 client.go
- +72 −0 client_test.go
- +37 −0 examples/basic_histogram/main.go
- +9 −0 instance.go
- +226 −0 metrics.go
- +21 −0 vendor/github.com/codahale/hdrhistogram/LICENSE
- +15 −0 vendor/github.com/codahale/hdrhistogram/README.md
- +563 −0 vendor/github.com/codahale/hdrhistogram/hdr.go
- +45 −0 vendor/github.com/codahale/hdrhistogram/window.go
- +6 −0 vendor/vendor.json
| @@ -0,0 +1,37 @@ | ||
| +package main | ||
| + | ||
| +import ( | ||
| + "fmt" | ||
| + "math/rand" | ||
| + "time" | ||
| + | ||
| + "github.com/performancecopilot/speed" | ||
| +) | ||
| + | ||
| +func main() { | ||
| + max := int64(100) | ||
| + | ||
| + c, err := speed.NewPCPClient("histogram_test") | ||
| + if err != nil { | ||
| + panic(err) | ||
| + } | ||
| + | ||
| + m, err := speed.NewPCPHistogram("hist", 0, max, 5, "a sample histogram") | ||
| + if err != nil { | ||
| + panic(err) | ||
| + } | ||
| + | ||
| + c.MustRegister(m) | ||
| + | ||
| + c.MustStart() | ||
| + defer c.MustStop() | ||
| + | ||
| + for i := 0; i < 60; i++ { | ||
| + v := rand.Int63n(max) | ||
| + | ||
| + fmt.Println("recording", v) | ||
| + m.MustRecord(v) | ||
| + | ||
| + time.Sleep(time.Second) | ||
| + } | ||
| +} |
226
metrics.go
Oops, something went wrong.
0 comments on commit
8b3fa33