func BenchmarkGauge(b *testing.B) { c := New(ioutil.Discard) b.RunParallel(func(p *testing.PB) { for p.Next() { c.Gauge("free.memory", 512, "program:counters") } }) }
func BenchmarkUnique(b *testing.B) { c := New(ioutil.Discard) b.RunParallel(func(p *testing.PB) { for p.Next() { c.Unique("users", "1", "program:counters") } }) }
func BenchmarkDuration(b *testing.B) { c := New(ioutil.Discard) b.RunParallel(func(p *testing.PB) { for p.Next() { c.Duration("response.time", time.Second, "program:counters") } }) }
func BenchmarkHistogram(b *testing.B) { c := New(ioutil.Discard) b.RunParallel(func(p *testing.PB) { for p.Next() { c.Histogram("response.size", 512, "program:server") } }) }
func BenchmarkDecr(b *testing.B) { c := New(ioutil.Discard) b.RunParallel(func(p *testing.PB) { for p.Next() { c.Decr("counter", "program:counters") } }) }
func BenchmarkChanson(b *testing.B) { lo := buildLargeObject(b.N) b.ResetTimer() cs := New(ioutil.Discard) cs.Object(func(obj Object) { for k, v := range lo { obj.Set(k, v) } }) }
func ExampleObject() { buf := bytes.NewBuffer(nil) cs := New(ioutil.Discard) cs.Object(func(obj Object) { obj.Set("foo", "bar") obj.Set("fun", func(enc *json.Encoder) { enc.Encode([]int{1, 2, 3}) }) }) fmt.Printf("%v", buf.String()) }