diff options
author | Hans Bolinder <[email protected]> | 2018-03-21 15:02:16 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2018-03-21 15:02:16 +0100 |
commit | 19f321078ba82968ccda000b73c2c23ffb249086 (patch) | |
tree | 92d2205f0962a58b04b4e5cea0a69b8d03b9ba5f /lib | |
parent | cf3cbf0871832cb0808293842e5ae726edfc12e1 (diff) | |
download | otp-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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/stdlib/test/stdlib_bench_SUITE.erl | 16 |
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). |