+
+collect_and_print() ->
+ print(collect()).
+
+-spec print(t()) ->
+ ok.
+print(
+ ?T
+ { individual_stats = PerProcessStats
+ , count_all = CountAll
+ , count_exiting = CountExiting
+ , count_garbage_collecting = CountGarbageCollecting
+ , count_registered = CountRegistered
+ , count_runnable = CountRunnable
+ , count_running = CountRunning
+ , count_suspended = CountSuspended
+ , count_waiting = CountWaiting
+ }
+) ->
+ PerProcessStatsSorted = lists:sort(
+ fun (#beam_stats_process{memory=A}, #beam_stats_process{memory=B}) ->
+ % From lowest to highest:
+ A < B
+ end,
+ PerProcessStats
+ ),
+ lists:foreach(fun beam_stats_process:print/1, PerProcessStatsSorted),
+ io:format("==================================================~n"),
+ io:format(
+ "CountAll : ~b~n"
+ "CountExiting : ~b~n"
+ "CountGarbageCollecting : ~b~n"
+ "CountRegistered : ~b~n"
+ "CountRunnable : ~b~n"
+ "CountRunning : ~b~n"
+ "CountSuspended : ~b~n"
+ "CountWaiting : ~b~n"
+ "~n",
+ [ CountAll
+ , CountExiting
+ , CountGarbageCollecting
+ , CountRegistered
+ , CountRunnable
+ , CountRunning
+ , CountSuspended
+ , CountWaiting
+ ]
+ ).