Last active
October 10, 2015 12:05
-
-
Save upbit/2b2bfe859fddbc3e2639 to your computer and use it in GitHub Desktop.
Erlang shell scripts for process
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
%% message_queue_len | |
lists:sublist(lists:sort(fun(R1,R2) -> proplists:get_value(message_queue_len,R1,0) > proplists:get_value(message_queue_len,R2,0) end, | |
lists:filtermap(fun(Pid) -> case erlang:process_info(Pid) of undefined -> false; R -> {true, R} end end, | |
erlang:processes())), 10). | |
%% reductions | |
lists:sublist(lists:sort(fun(R1,R2) -> proplists:get_value(reductions,R1,0) > proplists:get_value(reductions,R2,0) end, | |
lists:filtermap(fun(Pid) -> case erlang:process_info(Pid) of undefined -> false; R -> {true, R} end end, | |
erlang:processes())), 10). | |
%% heap_size | |
lists:sublist(lists:sort(fun(R1,R2) -> proplists:get_value(heap_size,R1,0) > proplists:get_value(heap_size,R2,0) end, | |
lists:filtermap(fun(Pid) -> case erlang:process_info(Pid) of undefined -> false; R -> {true, R} end end, | |
erlang:processes())), 10). | |
%% Search "seestar_session", and sort by heap_size | |
lists:sublist(lists:sort(fun(R1,R2) -> proplists:get_value(heap_size,R1,0) > proplists:get_value(heap_size,R2,0) end, | |
lists:filtermap(fun(Pid) -> case erlang:process_info(Pid) of undefined -> false; R -> | |
case string:str(lists:flatten(io_lib:format("~s", [term_to_binary(R)])), "seestar_session") of | |
V when V > 0 -> {true, R}; _ -> false end end end, erlang:processes())), 10). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment