Implement deltas server, replacing beam_stats_state.
[beam_stats.git] / src / beam_stats.erl
index 1522568..af5167c 100644 (file)
@@ -6,5 +6,31 @@
     [ t/0
     ]).
 
+-export(
+    [ collect/1
+    ]).
+
+-define(T, #?MODULE).
+
 -type t() ::
-    #?MODULE{}.
+    ?T{}.
+
+-spec collect(beam_stats_delta:t()) ->
+    t().
+collect(DeltasServer) ->
+    {_, DeltaOfReductions} = beam_stats_source:erlang_statistics(reductions),
+    { {io_bytes_in  , DeltaOfIOBytesIn}
+    , {io_bytes_out , DeltaOfIOBytesOut}
+    } = beam_stats_delta:of_io(DeltasServer),
+    ?T
+    { timestamp        = beam_stats_source:os_timestamp()
+    , node_id          = beam_stats_source:erlang_node()
+    , memory           = beam_stats_source:erlang_memory()
+    , io_bytes_in      = DeltaOfIOBytesIn
+    , io_bytes_out     = DeltaOfIOBytesOut
+    , context_switches = beam_stats_delta:of_context_switches(DeltasServer)
+    , reductions       = DeltaOfReductions
+    , run_queue        = beam_stats_source:erlang_statistics(run_queue)
+    , ets              = beam_stats_ets:collect()
+    , processes        = beam_stats_processes:collect()
+    }.
This page took 0.018459 seconds and 4 git commands to generate.