Fix cpu count estimation (#281)

* Fix query for the number of cpu cores.

* Fix formating

* Fix formating again...
This commit is contained in:
Florian Vahl 2021-12-29 17:56:22 +01:00 committed by GitHub
parent be23d85eda
commit 350cb09338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -76,7 +76,10 @@ func (c *Docker) Stop() {
}
func (c *Docker) ReadCPU(stats *api.Stats) {
ncpus := uint8(len(stats.CPUStats.CPUUsage.PercpuUsage))
ncpus := uint8(stats.CPUStats.OnlineCPUs)
if ncpus == 0 {
ncpus = uint8(len(stats.CPUStats.CPUUsage.PercpuUsage))
}
total := float64(stats.CPUStats.CPUUsage.TotalUsage)
system := float64(stats.CPUStats.SystemCPUUsage)