1 -module(beam_stats_processes).
3 -include("include/beam_stats_process.hrl").
4 -include("include/beam_stats_processes.hrl").
24 Ps = [beam_stats_process:of_pid(P) || P <- erlang:processes()],
31 = length([P || P <- Ps, P#beam_stats_process.status =:= exiting])
32 , count_garbage_collecting
33 = length([P || P <- Ps, P#beam_stats_process.status =:= garbage_collecting])
35 = length(registered())
37 = length([P || P <- Ps, P#beam_stats_process.status =:= runnable])
39 = length([P || P <- Ps, P#beam_stats_process.status =:= running])
41 = length([P || P <- Ps, P#beam_stats_process.status =:= suspended])
43 = length([P || P <- Ps, P#beam_stats_process.status =:= waiting])
46 collect_and_print() ->
53 { individual_stats = PerProcessStats
54 , count_all = CountAll
55 , count_exiting = CountExiting
56 , count_garbage_collecting = CountGarbageCollecting
57 , count_registered = CountRegistered
58 , count_runnable = CountRunnable
59 , count_running = CountRunning
60 , count_suspended = CountSuspended
61 , count_waiting = CountWaiting
64 PerProcessStatsSorted = lists:sort(
65 fun (#beam_stats_process{memory=A}, #beam_stats_process{memory=B}) ->
66 % From lowest to highest:
71 lists:foreach(fun beam_stats_process:print/1, PerProcessStatsSorted),
72 io:format("==================================================~n"),
76 "CountGarbageCollecting : ~b~n"
77 "CountRegistered : ~b~n"
78 "CountRunnable : ~b~n"
80 "CountSuspended : ~b~n"
85 , CountGarbageCollecting