Merge pull request #10270 from afbjorklund/gopsutil-cpu
The gopsutil cpu implementation changed in v3pull/10273/head
commit
a1e7799db8
|
@ -979,8 +979,8 @@ func validateCPUCount(drvName string) {
|
||||||
var cpuCount int
|
var cpuCount int
|
||||||
if driver.BareMetal(drvName) {
|
if driver.BareMetal(drvName) {
|
||||||
|
|
||||||
// Uses the gopsutil cpu package to count the number of physical cpu cores
|
// Uses the gopsutil cpu package to count the number of logical cpu cores
|
||||||
ci, err := cpu.Counts(false)
|
ci, err := cpu.Counts(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Warningf("Unable to get CPU info: %v", err)
|
klog.Warningf("Unable to get CPU info: %v", err)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -181,6 +181,7 @@ var (
|
||||||
// cachedCPUInfo will return a cached cpu info
|
// cachedCPUInfo will return a cached cpu info
|
||||||
func cachedCPUInfo() ([]cpu.InfoStat, error) {
|
func cachedCPUInfo() ([]cpu.InfoStat, error) {
|
||||||
if cachedCPU == nil {
|
if cachedCPU == nil {
|
||||||
|
// one InfoStat per thread
|
||||||
i, err := cpu.Info()
|
i, err := cpu.Info()
|
||||||
cachedCPU = &i
|
cachedCPU = &i
|
||||||
cachedCPUErr = &err
|
cachedCPUErr = &err
|
||||||
|
|
Loading…
Reference in New Issue