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()
39 { {input , CurrentIOBytesIn}
40 , {output , CurrentIOBytesOut}
41 } = erlang:statistics(io),
42 {CurrentContextSwitches, 0} = erlang:statistics(context_switches),
43 {_ReductionsTotal, ReductionsDelta} = erlang:statistics(reductions),
45 { timestamp = os:timestamp()
46 , node_id = erlang:node()
47 , memory = erlang:memory()
48 , previous_io_bytes_in = 0
49 , previous_io_bytes_out = 0
50 , current_io_bytes_in = CurrentIOBytesIn
51 , current_io_bytes_out = CurrentIOBytesOut
52 , previous_context_switches = 0
53 , current_context_switches = CurrentContextSwitches
54 , reductions = ReductionsDelta
60 { previous_io_bytes_in = PreviousIOBytesIn
61 , previous_io_bytes_out = PreviousIOBytesOut
62 , previous_context_switches = PreviousContextSwitches
65 { {input , CurrentIOBytesIn}
66 , {output , CurrentIOBytesOut}
67 } = erlang:statistics(io),
68 {CurrentContextSwitches, 0} = erlang:statistics(context_switches),
69 {_ReductionsTotal, ReductionsDelta} = erlang:statistics(reductions),
71 { timestamp = os:timestamp()
72 , node_id = erlang:node()
73 , memory = erlang:memory()
74 , previous_io_bytes_in = PreviousIOBytesIn
75 , previous_io_bytes_out = PreviousIOBytesOut
76 , current_io_bytes_in = CurrentIOBytesIn
77 , current_io_bytes_out = CurrentIOBytesOut
78 , previous_context_switches = PreviousContextSwitches
79 , current_context_switches = CurrentContextSwitches
80 , reductions = ReductionsDelta
87 { timestamp = Timestamp
90 , previous_io_bytes_in = PreviousIOBytesIn
91 , previous_io_bytes_out = PreviousIOBytesOut
92 , current_io_bytes_in = CurrentIOBytesIn
93 , current_io_bytes_out = CurrentIOBytesOut
94 , previous_context_switches = PreviousContextSwitches
95 , current_context_switches = CurrentContextSwitches
96 , reductions = Reductions
100 { timestamp = Timestamp
103 , io_bytes_in = CurrentIOBytesIn - PreviousIOBytesIn
104 , io_bytes_out = CurrentIOBytesOut - PreviousIOBytesOut
105 , context_switches = CurrentContextSwitches - PreviousContextSwitches
106 , reductions = Reductions