-export(
[ start/0
, stop/1
+ , gc/1
, of_context_switches/1
, of_io/1
, of_reductions/1
true = ets:delete(TidErlangProcessInfoReductions),
{}.
+-spec gc(t()) ->
+ {}.
+gc(?T{erlang_process_info_reductions=Table}=T) ->
+ case ets:first(Table)
+ of '$end_of_table' ->
+ {}
+ ; FirstPid when is_pid(FirstPid) ->
+ gc(T, FirstPid)
+ end.
+
+-spec gc(t(), pid()) ->
+ {}.
+gc(?T{erlang_process_info_reductions=Table}=T, Pid) ->
+ case beam_stats_source:erlang_is_process_alive(Pid)
+ of true -> true
+ ; false -> ets:delete(Table, Pid)
+ end,
+ case ets:next(Table, Pid)
+ of '$end_of_table' ->
+ {}
+ ; NextPid when is_pid(NextPid) ->
+ gc(T, NextPid)
+ end.
+
-spec of_context_switches(t()) ->
non_neg_integer().
of_context_switches(?T{erlang_statistics=Table}) ->
ConsumersList = ordsets:to_list(ConsumersSet),
Send = fun (Consumer) -> MsgSendFun(Consumer, Stats) end,
ok = lists:foreach(Send, ConsumersList),
+ beam_stats_delta:gc(DeltasServer),
State.
-spec schedule_first_production() ->
-module(beam_stats_source).
-export(
- [ erlang_memory/0
+ [ erlang_is_process_alive/1
+ , erlang_memory/0
, erlang_node/0
, erlang_process_info/2
, erlang_processes/0
, os_timestamp/0
]).
+erlang_is_process_alive(Pid) ->
+ erlang:is_process_alive(Pid).
+
erlang_memory() ->
erlang:memory().
, size = 8
, memory = 64
},
+ meck:expect(beam_stats_source, erlang_is_process_alive,
+ fun (_) -> true end),
meck:expect(beam_stats_source, erlang_memory,
fun () -> [{mem_type_foo, 1}, {mem_type_bar, 2}, {mem_type_baz, 3}] end),
meck:expect(beam_stats_source, erlang_node,