Merge pull request #10270 from afbjorklund/gopsutil-cpu

The gopsutil cpu implementation changed in v3
pull/10273/head
Medya Ghazizadeh 2021-01-26 12:53:38 -08:00 committed by GitHub
commit a1e7799db8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -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 {

View File

@ -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