Esempio n. 1
0
func BenchmarkDieterbe(b *testing.B) {
	s := newServer()
	c, err := dieterbe.NewClient(true, addr, prefix)
	if err != nil {
		b.Fatal(err)
	}
	b.StartTimer()
	for i := 0; i < b.N; i++ {
		c.Increment(counterKey)
		c.Gauge(gaugeKey, gaugeValue)
		c.Timing(timingKey, tValInt64)
	}
	c.Close()
	b.StopTimer()
	s.Close()
}
Esempio n. 2
0
func BenchmarkDieterbeRaw(b *testing.B) {
	s := newServer()
	c, err := dieterbe.NewClient(true, addr, prefix)
	if err != nil {
		b.Fatal(err)
	}
	b.StartTimer()
	counter := []byte(fmt.Sprintf("%s:1|c", counterKey))
	gauge := []byte(fmt.Sprintf("%s:%d|g", gaugeKey, gaugeValue))
	timing := []byte(fmt.Sprintf("%s:%d|ms", timingKey, tValInt))
	for i := 0; i < b.N; i++ {
		c.SendRaw(counter)
		c.SendRaw(gauge)
		c.SendRaw(timing)
	}
	c.Close()
	b.StopTimer()
	s.Close()
}