Get the number of CPU cores available on the system.
fn main {
let logical = @num_cpus.get()
let physical = @num_cpus.get_physical()
println("logical: \{logical}, physical: \{physical}")
}fn get() -> Intlet logical_cores = @num_cpus.get()
println("Logical CPU cores: \{logical_cores}")fn get_physical() -> Intlet physical_cores = @num_cpus.get_physical()
let logical_cores = @num_cpus.get()
println("Physical cores: \{physical_cores}")
println("Logical cores: \{logical_cores}")
println("Hyperthreading ratio: \{logical_cores / physical_cores}")Install
Download zipGet the number of CPU cores available on the system.