Sfoglia il codice sorgente

增加测试模块的函数

master
SisMaker 4 anni fa
parent
commit
2579e6c920
1 ha cambiato i file con 18 aggiunte e 11 eliminazioni
  1. +18
    -11
      src/measure/utTc.erl

+ 18
- 11
src/measure/utTc.erl Vedi File

@ -35,13 +35,16 @@ distribution([], _Aver, Greater, Less) ->
ts(LoopTime, M, F, A) ->
{Max, Min, Sum, Aver, Greater, Less} = loopTs(LoopTime, M, F, A, LoopTime, 0, 0, 0, []),
io:format("=====================~n"),
io:format("execute [~p] times of {~p, ~p, ~p}:~n", [LoopTime, M, F, A]),
io:format("MaxTime: ~10s(us) ~10s(s)~n", [float_to_binary(Max, [{decimals, 6}, compact]), float_to_binary(Max / 1000000, [{decimals, 6}, compact])]),
io:format("MinTime: ~10s(us) ~10s(s)~n", [float_to_binary(Min, [{decimals, 6}, compact]), float_to_binary(Min / 1000000, [{decimals, 6}, compact])]),
io:format("SumTime: ~10s(us) ~10s(s)~n", [float_to_binary(Sum, [{decimals, 6}, compact]), float_to_binary(Sum / 1000000, [{decimals, 6}, compact])]),
io:format("execute Args:~p~n", A),
io:format("execute Fun :~p~n", [F]),
io:format("execute Mod :~p~n", [M]),
io:format("execute LoopTime:~p~n", [LoopTime]),
io:format("MaxTime: ~10s(us) ~10s(s)~n", [integer_to_binary(Max), float_to_binary(Max / 1000000, [{decimals, 6}, compact])]),
io:format("MinTime: ~10s(us) ~10s(s)~n", [integer_to_binary(Min), float_to_binary(Min / 1000000, [{decimals, 6}, compact])]),
io:format("SumTime: ~10s(us) ~10s(s)~n", [integer_to_binary(Sum), float_to_binary(Sum / 1000000, [{decimals, 6}, compact])]),
io:format("AvgTime: ~10s(us) ~10s(s)~n", [float_to_binary(Aver, [{decimals, 6}, compact]), float_to_binary(Aver / 1000000, [{decimals, 6}, compact])]),
io:format("Gra: ~10s ~10s(s)~n", [integer_to_binary(Greater), float_to_binary(Greater / LoopTime, [{decimals, 2}]) ++ "%"]),
io:format("Less: ~10s ~10s(s)~n", [integer_to_binary(Less), float_to_binary(Less / LoopTime, [{decimals, 2}]) ++ "%"]),
io:format("Grar : ~10s(cn) ~10s( ~s)~n", [integer_to_binary(Greater), float_to_binary(Greater / LoopTime, [{decimals, 2}]), <<"%";>>;]),
io:format("Less : ~10s(cn) ~10s(<span class="si">~s)~n", [integer_to_binary(Less), float_to_binary(Less / LoopTime, [{decimals, 2}]), <<"%";>>;]),
io:format("=====================~n").
@ -73,16 +76,20 @@ loopTs(Index, M, F, A, LoopTime, Max, Min, Sum, List) ->
%% ===================================================================
tm(ProcCnt, LoopTime, M, F, A) ->
loopSpawn(M, F, A, self(), ProcCnt, LoopTime),
loopSpawn(ProcCnt, M, F, A, self(), LoopTime),
{Max, Min, Sum, Aver, Greater, Less} = collector(ProcCnt, 0, 0, 0, ProcCnt, []),
io:format("=====================~n"),
io:format("execute process Cnt:[~p] LoopTime:[~p] times of {~p, ~p, ~p}:~n", [ProcCnt, LoopTime, M, F, A]),
io:format("execute Args:~p~n", A),
io:format("execute Fun :~p~n", [F]),
io:format("execute Mod :~p~n", [M]),
io:format("execute LoopTime:~p~n", [LoopTime]),
io:format("execute ProcCnts:~p~n", [ProcCnt]),
io:format("MaxTime: ~10s(us) ~10s(s)~n", [integer_to_binary(Max), float_to_binary(Max / 1000000, [{decimals, 6}, compact])]),
io:format("MinTime: ~10s(us) ~10s(s)~n", [integer_to_binary(Min), float_to_binary(Min / 1000000, [{decimals, 6}, compact])]),
io:format("SumTime: ~10s(us) ~10s(s)~n", [integer_to_binary(Sum), float_to_binary(Sum / 1000000, [{decimals, 6}, compact])]),
io:format("AvgTime: ~10s(us) ~10s(s)~n", [integer_to_binary(Aver), float_to_binary(Aver / 1000000, [{decimals, 6}, compact])]),
io:format("Grar: ~10s ~10s(s)~n", [integer_to_binary(Greater), float_to_binary(Greater / ProcCnt, [{decimals, 2}]) ++ "%"]),
io:format("Less: ~10s ~10s(s)~n", [integer_to_binary(Less), float_to_binary(Less / ProcCnt, [{decimals, 2}]) ++ "%"]),
io:format("AvgTime: ~10s(us) ~10s(s)~n", [float_to_binary(Aver, [{decimals, 6}, compact]), float_to_binary(Aver / 1000000, [{decimals, 6}, compact])]),
io:format("Grar : ~10s(cn) ~10s( ~s)~n", [integer_to_binary(Greater), float_to_binary(Greater / LoopTime, [{decimals, 2}]), <<"%";>>;]),
io:format("Less : ~10s(cn) ~10s( ~s)~n", [integer_to_binary(Less), float_to_binary(Less / LoopTime, [{decimals, 2}]), <<"%";>>;]),
io:format("=====================~n").

Caricamento…
Annulla
Salva