1 -module(beam_stats_processes).
3 -include("include/beam_stats_process.hrl").
4 -include("include/beam_stats_processes.hrl").
24 Pids = beam_stats_source:erlang_processes(),
25 Ps = [beam_stats_process:of_pid(P) || P <- Pids],
32 = length([P || P <- Ps, P#beam_stats_process.status =:= exiting])
33 , count_garbage_collecting
34 = length([P || P <- Ps, P#beam_stats_process.status =:= garbage_collecting])
36 = length(beam_stats_source:erlang_registered())
38 = length([P || P <- Ps, P#beam_stats_process.status =:= runnable])
40 = length([P || P <- Ps, P#beam_stats_process.status =:= running])
42 = length([P || P <- Ps, P#beam_stats_process.status =:= suspended])
44 = length([P || P <- Ps, P#beam_stats_process.status =:= waiting])
47 collect_and_print() ->
54 { individual_stats = PerProcessStats
55 , count_all = CountAll
56 , count_exiting = CountExiting
57 , count_garbage_collecting = CountGarbageCollecting
58 , count_registered = CountRegistered
59 , count_runnable = CountRunnable
60 , count_running = CountRunning
61 , count_suspended = CountSuspended
62 , count_waiting = CountWaiting
65 PerProcessStatsSorted = lists:sort(
66 fun (#beam_stats_process{memory=A}, #beam_stats_process{memory=B}) ->
67 % From lowest to highest:
72 lists:foreach(fun beam_stats_process:print/1, PerProcessStatsSorted),
73 io:format("==================================================~n"),
77 "CountGarbageCollecting : ~b~n"
78 "CountRegistered : ~b~n"
79 "CountRunnable : ~b~n"
81 "CountSuspended : ~b~n"
86 , CountGarbageCollecting