numcpu.NumCPU() returns the number of logical CPUs usable by the current process.
Android doesn't return max number of CPUs by runtime.NumCPU(), but just returns number of "working" CPUs. So this library checks sysfs directory directly for linux, and just returns runtime.NumCPU() for others.
- git
- go
are required to compile.
$ go get -u github.com/AidosKuneen/numcpu
import "github.com/AidosKuneen/numcpu"
n:=numcpu.NumCPU()
Golang Standard Library BSD 3-clause License