MCPcopy
hub / github.com/google/gvisor / BenchmarkCreateWithMaxFD

Function BenchmarkCreateWithMaxFD

pkg/sentry/kernel/fd_table_test.go:268–284  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

266}
267
268func BenchmarkCreateWithMaxFD(b *testing.B) {
269 const maxLimit = 1 << 31
270 runTest(b, func(ctx context.Context, _ *FDTable, fd *vfs.FileDescription, limitSet *limits.LimitSet) {
271 // Remove the previous limit.
272 limitSet.Set(limits.NumberOfFiles, limits.Limit{maxLimit, maxLimit}, true)
273
274 for i := 0; i < b.N; i++ {
275 fdTable := new(FDTable)
276 fdTable.init()
277 _, err := fdTable.NewFDAt(ctx, maxLimit-1, fd, FDFlags{})
278 if err != nil {
279 b.Fatalf("fdTable.NewFDs: got %v, wanted nil", err)
280 }
281 fdTable.DecRef(ctx)
282 }
283 })
284}
285
286func BenchmarkFDLookupAndDecRefConcurrent(b *testing.B) {
287 b.StopTimer() // Setup.

Callers

nothing calls this directly

Calls 7

runTestFunction · 0.70
SetMethod · 0.65
FatalfMethod · 0.65
DecRefMethod · 0.65
newFunction · 0.50
initMethod · 0.45
NewFDAtMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…