From 359116f52568a76ddcd8f124ce3975df6a262f26 Mon Sep 17 00:00:00 2001 From: Alexander Minbaev Date: Fri, 5 Mar 2021 09:05:42 -0600 Subject: [PATCH] add if check for number of scheduled pods to be greater than 0 --- test/integration/scheduler_perf/util.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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) } } }