mirror of
https://github.com/containers/podman.git
synced 2025-12-10 07:42:12 +08:00
Merge pull request #5172 from giuseppe/api-fix-cpu-stats
api: fix the CPU stats reported
This commit is contained in:
@@ -66,7 +66,9 @@ func (c *Container) GetContainerStats(previousStats *ContainerStats) (*Container
|
||||
}
|
||||
stats.BlockInput, stats.BlockOutput = calculateBlockIO(cgroupStats)
|
||||
stats.CPUNano = cgroupStats.CPU.Usage.Total
|
||||
stats.CPUSystemNano = cgroupStats.CPU.Usage.Kernel
|
||||
stats.SystemNano = now
|
||||
stats.PerCPU = cgroupStats.CPU.Usage.PerCPU
|
||||
// Handle case where the container is not in a network namespace
|
||||
if netStats != nil {
|
||||
stats.NetInput = netStats.TxBytes
|
||||
|
||||
@@ -2,17 +2,19 @@ package libpod
|
||||
|
||||
// ContainerStats contains the statistics information for a running container
|
||||
type ContainerStats struct {
|
||||
ContainerID string
|
||||
Name string
|
||||
CPU float64
|
||||
CPUNano uint64
|
||||
SystemNano uint64
|
||||
MemUsage uint64
|
||||
MemLimit uint64
|
||||
MemPerc float64
|
||||
NetInput uint64
|
||||
NetOutput uint64
|
||||
BlockInput uint64
|
||||
BlockOutput uint64
|
||||
PIDs uint64
|
||||
ContainerID string
|
||||
Name string
|
||||
PerCPU []uint64
|
||||
CPU float64
|
||||
CPUNano uint64
|
||||
CPUSystemNano uint64
|
||||
SystemNano uint64
|
||||
MemUsage uint64
|
||||
MemLimit uint64
|
||||
MemPerc float64
|
||||
NetInput uint64
|
||||
NetOutput uint64
|
||||
BlockInput uint64
|
||||
BlockOutput uint64
|
||||
PIDs uint64
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user