mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
fix the bug: cpu percent will extremely high
Signed-off-by: Chao Deng <sheldon.d1018@gmail.com>
This commit is contained in:
parent
c6fd886db3
commit
e222c61594
1 changed files with 2 additions and 2 deletions
|
@ -206,9 +206,9 @@ func calculateCPUPercent(previousCPU, previousSystem uint64, v *types.StatsJSON)
|
||||||
var (
|
var (
|
||||||
cpuPercent = 0.0
|
cpuPercent = 0.0
|
||||||
// calculate the change for the cpu usage of the container in between readings
|
// 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
|
// 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 {
|
if systemDelta > 0.0 && cpuDelta > 0.0 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue