File tree 1 file changed +8
-5
lines changed
test/integration/scheduler_perf
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -256,12 +256,15 @@ func (tc *throughputCollector) run(ctx context.Context) {
256
256
}
257
257
258
258
scheduled := len (podsScheduled )
259
- samplingRatioSeconds := float64 (throughputSampleFrequency ) / float64 (time .Second )
260
- throughput := float64 (scheduled - lastScheduledCount ) / samplingRatioSeconds
261
- tc .schedulingThroughputs = append (tc .schedulingThroughputs , throughput )
262
- lastScheduledCount = scheduled
259
+ // Only do sampling if number of scheduled pods is greater than zero
260
+ if scheduled > 0 {
261
+ samplingRatioSeconds := float64 (throughputSampleFrequency ) / float64 (time .Second )
262
+ throughput := float64 (scheduled - lastScheduledCount ) / samplingRatioSeconds
263
+ tc .schedulingThroughputs = append (tc .schedulingThroughputs , throughput )
264
+ lastScheduledCount = scheduled
265
+ klog .Infof ("%d pods scheduled" , lastScheduledCount )
266
+ }
263
267
264
- klog .Infof ("%d pods scheduled" , lastScheduledCount )
265
268
}
266
269
}
267
270
}
You can’t perform that action at this time.
0 commit comments