use thread estimation if threads is set to 0
This commit is contained in:
parent
d8b172c7fb
commit
19cea83bd8
|
@ -12,11 +12,18 @@ pub struct Runner {
|
||||||
|
|
||||||
impl Runner {
|
impl Runner {
|
||||||
pub fn new(iterations: usize, threads: usize) -> Self {
|
pub fn new(iterations: usize, threads: usize) -> Self {
|
||||||
Self {
|
if threads == 0 {
|
||||||
|
match std::thread::available_parallelism() {
|
||||||
|
Ok(threads) => Runner { iterations, threads: threads.get() },
|
||||||
|
Err(_) => Runner { iterations, threads: 1 },
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Runner {
|
||||||
iterations,
|
iterations,
|
||||||
threads,
|
threads,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn layout(self: &Self, number_of_nodes: usize, edge_list: Vec<(u32, u32)>) -> Vec<(f32, f32)> {
|
pub fn layout(self: &Self, number_of_nodes: usize, edge_list: Vec<(u32, u32)>) -> Vec<(f32, f32)> {
|
||||||
// let edges = connection_matrix(size);
|
// let edges = connection_matrix(size);
|
||||||
|
|
Loading…
Reference in New Issue