1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
use num_cpus;

/*
 * Get Number of CPUs
 */
pub(crate) fn cpus() -> usize {
    let mut n: usize = num_cpus::get();
    if n < num_cpus::get_physical() {
        n = num_cpus::get_physical();
    }
    n
}