Skip to content

Commit

Permalink
20324: Adds get/set_max_num_threads support for trace files, MINOR (#133
Browse files Browse the repository at this point in the history
)
  • Loading branch information
howsohazard authored May 17, 2024
1 parent 4386493 commit f642775
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/Amalgam/AmalgamTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,34 @@ int32_t RunAmalgamTrace(std::istream *in_stream, std::ostream *out_stream, std::
{
response = AMALGAM_VERSION_STRING;
}
else if(command == "GET_MAX_NUM_THREADS")
{
#if defined(MULTITHREAD_SUPPORT)
response = std::to_string(Concurrency::GetMaxNumThreads());
#else
response = FAILURE_RESPONSE;
#endif
}
else if(command == "SET_MAX_NUM_THREADS")
{
#if defined(MULTITHREAD_SUPPORT)
response = SUCCESS_RESPONSE;
try
{
auto num_threads = std::stoll(input);
if(num_threads >= 0)
Concurrency::SetMaxNumThreads(static_cast<size_t>(num_threads));
else
response = FAILURE_RESPONSE;
}
catch(...)
{
response = FAILURE_RESPONSE;
}
#else
response = FAILURE_RESPONSE;
#endif
}
else if(command == "EXIT")
{
break;
Expand Down

0 comments on commit f642775

Please sign in to comment.