mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #99844 from minbaev/scheduler-test-perf-optimization
add if check for number of scheduled pods to be greater than 0
This commit is contained in:
commit
841cb4adc4
@ -256,13 +256,16 @@ func (tc *throughputCollector) run(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scheduled := len(podsScheduled)
|
scheduled := len(podsScheduled)
|
||||||
|
// Only do sampling if number of scheduled pods is greater than zero
|
||||||
|
if scheduled > 0 {
|
||||||
samplingRatioSeconds := float64(throughputSampleFrequency) / float64(time.Second)
|
samplingRatioSeconds := float64(throughputSampleFrequency) / float64(time.Second)
|
||||||
throughput := float64(scheduled-lastScheduledCount) / samplingRatioSeconds
|
throughput := float64(scheduled-lastScheduledCount) / samplingRatioSeconds
|
||||||
tc.schedulingThroughputs = append(tc.schedulingThroughputs, throughput)
|
tc.schedulingThroughputs = append(tc.schedulingThroughputs, throughput)
|
||||||
lastScheduledCount = scheduled
|
lastScheduledCount = scheduled
|
||||||
|
|
||||||
klog.Infof("%d pods scheduled", lastScheduledCount)
|
klog.Infof("%d pods scheduled", lastScheduledCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user