The gopsutil cpu implementation changed in v3
Was supposed to return the number of vCPU (i.e. nproc) Before, both "physical" and "logical" returned the same. The returned information should match cpuinfo and lscpu: CPU(s) = Socket(s) x Core(s) each x Thread(s) eachpull/10270/head
parent
c2bb8385d6
commit
7e9d58c468
|
@ -979,8 +979,8 @@ func validateCPUCount(drvName string) {
|
|||
var cpuCount int
|
||||
if driver.BareMetal(drvName) {
|
||||
|
||||
// Uses the gopsutil cpu package to count the number of physical cpu cores
|
||||
ci, err := cpu.Counts(false)
|
||||
// Uses the gopsutil cpu package to count the number of logical cpu cores
|
||||
ci, err := cpu.Counts(true)
|
||||
if err != nil {
|
||||
klog.Warningf("Unable to get CPU info: %v", err)
|
||||
} else {
|
||||
|
|
|
@ -181,6 +181,7 @@ var (
|
|||
// cachedCPUInfo will return a cached cpu info
|
||||
func cachedCPUInfo() ([]cpu.InfoStat, error) {
|
||||
if cachedCPU == nil {
|
||||
// one InfoStat per thread
|
||||
i, err := cpu.Info()
|
||||
cachedCPU = &i
|
||||
cachedCPUErr = &err
|
||||
|
|
Loading…
Reference in New Issue