This repository has been archived by the owner on Sep 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTODO.txt
76 lines (70 loc) · 2.53 KB
/
TODO.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
%% Counters to be reported to the user:
%% #dead already
%% sups
%% children
%% neither sups nor children
%% disconnected sups
%% total killable with no dead sups
%% kill and check status
%% total killable with no dead top level sups
%% kill and check status
%% #Killed
%% total number of processes before killing anything
%% total number of processes after killing things
The following can be used to print info about processes and should
somehow be brough into line with what chaos_monkey:kill/0 returns.
And the other way around obviously, probably adding a pp_procdata or
whatnot.
%% p_pidinfo(Killable, Pid, App, IsSystemProcess, IsSystemApp, IsSupervisor) ->
%% FKillable = case Killable of
%% true -> "About to";
%% false -> "Cannot"
%% end,
%% FName = case erlang:process_info(Pid, registered_name) of
%% {registered_name, Name} ->
%% io_lib:format(" (~s)", [Name]);
%% "" -> ""
%% end,
%% FApp = case App of
%% undefined -> "";
%% {ok, A} -> io_lib:format(" in app ~s", [A])
%% end,
%% Immunities =
%% [case IsSystemProcess of
%% true -> " is a system process";
%% false -> no
%% end,
%% case IsSystemApp of
%% true -> " belongs to a system app";
%% false -> no
%% end,
%% case IsSupervisor of
%% true -> " is a supervisor";
%% false -> no
%% end],
%% FImmunities =
%% case lists:filter(fun(X) -> X =/= no end, Immunities) of
%% [] -> "";
%% Imms ->
%% [" because it", string:join(Imms, " and")]
%% end,
%% case (App =:= undefined) orelse (Killable =:= true) of
%% true ->
%% p("~s kill ~p~s~s~s.", [FKillable, Pid, FName, FApp, FImmunities]);
%% false ->
%% ok
%% end.
More dead code that ties in whith things to do later. See the comment
about multiple trees in the same app.
%% with_ancestors(Pids) ->
%% [case erlang:process_info(Pid, dictionary) of
%% {dictionary, PDict} ->
%% case lists:keyfind('$ancestors', 1, PDict) of
%% {'$ancestors', [Ancestor | _Ancestors]} ->
%% {Pid, Ancestor};
%% _ ->
%% {Pid, unknown}
%% end;
%% _ ->
%% {Pid, unknown}
%% end || Pid <- Pids].