aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2018-03-21 15:02:16 +0100
committerHans Bolinder <[email protected]>2018-03-21 15:02:16 +0100
commit19f321078ba82968ccda000b73c2c23ffb249086 (patch)
tree92d2205f0962a58b04b4e5cea0a69b8d03b9ba5f
parentcf3cbf0871832cb0808293842e5ae726edfc12e1 (diff)
downloadotp-19f321078ba82968ccda000b73c2c23ffb249086.tar.gz
otp-19f321078ba82968ccda000b73c2c23ffb249086.tar.bz2
otp-19f321078ba82968ccda000b73c2c23ffb249086.zip
stdlib: Make benchmarks more robust
statistics(runtime) does not seem to work on some virtual machines.
-rw-r--r--lib/stdlib/test/stdlib_bench_SUITE.erl16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/stdlib/test/stdlib_bench_SUITE.erl b/lib/stdlib/test/stdlib_bench_SUITE.erl
index 294898a932..2364e8376f 100644
--- a/lib/stdlib/test/stdlib_bench_SUITE.erl
+++ b/lib/stdlib/test/stdlib_bench_SUITE.erl
@@ -348,12 +348,16 @@ do_tests(Test, ParamSet, Config) ->
{Parallelism, Message} = bench_params(ParamSet),
Fun = create_clients(Message, ServerMod, Client, Parallelism),
{TotalLoops, AllPidTime} = run_test(Fun),
- PerSecond = ?CALLS_PER_LOOP * round((1000 * TotalLoops) / AllPidTime),
- ct_event:notify(
- #event{
- name = benchmark_data,
- data = [{suite,BenchmarkSuite},{value,PerSecond}]}),
- PerSecond.
+ try ?CALLS_PER_LOOP * round((1000 * TotalLoops) / AllPidTime) of
+ PerSecond ->
+ ct_event:notify(
+ #event{
+ name = benchmark_data,
+ data = [{suite,BenchmarkSuite},{value,PerSecond}]}),
+ PerSecond
+ catch error:badarith ->
+ "Time measurement is not working"
+ end.
-define(COUNTER, n).