Skip to content

Instantly share code, notes, and snippets.

@angrycub
Last active February 20, 2018 11:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save angrycub/cd31f3850197ad00bd41 to your computer and use it in GitHub Desktop.
Save angrycub/cd31f3850197ad00bd41 to your computer and use it in GitHub Desktop.
Get Info and Status by Module
GetInfoAndStatusByModule = fun (Module) ->
IsProcessInModule = fun (Module, ProcessInfo) ->
case proc_lib:translate_initial_call(ProcessInfo) of
{ICMod, _ICFun, _ICArity} when Module =:= ICMod -> true;
_ -> false
end
end,
ProcessTable = erlang:processes(),
CurriedPredicate = fun (P) -> IsProcessInModule(Module, P) end,
Pids = lists:filter(CurriedPredicate, ProcessTable),
[{erlang:process_info(P), sys:get_status(P)} || P <- Pids]
end.
rp(GetInfoAndStatusByModule(riak_cs_gc_d)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment