Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,12 @@ void SendFlow(int src, int dst, uint64_t maxPacketCount,
const char* send_lat_env = std::getenv("AS_SEND_LAT");
if (send_lat_env) {
try {
send_lat = std::stoi(send_lat_env);
send_lat = 1000 * std::stoi(send_lat_env);
} catch (const std::invalid_argument& e) {
NcclLog->writeLog(NcclLogLevel::ERROR,"send_lat set error");
exit(-1);
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception handling for std::stoi only catches std::invalid_argument but not std::out_of_range, which can also be thrown when the converted value would fall out of the range of int. Consider catching both exceptions or using a catch-all for std::exception to handle both cases consistently.

Suggested change
exit(-1);
exit(-1);
} catch (const std::out_of_range& e) {
NcclLog->writeLog(NcclLogLevel::ERROR,"send_lat set error");
exit(-1);

Copilot uses AI. Check for mistakes.
}
}
send_lat *= 1000;
flow_input.idx++;
if(real_PacketCount == 0) real_PacketCount = 1;
MockNcclLog* NcclLog = MockNcclLog::getInstance();
Expand Down