From 336b0ced00c5c36316e97cb1120c684dde3ce7b3 Mon Sep 17 00:00:00 2001 From: Sven Rebhan Date: Thu, 2 Dec 2021 18:03:36 +0100 Subject: [PATCH] Add benchmark for MIB loading. --- plugins/inputs/snmp/snmp_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/inputs/snmp/snmp_test.go b/plugins/inputs/snmp/snmp_test.go index 7962bede41278..4f18a458a48e2 100644 --- a/plugins/inputs/snmp/snmp_test.go +++ b/plugins/inputs/snmp/snmp_test.go @@ -1295,3 +1295,12 @@ func TestTableJoinNoIndexAsTag_walk(t *testing.T) { require.Contains(t, tb.Rows, rtr2) require.Contains(t, tb.Rows, rtr3) } + +func BenchmarkMibLoading(b *testing.B) { + log := testutil.Logger{} + path := []string{"testdata"} + for i := 0; i < b.N; i++ { + err := snmp.LoadMibsFromPath(path, log) + require.NoError(b, err) + } +}