@@ -137,6 +137,7 @@ CLParser::Usage(const std::string& msg)
137137 " profiling>"
138138 << std::endl;
139139 std::cerr << " \t --percentile <percentile>" << std::endl;
140+ std::cerr << " \t --request-count <number of requests>" << std::endl;
140141 std::cerr << " \t DEPRECATED OPTIONS" << std::endl;
141142 std::cerr << " \t -t <number of concurrent requests>" << std::endl;
142143 std::cerr << " \t -c <maximum concurrency>" << std::endl;
@@ -463,6 +464,14 @@ CLParser::Usage(const std::string& msg)
463464 " that the average latency is used to determine stability" ,
464465 18 )
465466 << std::endl;
467+ std::cerr
468+ << FormatMessage (
469+ " --request-count: Specifies a total number of requests to "
470+ " use for measurement. The default is 0, which means that there is "
471+ " no request count and the measurement will proceed using windows "
472+ " until stabilization is detected." ,
473+ 18 )
474+ << std::endl;
466475 std::cerr << FormatMessage (
467476 " --serial-sequences: Enables serial sequence mode "
468477 " where a maximum of one request is outstanding at a time "
@@ -879,6 +888,7 @@ CLParser::ParseCommandLine(int argc, char** argv)
879888 {" request-period" , required_argument, 0 , 59 },
880889 {" request-parameter" , required_argument, 0 , 60 },
881890 {" endpoint" , required_argument, 0 , 61 },
891+ {" request-count" , required_argument, 0 , 62 },
882892 {0 , 0 , 0 , 0 }};
883893
884894 // Parse commandline...
@@ -1614,6 +1624,13 @@ CLParser::ParseCommandLine(int argc, char** argv)
16141624 params_->endpoint = optarg;
16151625 break ;
16161626 }
1627+ case 62 : {
1628+ if (std::stoi (optarg) < 0 ) {
1629+ Usage (" Failed to parse --request-count. The value must be > 0." );
1630+ }
1631+ params_->request_count = std::stoi (optarg);
1632+ break ;
1633+ }
16171634 case ' v' :
16181635 params_->extra_verbose = params_->verbose ;
16191636 params_->verbose = true ;
@@ -1705,6 +1722,13 @@ CLParser::ParseCommandLine(int argc, char** argv)
17051722 // Will be using user-provided time intervals, hence no control variable.
17061723 params_->search_mode = SearchMode::NONE;
17071724 }
1725+
1726+ // When the request-count feature is enabled, override the measurement mode to
1727+ // be count windows with a window size of the requested count
1728+ if (params_->request_count ) {
1729+ params_->measurement_mode = MeasurementMode::COUNT_WINDOWS;
1730+ params_->measurement_request_count = params_->request_count ;
1731+ }
17081732}
17091733
17101734void
@@ -1874,6 +1898,31 @@ CLParser::VerifyOptions()
18741898 " binary search mode." );
18751899 }
18761900
1901+ if (params_->request_count != 0 ) {
1902+ if (params_->using_concurrency_range ) {
1903+ if (params_->request_count < params_->concurrency_range .start ) {
1904+ Usage (" request-count can not be less than concurrency" );
1905+ }
1906+ if (params_->concurrency_range .start < params_->concurrency_range .end ) {
1907+ Usage (
1908+ " request-count not supported with multiple concurrency values in "
1909+ " one run" );
1910+ }
1911+ }
1912+ if (params_->using_request_rate_range ) {
1913+ if (params_->request_count <
1914+ static_cast <int >(params_->request_rate_range [0 ])) {
1915+ Usage (" request-count can not be less than request-rate" );
1916+ }
1917+ if (params_->request_rate_range [SEARCH_RANGE::kSTART ] <
1918+ params_->request_rate_range [SEARCH_RANGE::kEND ]) {
1919+ Usage (
1920+ " request-count not supported with multiple request-rate values in "
1921+ " one run" );
1922+ }
1923+ }
1924+ }
1925+
18771926 if (params_->kind == cb::TENSORFLOW_SERVING) {
18781927 if (params_->protocol != cb::ProtocolType::GRPC) {
18791928 Usage (
0 commit comments