Skip to content

Instantly share code, notes, and snippets.

@upbit
Last active Oct 10, 2015
Embed
What would you like to do?
Erlang shell scripts for process
%% 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