diff --git a/portlist/portlist_test.go b/portlist/portlist_test.go index 08d7995a6d829..1987c91d5d140 100644 --- a/portlist/portlist_test.go +++ b/portlist/portlist_test.go @@ -195,12 +195,23 @@ func TestSameInodes(t *testing.T) { } func BenchmarkGetList(b *testing.B) { + benchmarkGetList(b, false) +} + +func BenchmarkGetListIncremental(b *testing.B) { + benchmarkGetList(b, true) +} + +func benchmarkGetList(b *testing.B, incremental bool) { b.ReportAllocs() var p Poller for i := 0; i < b.N; i++ { - _, err := p.getList() + pl, err := p.getList() if err != nil { b.Fatal(err) } + if incremental { + p.prev = pl + } } }