aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/test
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2019-01-15 16:31:11 +0100
committerHans Nilsson <[email protected]>2019-01-25 18:01:05 +0100
commit2f63360dc84bca1f6c98fb3479fc41420f5926e7 (patch)
treeb05002b5d7a05ec89b371ad3fb6d4e7313fc391a /lib/crypto/test
parent0bb760dfbcfc9969788a9073aaaca961880d9fc1 (diff)
downloadotp-2f63360dc84bca1f6c98fb3479fc41420f5926e7.tar.gz
otp-2f63360dc84bca1f6c98fb3479fc41420f5926e7.tar.bz2
otp-2f63360dc84bca1f6c98fb3479fc41420f5926e7.zip
crypto: Misc fixes: double time, calibrate once
Diffstat (limited to 'lib/crypto/test')
-rw-r--r--lib/crypto/test/crypto_bench_SUITE.erl20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/crypto/test/crypto_bench_SUITE.erl b/lib/crypto/test/crypto_bench_SUITE.erl
index e1fd0a63e5..79340a17d6 100644
--- a/lib/crypto/test/crypto_bench_SUITE.erl
+++ b/lib/crypto/test/crypto_bench_SUITE.erl
@@ -55,7 +55,7 @@ init_per_suite(Config) ->
[{_,_,Info}] = crypto:info_lib(),
ct:comment("~s",[Info]),
ct:pal("Crypto version: ~p~n~n~p",[Info,crypto:supports()]),
- [{sec_goal,5} | Config]
+ calibrate([{sec_goal,10} | Config])
catch _:_ ->
{fail, "Crypto did not start"}
end.
@@ -65,10 +65,8 @@ end_per_suite(_Config) ->
%%%----------------------------------------------------------------
%%%
-init_per_group(Group, Config0) ->
+init_per_group(Group, Config) ->
ct:pal("~p(~p,..)",[?FUNCTION_NAME,Group]),
-
- Config = calibrate(Config0),
case atom_to_list(Group) of
"ciphers_"++KeySizeStr ->
KeySize = list_to_integer(KeySizeStr),
@@ -96,9 +94,10 @@ measure_openssl_aes_cbc(KeySize, Config) ->
{no_acc,BLno_acc} | Config].
calibrate(Config) ->
- Secs = proplists:get_value(sec_goal, Config, 5),
+ Secs = proplists:get_value(sec_goal, Config, 10),
{_,Empty} = data(empty, 0, 0),
- {Ne,Te} = run1(Secs*2000, Empty),
+ {Ne,Te} = run1(Secs*3000, Empty),
+ report(["Overhead"], Te/Ne),
[{overhead,Te/Ne} | Config].
%%%================================================================
@@ -117,15 +116,15 @@ stream(Config) ->
%%%
run_cryptos(Cryptos, Config) ->
- run_cryptos(Cryptos, 1, Config).
-
-run_cryptos(Cryptos, Factor, Config) ->
KeySize = proplists:get_value(key_size, Config),
BlockSize = proplists:get_value(block_size, Config),
MilliSecGoal = 1000*proplists:get_value(sec_goal,Config),
OverHead = proplists:get_value(overhead, Config, 0),
[try
- Factor*run(Crypto,KeySize,BlockSize,MilliSecGoal) - OverHead
+ TimePerOpBrutto = run(Crypto,KeySize,BlockSize,MilliSecGoal),
+ ct:pal("Brutto: ~p Overhead: ~p (~.2f %) Netto: ~p",
+ [TimePerOpBrutto, OverHead, 100*OverHead/TimePerOpBrutto,TimePerOpBrutto - OverHead]),
+ TimePerOpBrutto - OverHead
of
TimePerOp -> % µs
%% First, Report speed of encrypting blocks of 1000. [blocks/sec]
@@ -263,6 +262,7 @@ run1(MilliSecGoal, Funs) ->
Pid = spawn(fun() ->
{Fi,Fu,Ff} = Funs,
Ctx0 = Fi(),
+ erlang:garbage_collect(),
T0 = start_time(),
{N,Ctx} = loop(Fu, Ctx0, 0),
T = elapsed_time(T0),