File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -182,13 +182,11 @@ func calculateCPUPercentWindows(v *container.StatsResponse) float64 {
182182 // Max number of 100ns intervals between the previous time read and now
183183 possIntervals := uint64 (v .Read .Sub (v .PreRead ).Nanoseconds ()) // Start with number of ns intervals
184184 possIntervals /= 100 // Convert to number of 100ns intervals
185- possIntervals *= uint64 (v .NumProcs ) // Multiple by the number of processors
186-
187- // Intervals used
188- intervalsUsed := v .CPUStats .CPUUsage .TotalUsage - v .PreCPUStats .CPUUsage .TotalUsage
185+ possIntervals *= uint64 (v .NumProcs ) // Multiply by the number of processors
189186
190187 // Percentage avoiding divide-by-zero
191188 if possIntervals > 0 {
189+ intervalsUsed := v .CPUStats .CPUUsage .TotalUsage - v .PreCPUStats .CPUUsage .TotalUsage
192190 return float64 (intervalsUsed ) / float64 (possIntervals ) * 100.0
193191 }
194192 return 0.00
You can’t perform that action at this time.
0 commit comments