diff --git a/test/integration/scheduler_perf/util.go b/test/integration/scheduler_perf/util.go index ec89e46d81a..c82e58b0b74 100644 --- a/test/integration/scheduler_perf/util.go +++ b/test/integration/scheduler_perf/util.go @@ -256,12 +256,15 @@ func (tc *throughputCollector) run(ctx context.Context) { } scheduled := len(podsScheduled) - samplingRatioSeconds := float64(throughputSampleFrequency) / float64(time.Second) - throughput := float64(scheduled-lastScheduledCount) / samplingRatioSeconds - tc.schedulingThroughputs = append(tc.schedulingThroughputs, throughput) - lastScheduledCount = scheduled + // Only do sampling if number of scheduled pods is greater than zero + if scheduled > 0 { + samplingRatioSeconds := float64(throughputSampleFrequency) / float64(time.Second) + throughput := float64(scheduled-lastScheduledCount) / samplingRatioSeconds + tc.schedulingThroughputs = append(tc.schedulingThroughputs, throughput) + lastScheduledCount = scheduled + klog.Infof("%d pods scheduled", lastScheduledCount) + } - klog.Infof("%d pods scheduled", lastScheduledCount) } } }