Esempio n. 1
0
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")
		}
	})
}
Esempio n. 2
0
func BenchmarkUnique(b *testing.B) {
	c := New(ioutil.Discard)

	b.RunParallel(func(p *testing.PB) {
		for p.Next() {
			c.Unique("users", "1", "program:counters")
		}
	})
}
Esempio n. 3
0
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")
		}
	})
}
Esempio n. 4
0
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")
		}
	})
}
Esempio n. 5
0
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)
		}
	})
}
Esempio n. 7
0
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())
}