MCPcopy
hub / github.com/grpc/grpc-go / BenchmarkCancelContextErrNoErr

Function BenchmarkCancelContextErrNoErr

benchmark/primitives/context_test.go:29–37  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

27const defaultTestTimeout = 10 * time.Second
28
29func BenchmarkCancelContextErrNoErr(b *testing.B) {
30 ctx, cancel := context.WithCancel(context.Background())
31 for i := 0; i < b.N; i++ {
32 if err := ctx.Err(); err != nil {
33 b.Fatal("error")
34 }
35 }
36 cancel()
37}
38
39func BenchmarkCancelContextErrGotErr(b *testing.B) {
40 ctx, cancel := context.WithCancel(context.Background())

Callers

nothing calls this directly

Calls 2

ErrMethod · 0.80
FatalMethod · 0.65

Tested by

no test coverage detected