Created
June 14, 2013 17:38
-
-
Save ferd/5783802 to your computer and use it in GitHub Desktop.
Compare runtime, run queue, and scheduler business
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
erlang:system_flag(scheduler_wall_time, true), | |
f(WallTimeDiff), | |
WallTimeDiff = fun(T1,T2) -> [trunc(100*((Active2-Active1)/(Total2-Total1)))/100 || {{I, Active1, Total1}, {I, Active2, Total2}} <- lists:zip(lists:sort(T1),lists:sort(T2))] end, | |
f(F), put(stime, erlang:statistics(scheduler_wall_time)), | |
F = fun(F,N) -> Old=get(stime), New=erlang:statistics(scheduler_wall_time), put(stime,New), io:format("rt:~p\trq:~p\t\tsched:~w~n", [element(2,erlang:statistics(runtime)), erlang:statistics(run_queue), WallTimeDiff(Old,New)]), timer:sleep(N), F(F,N) end. | |
%% F(F, IntervalInMS). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment