Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf_bench_test start #54

Merged
merged 14 commits into from
Nov 20, 2020
Prev Previous commit
Next Next commit
add waiting time interval
  • Loading branch information
NiuJ1ao authored and NiuJ1ao committed Nov 20, 2020
commit 36a4969a376fe50434f140e7e6a08294f26fd648
12 changes: 6 additions & 6 deletions perf_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ func TestBenchRequestPerSecond(t *testing.T) {
vmID = 0
requestsPerSec = 1
concurrency = 1
totalSeconds = 5 // in second
// duration = time.Minute
totalSeconds = 5
duration = 30 * time.Second
)

funcPool = NewFuncPool(!isSaveMemoryConst, servedTh, pinnedFuncNum, isTestModeConst)
Expand Down Expand Up @@ -95,18 +95,18 @@ func TestBenchRequestPerSecond(t *testing.T) {
require.NoError(t, err, "Function returned error, "+message)

log.Printf("Instance finished in %f seconds", time.Since(start).Seconds())

// wait for time interval
// timeLeft := duration.Nanoseconds() - time.Since(tStart).Nanoseconds()
// require.GreaterOrEqual(t, timeLeft, 0)
timeLeft := duration.Nanoseconds() - time.Since(tStart).Nanoseconds()
log.Printf("timeLeft: %f seconds", float64(timeLeft)*1e-9)

// time.Sleep(time.Duration(timeLeft))
time.Sleep(time.Duration(timeLeft))
}(tStart, vmIDString, sem)

funcIdx++
funcIdx %= len(funcs)
vmID++
}

}
}

Expand Down