浏览代码

pkg/fileutils: add BenchmarkGetTotalUsedFds

    go test -bench ^BenchmarkGetTotalUsedFds$ -run ^$ ./pkg/fileutils/
    goos: linux
    goarch: arm64
    pkg: github.com/docker/docker/pkg/fileutils
    BenchmarkGetTotalUsedFds-5   	  149272	      7896 ns/op	     945 B/op	      20 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 03390be5fae9309bbaa27cfd73b6ed61babe9e71)
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
Sebastiaan van Stijn 2 年之前
父节点
当前提交
55c8d163d7
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      pkg/fileutils/fileutils_test.go

+ 7 - 0
pkg/fileutils/fileutils_test.go

@@ -216,3 +216,10 @@ func TestCreateIfNotExistsFile(t *testing.T) {
 		t.Fatalf("Should have been a file, seems it's not")
 	}
 }
+
+func BenchmarkGetTotalUsedFds(b *testing.B) {
+	b.ReportAllocs()
+	for i := 0; i < b.N; i++ {
+		_ = GetTotalUsedFds()
+	}
+}