mirror of https://github.com/k3s-io/k3s
Merge pull request #64936 from wgliang/master.scheduler_perf_test
Automatic merge from submit-queue (batch tested with PRs 64122, 64936, 65288, 65383). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. fix integer divide by zero panic **What this PR does / why we need it**: /kind bug fix integer divide by zero panic when time.Since(start) < 1s **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #64935 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```pull/8/head
commit
75339d33cf
|
@ -162,8 +162,12 @@ func schedulePods(config *testConfig) int32 {
|
|||
// return the worst-case-scenario interval that was seen during this time.
|
||||
// Note this should never be low due to cold-start, so allow bake in sched time if necessary.
|
||||
if len(scheduled) >= config.numPods {
|
||||
consumed := int(time.Since(start) / time.Second)
|
||||
if consumed <= 0 {
|
||||
consumed = 1
|
||||
}
|
||||
fmt.Printf("Scheduled %v Pods in %v seconds (%v per second on average). min QPS was %v\n",
|
||||
config.numPods, int(time.Since(start)/time.Second), config.numPods/int(time.Since(start)/time.Second), minQps)
|
||||
config.numPods, consumed, config.numPods/consumed, minQps)
|
||||
return minQps
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue