diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-02-02 19:43:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-02 19:43:19 +0000 |
commit | 3ea23f84818a816104ccdcf6b836ac4bb3a7c366 (patch) | |
tree | 7ccc25d859c97ca2cad5282d7e0f4eb9a445c2e3 /libpod | |
parent | a01f708df5d378af6ff4e804464b34f7c9be2b5d (diff) | |
parent | a417e6e0cc46593eb10d2ce3d5102df39d44b8dd (diff) | |
download | podman-3ea23f84818a816104ccdcf6b836ac4bb3a7c366.tar.gz podman-3ea23f84818a816104ccdcf6b836ac4bb3a7c366.tar.bz2 podman-3ea23f84818a816104ccdcf6b836ac4bb3a7c366.zip |
Merge pull request #284 from mheon/update_vendors
Update containerd/cgroups to fix perf issue
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/stats.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libpod/stats.go b/libpod/stats.go index 47fb16194..faccc2366 100644 --- a/libpod/stats.go +++ b/libpod/stats.go @@ -66,8 +66,8 @@ func (c *Container) GetContainerStats(previousStats *ContainerStats) (*Container stats.PIDs = cgroupStats.Pids.Current - 1 } stats.BlockInput, stats.BlockOutput = calculateBlockIO(cgroupStats) - stats.CPUNano = cgroupStats.Cpu.Usage.Total - stats.SystemNano = cgroupStats.Cpu.Usage.Kernel + stats.CPUNano = cgroupStats.CPU.Usage.Total + stats.SystemNano = cgroupStats.CPU.Usage.Kernel // TODO Figure out where to get the Netout stuff. //stats.NetInput, stats.NetOutput = getContainerNetIO(cgroupStats) return stats, nil @@ -99,21 +99,21 @@ func getContainerNetIO(stats *libcontainer.Stats) (received uint64, transmitted return } -func calculateCPUPercent(stats *cgroups.Stats, previousCPU, previousSystem uint64) float64 { +func calculateCPUPercent(stats *cgroups.Metrics, previousCPU, previousSystem uint64) float64 { var ( cpuPercent = 0.0 - cpuDelta = float64(stats.Cpu.Usage.Total - previousCPU) + cpuDelta = float64(stats.CPU.Usage.Total - previousCPU) systemDelta = float64(uint64(time.Now().UnixNano()) - previousSystem) ) if systemDelta > 0.0 && cpuDelta > 0.0 { // gets a ratio of container cpu usage total, multiplies it by the number of cores (4 cores running // at 100% utilization should be 400% utilization), and multiplies that by 100 to get a percentage - cpuPercent = (cpuDelta / systemDelta) * float64(len(stats.Cpu.Usage.PerCpu)) * 100 + cpuPercent = (cpuDelta / systemDelta) * float64(len(stats.CPU.Usage.PerCPU)) * 100 } return cpuPercent } -func calculateBlockIO(stats *cgroups.Stats) (read uint64, write uint64) { +func calculateBlockIO(stats *cgroups.Metrics) (read uint64, write uint64) { for _, blkIOEntry := range stats.Blkio.IoServiceBytesRecursive { switch strings.ToLower(blkIOEntry.Op) { case "read": |