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

Function BenchmarkFork

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

Source from the content-addressed store, hash-verified

247}
248
249func BenchmarkFork(b *testing.B) {
250 b.StopTimer() // Setup.
251
252 runTest(b, func(ctx context.Context, fdTable *FDTable, fd *vfs.FileDescription, limitSet *limits.LimitSet) {
253 for i := 0; i < maxFD; i++ {
254 _, err := fdTable.NewFDAt(ctx, int32(i), fd, FDFlags{})
255 if err != nil {
256 b.Fatalf("fdTable.NewFDs: got %v, wanted nil", err)
257 }
258 }
259
260 b.StartTimer() // Benchmark.
261 for i := 0; i < b.N; i++ {
262 t := fdTable.Fork(ctx, maxFD)
263 t.DecRef(ctx)
264 }
265 })
266}
267
268func BenchmarkCreateWithMaxFD(b *testing.B) {
269 const maxLimit = 1 << 31

Callers

nothing calls this directly

Calls 5

runTestFunction · 0.70
FatalfMethod · 0.65
ForkMethod · 0.65
DecRefMethod · 0.65
NewFDAtMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…