@@ -77,26 +77,20 @@ namespace SeqCli.Cli.Commands;
7777class BenchCommand : Command
7878{
7979 readonly SeqConnectionFactory _connectionFactory ;
80- int _runs = 0 ;
80+ int _runs = 3 ;
8181 readonly ConnectionFeature _connection ;
8282 readonly DateRangeFeature _range ;
8383 string _cases = "" ;
8484 string _reportingServerUrl = "" ;
8585 string _reportingServerApiKey = "" ;
8686 ILogger ? _reportingLogger = null ;
8787
88- const int DefaultRuns = 3 ;
89-
9088 public BenchCommand ( SeqConnectionFactory connectionFactory )
9189 {
9290 _connectionFactory = connectionFactory ;
93- _runs = DefaultRuns ;
9491 Options . Add ( "r|runs=" , "The number of runs to execute" , r =>
9592 {
96- if ( ! int . TryParse ( r , out _runs ) )
97- {
98- _runs = DefaultRuns ;
99- }
93+ int . TryParse ( r , out _runs ) ;
10094 } ) ;
10195
10296 Options . Add (
@@ -123,7 +117,6 @@ protected override async Task<int> Run()
123117 {
124118 var connection = _connectionFactory . Connect ( _connection ) ;
125119 _reportingLogger = BuildReportingLogger ( ) ;
126-
127120 var cases = ReadCases ( _cases ) ;
128121 var runId = Guid . NewGuid ( ) . ToString ( "N" ) . Substring ( 0 , 4 ) ;
129122 var start = _range . Start ?? DateTime . UtcNow . AddDays ( - 7 ) ;
@@ -178,6 +171,9 @@ protected override async Task<int> Run()
178171 }
179172 }
180173
174+ /// <summary>
175+ /// Build a second Serilog logger for logging benchmark results.
176+ /// </summary>
181177 Logger BuildReportingLogger ( )
182178 {
183179 return string . IsNullOrWhiteSpace ( _reportingServerUrl )
@@ -195,6 +191,9 @@ Logger BuildReportingLogger()
195191 . CreateLogger ( ) ;
196192 }
197193
194+ /// <summary>
195+ /// Read and parse the bench test cases from the file supplied or else from a default file.
196+ /// </summary>
198197 static BenchCasesCollection ReadCases ( string filename )
199198 {
200199 var defaultCasesPath = Path . Combine ( Path . GetDirectoryName ( typeof ( BenchCommand ) . Assembly . Location ) ! , "Cli/Commands/Bench/BenchCases.json" ) ;
0 commit comments