@@ -73,7 +73,7 @@ public static async Task<int> Main(string[] args)
73
73
rootCommand . AddOption ( new Option < int > ( new string [ ] { "--responseSize" } , "Response payload size" ) ) ;
74
74
rootCommand . AddOption ( new Option < GrpcClientType > ( new string [ ] { "--grpcClientType" } , ( ) => GrpcClientType . GrpcNetClient , "Whether to use Grpc.NetClient or Grpc.Core client" ) ) ;
75
75
rootCommand . AddOption ( new Option < int > ( new string [ ] { "--streams" } , ( ) => 1 , "Maximum concurrent streams per connection" ) ) ;
76
- rootCommand . AddOption ( new Option < bool > ( new string [ ] { "--clientCertificate " } , ( ) => false , "Flag indicating whether client sends a client certificate" ) ) ;
76
+ rootCommand . AddOption ( new Option < bool > ( new string [ ] { "--enableCertAuth " } , ( ) => false , "Flag indicating whether client sends a client certificate" ) ) ;
77
77
78
78
rootCommand . Handler = CommandHandler . Create < ClientOptions > ( async ( options ) =>
79
79
{
@@ -262,7 +262,9 @@ private static void CalculateLatency()
262
262
_latencyPerConnection [ i ] . Sort ( ) ;
263
263
}
264
264
265
- BenchmarksEventSource . Measure ( "grpc/latency/mean" , totalSum / totalCount ) ;
265
+ var mean = ( totalCount != 0 ) ? totalSum / totalCount : totalSum ;
266
+
267
+ BenchmarksEventSource . Measure ( "grpc/latency/mean" , mean ) ;
266
268
267
269
var allConnections = new List < double > ( ) ;
268
270
foreach ( var connectionLatency in _latencyPerConnection )
@@ -280,6 +282,13 @@ private static void CalculateLatency()
280
282
BenchmarksEventSource . Measure ( "grpc/latency/90" , GetPercentile ( 90 , allConnections ) ) ;
281
283
BenchmarksEventSource . Measure ( "grpc/latency/99" , GetPercentile ( 99 , allConnections ) ) ;
282
284
BenchmarksEventSource . Measure ( "grpc/latency/max" , GetPercentile ( 100 , allConnections ) ) ;
285
+
286
+ Log ( $ "Mean latency: { mean : 0.###} ms") ;
287
+ Log ( $ "Max latency: { GetPercentile ( 100 , allConnections ) : 0.###} ms") ;
288
+ Log ( $ "50 percentile latency: { GetPercentile ( 50 , allConnections ) : 0.###} ms") ;
289
+ Log ( $ "75 percentile latency: { GetPercentile ( 75 , allConnections ) : 0.###} ms") ;
290
+ Log ( $ "90 percentile latency: { GetPercentile ( 90 , allConnections ) : 0.###} ms") ;
291
+ Log ( $ "99 percentile latency: { GetPercentile ( 99 , allConnections ) : 0.###} ms") ;
283
292
}
284
293
else
285
294
{
@@ -291,15 +300,12 @@ private static void CalculateLatency()
291
300
totalCount += average . count ;
292
301
}
293
302
294
- if ( totalCount != 0 )
295
- {
296
- totalSum /= totalCount ;
297
- }
303
+ var mean = ( totalCount != 0 ) ? totalSum / totalCount : totalSum ;
298
304
299
- BenchmarksEventSource . Measure ( "grpc/latency/mean" , totalSum ) ;
305
+ BenchmarksEventSource . Measure ( "grpc/latency/mean" , mean ) ;
300
306
BenchmarksEventSource . Measure ( "grpc/latency/max" , _maxLatency ) ;
301
307
302
- Log ( $ "Mean latency: { totalSum : 0.###} ms") ;
308
+ Log ( $ "Mean latency: { mean : 0.###} ms") ;
303
309
Log ( $ "Max latency: { _maxLatency : 0.###} ms") ;
304
310
}
305
311
}
@@ -366,7 +372,7 @@ private static ChannelBase CreateChannel(string target)
366
372
{
367
373
default :
368
374
case GrpcClientType . GrpcCore :
369
- if ( _options . ClientCertificate )
375
+ if ( _options . EnableCertAuth )
370
376
{
371
377
throw new Exception ( "Client certificate not implemented for Grpc.Core" ) ;
372
378
}
@@ -386,7 +392,7 @@ private static ChannelBase CreateChannel(string target)
386
392
var httpClientHandler = new HttpClientHandler ( ) ;
387
393
httpClientHandler . UseProxy = false ;
388
394
httpClientHandler . AllowAutoRedirect = false ;
389
- if ( _options . ClientCertificate )
395
+ if ( _options . EnableCertAuth )
390
396
{
391
397
var basePath = Path . GetDirectoryName ( typeof ( Program ) . Assembly . Location ) ;
392
398
var certPath = Path . Combine ( basePath ! , "Certs" , "client.pfx" ) ;
0 commit comments