Skip to content

Instantly share code, notes, and snippets.

@binarytemple
Forked from angrycub/GetInfoByModule.erl
Created October 17, 2017 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binarytemple/76dea8c05dd4871cc823297e3f6e92bd to your computer and use it in GitHub Desktop.
Save binarytemple/76dea8c05dd4871cc823297e3f6e92bd 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