mirror of
https://github.com/containers/podman.git
synced 2025-11-30 18:18:18 +08:00
14 lines
305 B
Go
14 lines
305 B
Go
package 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 returns [runtime.NumCPU].
|
|
func NumCPU() int {
|
|
if ncpu := numCPU(); ncpu > 0 {
|
|
return ncpu
|
|
}
|
|
return runtime.NumCPU()
|
|
}
|