From 83a324a46bec3332c078abc3a1986969c0f94fd2 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Fri, 16 Oct 2020 19:59:36 +0200 Subject: syscallcompat: add Lgetxattr benchmark --- internal/syscallcompat/sys_common_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'internal') diff --git a/internal/syscallcompat/sys_common_test.go b/internal/syscallcompat/sys_common_test.go index bbb6dbc..f53b0d2 100644 --- a/internal/syscallcompat/sys_common_test.go +++ b/internal/syscallcompat/sys_common_test.go @@ -313,3 +313,11 @@ func TestFstatat(t *testing.T) { t.Errorf("symlink size: expected=%d, got=%d", expectedSize, st.Size) } } + +// BenchmarkLgetxattr benchmarks Lgetxattr. Lgetxattr is very hot as the kernel +// queries security.capabilities for every file access. +func BenchmarkLgetxattr(b *testing.B) { + for i := 0; i < b.N; i++ { + Lgetxattr("/", "this.attr.does.not.exist") + } +} -- cgit v1.2.3