1 -module(beam_stats_state).
3 -include("include/beam_stats.hrl").
16 { timestamp :: erlang:timestamp()
18 , memory :: [{atom(), non_neg_integer()}]
20 , previous_io_bytes_in :: non_neg_integer()
21 , previous_io_bytes_out :: non_neg_integer()
22 , current_io_bytes_in :: non_neg_integer()
23 , current_io_bytes_out :: non_neg_integer()
25 , previous_context_switches :: non_neg_integer()
26 , current_context_switches :: non_neg_integer()
28 , reductions :: non_neg_integer()
29 , run_queue :: non_neg_integer()
40 { {input , CurrentIOBytesIn}
41 , {output , CurrentIOBytesOut}
42 } = erlang:statistics(io),
43 {CurrentContextSwitches, 0} = erlang:statistics(context_switches),
44 {_ReductionsTotal, ReductionsDelta} = erlang:statistics(reductions),
45 RunQueue = erlang:statistics(run_queue),
47 { timestamp = os:timestamp()
48 , node_id = erlang:node()
49 , memory = erlang:memory()
50 , previous_io_bytes_in = 0
51 , previous_io_bytes_out = 0
52 , current_io_bytes_in = CurrentIOBytesIn
53 , current_io_bytes_out = CurrentIOBytesOut
54 , previous_context_switches = 0
55 , current_context_switches = CurrentContextSwitches
56 , reductions = ReductionsDelta
57 , run_queue = RunQueue
63 { previous_io_bytes_in = PreviousIOBytesIn
64 , previous_io_bytes_out = PreviousIOBytesOut
65 , previous_context_switches = PreviousContextSwitches
68 { {input , CurrentIOBytesIn}
69 , {output , CurrentIOBytesOut}
70 } = erlang:statistics(io),
71 {CurrentContextSwitches, 0} = erlang:statistics(context_switches),
72 {_ReductionsTotal, ReductionsDelta} = erlang:statistics(reductions),
73 RunQueue = erlang:statistics(run_queue),
75 { timestamp = os:timestamp()
76 , node_id = erlang:node()
77 , memory = erlang:memory()
78 , previous_io_bytes_in = PreviousIOBytesIn
79 , previous_io_bytes_out = PreviousIOBytesOut
80 , current_io_bytes_in = CurrentIOBytesIn
81 , current_io_bytes_out = CurrentIOBytesOut
82 , previous_context_switches = PreviousContextSwitches
83 , current_context_switches = CurrentContextSwitches
84 , reductions = ReductionsDelta
85 , run_queue = RunQueue
92 { timestamp = Timestamp
95 , previous_io_bytes_in = PreviousIOBytesIn
96 , previous_io_bytes_out = PreviousIOBytesOut
97 , current_io_bytes_in = CurrentIOBytesIn
98 , current_io_bytes_out = CurrentIOBytesOut
99 , previous_context_switches = PreviousContextSwitches
100 , current_context_switches = CurrentContextSwitches
101 , reductions = Reductions
102 , run_queue = RunQueue
106 { timestamp = Timestamp
109 , io_bytes_in = CurrentIOBytesIn - PreviousIOBytesIn
110 , io_bytes_out = CurrentIOBytesOut - PreviousIOBytesOut
111 , context_switches = CurrentContextSwitches - PreviousContextSwitches
112 , reductions = Reductions
113 , run_queue = RunQueue