More documentation and testing functions.

This commit is contained in:
Jesper Louis Andersen
2014-11-28 14:41:06 +01:00
parent 33612a083e
commit addd22b31a
2 changed files with 25 additions and 1 deletions
+22
View File
@@ -62,6 +62,28 @@
verify_32/2
]).
%% Other helper functions
-export([
reds/1
]).
%% Count reductions and number of scheduler yields for Fun. Fun is assumed
%% to be one of the above exor variants.
reds(Fun) ->
Parent = self(),
Pid = spawn(fun() ->
Self = self(),
Start = os:timestamp(),
R0 = process_info(Self, reductions),
Fun(),
R1 = process_info(Self, reductions),
T = timer:now_diff(os:timestamp(), Start),
Parent ! {Self,{T, R1, R0}} end),
receive
{Pid,Result} ->
Result
end.
%% Low level helper functions
%% -----------------