2019-10-11 13:16:02 +02:00
|
|
|
module runtime
|
2019-11-15 14:14:28 +01:00
|
|
|
|
|
|
|
import os
|
|
|
|
|
2020-07-20 16:36:44 +02:00
|
|
|
pub fn nr_cpus() int {
|
2019-11-15 14:14:28 +01:00
|
|
|
mut nr := int(C.GetCurrentProcessorNumber())
|
|
|
|
if nr == 0 {
|
|
|
|
nr = os.getenv('NUMBER_OF_PROCESSORS').int()
|
|
|
|
}
|
|
|
|
return nr
|
|
|
|
}
|