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

Function DoUnaryCall

benchmark/benchmark.go:280–291  ·  view source on GitHub ↗

DoUnaryCall performs a unary RPC with given stub and request and response sizes.

(tc testgrpc.BenchmarkServiceClient, reqSize, respSize int)

Source from the content-addressed store, hash-verified

278
279// DoUnaryCall performs a unary RPC with given stub and request and response sizes.
280func DoUnaryCall(tc testgrpc.BenchmarkServiceClient, reqSize, respSize int) error {
281 pl := NewPayload(testpb.PayloadType_COMPRESSABLE, reqSize)
282 req := &testpb.SimpleRequest{
283 ResponseType: pl.Type,
284 ResponseSize: int32(respSize),
285 Payload: pl,
286 }
287 if _, err := tc.UnaryCall(context.Background(), req); err != nil {
288 return fmt.Errorf("/BenchmarkService/UnaryCall(_, _) = _, %v, want _, <nil>", err)
289 }
290 return nil
291}
292
293// DoStreamingRoundTrip performs a round trip for a single streaming rpc.
294func DoStreamingRoundTrip(stream testgrpc.BenchmarkService_StreamingCallClient, reqSize, respSize int) error {

Callers 3

unaryCallerFunction · 0.92
unaryLoopMethod · 0.92
poissonUnaryMethod · 0.92

Calls 3

NewPayloadFunction · 0.85
UnaryCallMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected