Merge pull request #17604 from RyanDeng/fix_cpuPercent_extremelyHigh

fix the bug: cpu percent will extremely high
This commit is contained in:
Sebastiaan van Stijn 2015-11-16 17:26:29 +01:00
Родитель 92487d7fb4 e222c61594
Коммит 7c5cdda74e
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -317,9 +317,9 @@ func calculateCPUPercent(previousCPU, previousSystem uint64, v *types.StatsJSON)
var (
cpuPercent = 0.0
// calculate the change for the cpu usage of the container in between readings
cpuDelta = float64(v.CPUStats.CPUUsage.TotalUsage - previousCPU)
cpuDelta = float64(v.CPUStats.CPUUsage.TotalUsage) - float64(previousCPU)
// calculate the change for the entire system between readings
systemDelta = float64(v.CPUStats.SystemUsage - previousSystem)
systemDelta = float64(v.CPUStats.SystemUsage) - float64(previousSystem)
)
if systemDelta > 0.0 && cpuDelta > 0.0 {