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