1 -module(beam_stats_processes).
3 -include("include/beam_stats_process.hrl").
4 -include("include/beam_stats_processes.hrl").
21 -spec collect(beam_stats_delta:t()) ->
23 collect(DeltasServer) ->
24 Pids = beam_stats_source:erlang_processes(),
25 PsOpts = [beam_stats_process:of_pid(P, DeltasServer) || P <- Pids],
26 Ps = [P || {some, P} <- PsOpts],
33 = length([P || P <- Ps, P#beam_stats_process.status =:= exiting])
34 , count_garbage_collecting
35 = length([P || P <- Ps, P#beam_stats_process.status =:= garbage_collecting])
37 = length(beam_stats_source:erlang_registered())
39 = length([P || P <- Ps, P#beam_stats_process.status =:= runnable])
41 = length([P || P <- Ps, P#beam_stats_process.status =:= running])
43 = length([P || P <- Ps, P#beam_stats_process.status =:= suspended])
45 = length([P || P <- Ps, P#beam_stats_process.status =:= waiting])
48 -spec collect_and_print(beam_stats_delta:t()) ->
50 collect_and_print(DeltasServer) ->
51 print(collect(DeltasServer)).
57 { individual_stats = PerProcessStats
58 , count_all = CountAll
59 , count_exiting = CountExiting
60 , count_garbage_collecting = CountGarbageCollecting
61 , count_registered = CountRegistered
62 , count_runnable = CountRunnable
63 , count_running = CountRunning
64 , count_suspended = CountSuspended
65 , count_waiting = CountWaiting
68 PerProcessStatsSorted = lists:sort(
69 fun (#beam_stats_process{memory=A}, #beam_stats_process{memory=B}) ->
70 % From lowest to highest:
75 lists:foreach(fun beam_stats_process:print/1, PerProcessStatsSorted),
76 io:format("==================================================~n"),
80 "CountGarbageCollecting : ~b~n"
81 "CountRegistered : ~b~n"
82 "CountRunnable : ~b~n"
84 "CountSuspended : ~b~n"
89 , CountGarbageCollecting