aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-01-04 15:17:41 +0100
committerHans Nilsson <[email protected]>2016-01-18 12:17:04 +0100
commit02c266f80b87e690203b764bd518e347386fae7e (patch)
treeebac1a27e0e1b2c67c1e3f4364e5aadb8de077f5
parent95f121ed04a632257cd0e429cb16ba9d9a7110bb (diff)
downloadotp-02c266f80b87e690203b764bd518e347386fae7e.tar.gz
otp-02c266f80b87e690203b764bd518e347386fae7e.tar.bz2
otp-02c266f80b87e690203b764bd518e347386fae7e.zip
ssh: encode/decode benchmark suites
-rw-r--r--lib/ssh/test/ssh_benchmark_SUITE.erl38
1 files changed, 25 insertions, 13 deletions
diff --git a/lib/ssh/test/ssh_benchmark_SUITE.erl b/lib/ssh/test/ssh_benchmark_SUITE.erl
index 781230e728..e90bfa3d16 100644
--- a/lib/ssh/test/ssh_benchmark_SUITE.erl
+++ b/lib/ssh/test/ssh_benchmark_SUITE.erl
@@ -307,7 +307,10 @@ char(C) -> C.
%%%----------------------------------------------------------------
find_times(L, Xs) ->
[find_time(X,L) || X <- Xs] ++
- crypto_algs_times_sizes([encrypt,decrypt], L).
+ function_algs_times_sizes([{ssh_transport,encrypt,2},
+ {ssh_transport,decrypt,2},
+ {ssh_message,decode,1},
+ {ssh_message,encode,1}], L).
-record(call, {
mfa,
@@ -396,24 +399,31 @@ find_gex_size_string(L) ->
Size.
%%%----------------
-crypto_algs_times_sizes(EncDecs, L) ->
- Raw = [{_Algorithm = case EncDec of
- encrypt -> {encrypt,S#ssh.encrypt};
- decrypt -> {decrypt,S#ssh.decrypt}
- end,
- size(Data),
- now2micro_sec(now_diff(T1, T0))
- }
+function_algs_times_sizes(EncDecs, L) ->
+ Raw = [begin
+ {Tag,Size} = function_ats_result(EncDec, C),
+ {Tag, Size, now2micro_sec(now_diff(T1,T0))}
+ end
|| EncDec <- EncDecs,
- #call{mfa = {ssh_transport,ED,2},
- args = [S,Data],
- t_call = T0,
- t_return = T1} <- L,
+ C = #call{mfa = ED,
+ args = Args, %%[S,Data],
+ t_call = T0,
+ t_return = T1} <- L,
ED == EncDec
],
[{Alg, round(1024*Time/Size), "microsec per kbyte"} % Microseconds per 1k bytes.
|| {Alg,Size,Time} <- lists:foldl(fun increment/2, [], Raw)].
+function_ats_result({ssh_transport,encrypt,2}, #call{args=[S,Data]}) ->
+ {{encrypt,S#ssh.encrypt}, size(Data)};
+function_ats_result({ssh_transport,decrypt,2}, #call{args=[S,Data]}) ->
+ {{decrypt,S#ssh.decrypt}, size(Data)};
+function_ats_result({ssh_message,encode,1}, #call{result=Data}) ->
+ {encode, size(Data)};
+function_ats_result({ssh_message,decode,1}, #call{args=[Data]}) ->
+ {decode, size(Data)}.
+
+
increment({Alg,Sz,T}, [{Alg,SumSz,SumT}|Acc]) ->
[{Alg,SumSz+Sz,SumT+T} | Acc];
increment(Spec, [X|Acc]) ->
@@ -443,6 +453,8 @@ erlang_trace() ->
{ssh_transport,select_algorithm,3},
{ssh_transport,encrypt,2},
{ssh_transport,decrypt,2},
+ {ssh_message,encode,1},
+ {ssh_message,decode,1},
{public_key,dh_gex_group,4} % To find dh_gex group size
]],
{ok, TracerPid}.