(v *container.StatsResponse)
| 200 | } |
| 201 | |
| 202 | func calculateCPUPercentWindows(v *container.StatsResponse) float64 { |
| 203 | // Max number of 100ns intervals between the previous time read and now |
| 204 | possIntervals := uint64(v.Read.Sub(v.PreRead).Nanoseconds()) // Start with number of ns intervals |
| 205 | possIntervals /= 100 // Convert to number of 100ns intervals |
| 206 | possIntervals *= uint64(v.NumProcs) // Multiply by the number of processors |
| 207 | |
| 208 | // Percentage avoiding divide-by-zero |
| 209 | if possIntervals > 0 { |
| 210 | intervalsUsed := v.CPUStats.CPUUsage.TotalUsage - v.PreCPUStats.CPUUsage.TotalUsage |
| 211 | return float64(intervalsUsed) / float64(possIntervals) * 100.0 |
| 212 | } |
| 213 | return 0.00 |
| 214 | } |
| 215 | |
| 216 | func calculateBlockIO(blkio container.BlkioStats) (uint64, uint64) { |
| 217 | var blkRead, blkWrite uint64 |
no outgoing calls
no test coverage detected
searching dependent graphs…