Skip to content

Commit

Permalink
Update check on thread number larger than logical cores
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan committed Jun 13, 2024
1 parent 7aab4a6 commit bb680a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion stress/src/throughput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ where

let arg_num = arg.unwrap();

if arg_num > 0 && arg_num <= num_threads {
if arg_num > 0 {
if arg_num > num_cpus::get() {
println!("Specified {} threads which is larger than the number of logical cores ({})!", arg_num, num_threads);
}
num_threads = arg_num as usize;
} else {
eprintln!("Invalid command line argument {} as number of threads. Make sure the value is above 0 and less than or equal to number of available logical cores ({}).", arg_num, num_threads);
Expand Down

0 comments on commit bb680a4

Please sign in to comment.