2018-02-05 21:05:59 +00:00
|
|
|
package sysinfo // import "github.com/docker/docker/pkg/sysinfo"
|
2016-06-25 14:26:00 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
)
|
|
|
|
|
2022-12-16 13:59:32 +00:00
|
|
|
// NumCPU returns the number of CPUs. On Linux and Windows, it returns
|
|
|
|
// the number of CPUs which are currently online. On other platforms,
|
|
|
|
// it's the equivalent of [runtime.NumCPU].
|
2016-06-25 14:26:00 +00:00
|
|
|
func NumCPU() int {
|
2022-12-16 13:59:32 +00:00
|
|
|
if ncpu := numCPU(); ncpu > 0 {
|
|
|
|
return ncpu
|
|
|
|
}
|
2016-06-25 14:26:00 +00:00
|
|
|
return runtime.NumCPU()
|
|
|
|
}
|