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

Function BenchmarkCancelContextChannelNoErr

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

Source from the content-addressed store, hash-verified

47}
48
49func BenchmarkCancelContextChannelNoErr(b *testing.B) {
50 ctx, cancel := context.WithCancel(context.Background())
51 for i := 0; i < b.N; i++ {
52 select {
53 case <-ctx.Done():
54 b.Fatal("error: ctx.Done():", ctx.Err())
55 default:
56 }
57 }
58 cancel()
59}
60
61func BenchmarkCancelContextChannelGotErr(b *testing.B) {
62 ctx, cancel := context.WithCancel(context.Background())

Callers

nothing calls this directly

Calls 3

ErrMethod · 0.80
FatalMethod · 0.65
DoneMethod · 0.45

Tested by

no test coverage detected