Unverified Commit 75339d33 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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 ```
parents 1ad1c8c7 2417f953
...@@ -162,8 +162,12 @@ func schedulePods(config *testConfig) int32 { ...@@ -162,8 +162,12 @@ func schedulePods(config *testConfig) int32 {
// return the worst-case-scenario interval that was seen during this time. // 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. // Note this should never be low due to cold-start, so allow bake in sched time if necessary.
if len(scheduled) >= config.numPods { 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", 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 return minQps
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment