Python package #1

Merged
h4kor merged 7 commits from python_package into main 2022-11-20 16:14:56 +00:00
1 changed files with 10 additions and 3 deletions
Showing only changes of commit 19cea83bd8 - Show all commits

View File

@ -12,9 +12,16 @@ pub struct Runner {
impl Runner {
pub fn new(iterations: usize, threads: usize) -> Self {
Self {
iterations,
threads,
if threads == 0 {
match std::thread::available_parallelism() {
Ok(threads) => Runner { iterations, threads: threads.get() },
Err(_) => Runner { iterations, threads: 1 },
}
} else {
Runner {
iterations,
threads,
}
}
}