6919b9879b
Use a single exported implementation, so that we can maintain the GoDoc string in one place, and use non-exported functions for the actual implementation (which were already in place). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
15 lines
371 B
Go
15 lines
371 B
Go
package sysinfo // import "github.com/docker/docker/pkg/sysinfo"
|
|
|
|
import (
|
|
"runtime"
|
|
)
|
|
|
|
// 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].
|
|
func NumCPU() int {
|
|
if ncpu := numCPU(); ncpu > 0 {
|
|
return ncpu
|
|
}
|
|
return runtime.NumCPU()
|
|
}
|