, current_context_switches :: non_neg_integer()
, reductions :: non_neg_integer()
+ , run_queue :: non_neg_integer()
}).
-define(T, #?MODULE).
} = erlang:statistics(io),
{CurrentContextSwitches, 0} = erlang:statistics(context_switches),
{_ReductionsTotal, ReductionsDelta} = erlang:statistics(reductions),
+ RunQueue = erlang:statistics(run_queue),
?T
{ timestamp = os:timestamp()
, node_id = erlang:node()
, previous_context_switches = 0
, current_context_switches = CurrentContextSwitches
, reductions = ReductionsDelta
+ , run_queue = RunQueue
}.
-spec update(t()) ->
} = erlang:statistics(io),
{CurrentContextSwitches, 0} = erlang:statistics(context_switches),
{_ReductionsTotal, ReductionsDelta} = erlang:statistics(reductions),
+ RunQueue = erlang:statistics(run_queue),
?T
{ timestamp = os:timestamp()
, node_id = erlang:node()
, previous_context_switches = PreviousContextSwitches
, current_context_switches = CurrentContextSwitches
, reductions = ReductionsDelta
+ , run_queue = RunQueue
}.
-spec export(t()) ->
, previous_context_switches = PreviousContextSwitches
, current_context_switches = CurrentContextSwitches
, reductions = Reductions
+ , run_queue = RunQueue
}
) ->
#beam_stats
, io_bytes_out = CurrentIOBytesOut - PreviousIOBytesOut
, context_switches = CurrentContextSwitches - PreviousContextSwitches
, reductions = Reductions
+ , run_queue = RunQueue
}.