Fix query for the number of cpu cores.

This commit is contained in:
Florian 2021-12-29 13:46:54 +01:00
parent be23d85eda
commit d679478769
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)