Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Find all processes executing code from a given module

View Example
1 2 3 4 5 6 7 8 9
12> F = fun(P, {current_function, {Mod, _, _}}) -> {P, Mod} end,
12> C = fun(Mod, Prefixes) -> lists:sum([string:str(Mod, Prefix) || Prefix <- Prefixes]) > 0 end,
12> Target = fun(Prefixes) -> Candidates = [F(P, erlang:process_info(P, current_function)) || P <- erlang:processes()],
12> [{Pid, Mod} || {Pid, Mod} <- Candidates,
12> C(atom_to_list(Mod), Prefixes)] end.
#Fun<erl_eval.6.82930912>
13> Target(["erl"]).
[{<0.3.0>,erl_prim_loader},{<0.33.0>,erl_eval}]
14>
View Example
1 2 3 4 5
F = fun(P, {current_function, {Mod, _, _}}) -> {P, Mod} end,
C = fun(Mod, Prefixes) -> lists:sum([string:str(Mod, Prefix) || Prefix <- Prefixes]) > 0 end,
Target = fun(Prefixes) -> Candidates = [F(P, erlang:process_info(P, current_function)) || P <- erlang:processes()],
[{Pid, Mod} || {Pid, Mod} <- Candidates,
C(atom_to_list(Mod), Prefixes)] end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.