MCPcopy
hub / github.com/influxdata/telegraf / BenchmarkEncodeMetric

Function BenchmarkEncodeMetric

plugins/serializers/msgpack/metric_gen_test.go:207–219  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

205}
206
207func BenchmarkEncodeMetric(b *testing.B) {
208 v := Metric{}
209 var buf bytes.Buffer
210 msgp.Encode(&buf, &v)
211 b.SetBytes(int64(buf.Len()))
212 en := msgp.NewWriter(msgp.Nowhere)
213 b.ReportAllocs()
214 b.ResetTimer()
215 for i := 0; i < b.N; i++ {
216 v.EncodeMsg(en)
217 }
218 en.Flush()
219}
220
221func BenchmarkDecodeMetric(b *testing.B) {
222 v := Metric{}

Callers

nothing calls this directly

Calls 4

LenMethod · 0.95
EncodeMsgMethod · 0.95
FlushMethod · 0.80
EncodeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…