Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lkomali committed Jul 16, 2024
1 parent bf7e90c commit b4f006b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/c++/perf_analyzer/command_line_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1715,9 +1715,8 @@ CLParser::ParseCommandLine(int argc, char** argv)

// Overriding the max_threads default for request_rate search
if (!params_->max_threads_specified && params_->targeting_concurrency()) {
params_->max_threads = 16;
params_->max_threads =
std::max(params_->max_threads, params_->concurrency_range.end);
std::max(DEFAULT_MAX_THREADS, params_->concurrency_range.end);
}

if (params_->using_custom_intervals) {
Expand Down
1 change: 1 addition & 0 deletions src/c++/perf_analyzer/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ constexpr static const uint32_t STABILITY_ERROR = 2;
constexpr static const uint32_t OPTION_ERROR = 3;

constexpr static const uint32_t GENERIC_ERROR = 99;
constexpr static const size_t DEFAULT_MAX_THREADS = 16;

const double DELAY_PCT_THRESHOLD{1.0};

Expand Down
17 changes: 8 additions & 9 deletions src/c++/perf_analyzer/test_command_line_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,11 @@ class TestCLParser : public CLParser {
void
CheckValidRange(
std::vector<char*>& args, char* option_name, TestCLParser& parser,
PAParamsPtr& act, bool& using_range, Range<uint64_t>& range,
PAParamsPtr& exp)
PAParamsPtr& act, bool& using_range, Range<uint64_t>& range, size_t* max_threads)
{
SUBCASE("start:end provided")
{
exp->max_threads = 400;
*max_threads = 400;
args.push_back(option_name);
args.push_back("100:400"); // start:end

Expand All @@ -394,7 +393,7 @@ CheckValidRange(

SUBCASE("start:end:step provided")
{
exp->max_threads = 400;
*max_threads = 400;
args.push_back(option_name);
args.push_back("100:400:10"); // start:end:step

Expand Down Expand Up @@ -1134,7 +1133,7 @@ TEST_CASE("Testing Command Line Parser")

CheckValidRange(
args, option_name, parser, act, exp->using_concurrency_range,
exp->concurrency_range, exp);
exp->concurrency_range, &(exp->max_threads));
CheckInvalidRange(args, option_name, parser, act, check_params);

SUBCASE("wrong separator")
Expand Down Expand Up @@ -1177,7 +1176,7 @@ TEST_CASE("Testing Command Line Parser")
check_params = false;
}

SUBCASE("concurrency-range.end < 16")
SUBCASE("Max threads set to default when concurrency-range < 16")
{
args.push_back(option_name);
args.push_back("10:10"); // start
Expand All @@ -1195,7 +1194,7 @@ TEST_CASE("Testing Command Line Parser")
exp->max_threads = 16;
}

SUBCASE("concurrency-range.end == 16")
SUBCASE("Max_threads set to default when concurrency-range.end = 16")
{
args.push_back(option_name);
args.push_back("10:16"); // start
Expand All @@ -1213,7 +1212,7 @@ TEST_CASE("Testing Command Line Parser")
exp->max_threads = 16;
}

SUBCASE("concurrency-range.end > 16")
SUBCASE("Max_threads set to concurrency-range.end when concurrency-range.end > 16")
{
args.push_back(option_name);
args.push_back("10:40"); // start
Expand Down Expand Up @@ -1267,7 +1266,7 @@ TEST_CASE("Testing Command Line Parser")

CheckValidRange(
args, option_name, parser, act, exp->is_using_periodic_concurrency_mode,
exp->periodic_concurrency_range, exp);
exp->periodic_concurrency_range, &(exp->max_threads));

CheckInvalidRange(args, option_name, parser, act, check_params);

Expand Down

0 comments on commit b4f006b

Please sign in to comment.