From 4f42d8a298a4be452bd853c708d5f8f05bbeb9ee Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Thu, 7 Dec 2017 15:11:04 -0800 Subject: [PATCH] Add benchmark test for single metric --- plugins/parsers/influx/parser_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/parsers/influx/parser_test.go b/plugins/parsers/influx/parser_test.go index 67833fc56..959fc0982 100644 --- a/plugins/parsers/influx/parser_test.go +++ b/plugins/parsers/influx/parser_test.go @@ -241,6 +241,17 @@ func TestParseInvalidInflux(t *testing.T) { } +func BenchmarkSingle(b *testing.B) { + parser := InfluxParser{} + b.ResetTimer() + for n := 0; n < b.N; n++ { + _, err := parser.Parse([]byte("cpu value=42\n")) + if err != nil { + panic(err) + } + } +} + func BenchmarkParse(b *testing.B) { var err error parser := InfluxParser{}