MCPcopy Index your code
hub / github.com/docker/cli / calculateCPUPercentWindows

Function calculateCPUPercentWindows

cli/command/container/stats_helpers.go:202–214  ·  view source on GitHub ↗
(v *container.StatsResponse)

Source from the content-addressed store, hash-verified

200}
201
202func 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
216func calculateBlockIO(blkio container.BlkioStats) (uint64, uint64) {
217 var blkRead, blkWrite uint64

Callers 1

collectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…