X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=src%2Fbeam_stats_state.erl;h=d514f95f8a98342299d622c55c5ae0b091bed9b7;hb=b8e10327d7c189769c32e439ec2b1cf9773afade;hp=f21f2312fb5f3698e43c8735d5a25f5eda40f1ae;hpb=28c1d03aafd6e29afd911f6e291cd46d9591575d;p=beam_stats.git diff --git a/src/beam_stats_state.erl b/src/beam_stats_state.erl index f21f231..d514f95 100644 --- a/src/beam_stats_state.erl +++ b/src/beam_stats_state.erl @@ -1,6 +1,8 @@ -module(beam_stats_state). -include("include/beam_stats.hrl"). +-include("include/beam_stats_process.hrl"). +-include("include/beam_stats_processes.hrl"). -export_type( [ t/0 @@ -14,7 +16,9 @@ -record(snapshots, { memory :: [{atom(), non_neg_integer()}] + , processes :: beam_stats_processes:t() , run_queue :: non_neg_integer() + , ets :: beam_stats_ets:t() }). -type snapshots() :: @@ -60,8 +64,8 @@ new() -> t(). new(#totals{}=TotalsPrevious) -> ?T - { timestamp = os:timestamp() - , node_id = erlang:node() + { timestamp = beam_stats_source:os_timestamp() + , node_id = beam_stats_source:erlang_node() , snapshots = snapshots_new() , deltas = deltas_new() , totals_previous = TotalsPrevious @@ -82,7 +86,9 @@ export( , snapshots = #snapshots { memory = Memory + , processes = Processes , run_queue = RunQueue + , ets = ETS } , deltas = #deltas @@ -111,16 +117,20 @@ export( , context_switches = CurrentContextSwitches - PreviousContextSwitches , reductions = Reductions , run_queue = RunQueue + , ets = ETS + , processes = Processes }. snapshots_new() -> #snapshots - { memory = erlang:memory() - , run_queue = erlang:statistics(run_queue) + { memory = beam_stats_source:erlang_memory() + , processes = beam_stats_processes:collect() + , run_queue = beam_stats_source:erlang_statistics(run_queue) + , ets = beam_stats_ets:collect() }. deltas_new() -> - {_ReductionsTotal, ReductionsDelta} = erlang:statistics(reductions), + {_ReductionsTotal, ReductionsDelta} = beam_stats_source:erlang_statistics(reductions), #deltas { reductions = ReductionsDelta }. @@ -128,8 +138,8 @@ deltas_new() -> totals_new() -> { {input , IOBytesIn} , {output , IOBytesOut} - } = erlang:statistics(io), - {ContextSwitches, 0} = erlang:statistics(context_switches), + } = beam_stats_source:erlang_statistics(io), + {ContextSwitches, 0} = beam_stats_source:erlang_statistics(context_switches), #totals { io_bytes_in = IOBytesIn , io_bytes_out = IOBytesOut