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()
37 { {input , CurrentIOBytesIn}
38 , {output , CurrentIOBytesOut}
39 } = erlang:statistics(io),
40 {CurrentContextSwitches, 0} = erlang:statistics(context_switches),
42 { timestamp = os:timestamp()
43 , node_id = erlang:node()
44 , memory = erlang:memory()
45 , previous_io_bytes_in = 0
46 , previous_io_bytes_out = 0
47 , current_io_bytes_in = CurrentIOBytesIn
48 , current_io_bytes_out = CurrentIOBytesOut
49 , previous_context_switches = 0
50 , current_context_switches = CurrentContextSwitches
56 { previous_io_bytes_in = PreviousIOBytesIn
57 , previous_io_bytes_out = PreviousIOBytesOut
58 , previous_context_switches = PreviousContextSwitches
61 { {input , CurrentIOBytesIn}
62 , {output , CurrentIOBytesOut}
63 } = erlang:statistics(io),
64 {CurrentContextSwitches, 0} = erlang:statistics(context_switches),
66 { timestamp = os:timestamp()
67 , node_id = erlang:node()
68 , memory = erlang:memory()
69 , previous_io_bytes_in = PreviousIOBytesIn
70 , previous_io_bytes_out = PreviousIOBytesOut
71 , current_io_bytes_in = CurrentIOBytesIn
72 , current_io_bytes_out = CurrentIOBytesOut
73 , previous_context_switches = PreviousContextSwitches
74 , current_context_switches = CurrentContextSwitches
81 { timestamp = Timestamp
84 , previous_io_bytes_in = PreviousIOBytesIn
85 , previous_io_bytes_out = PreviousIOBytesOut
86 , current_io_bytes_in = CurrentIOBytesIn
87 , current_io_bytes_out = CurrentIOBytesOut
88 , previous_context_switches = PreviousContextSwitches
89 , current_context_switches = CurrentContextSwitches
93 { timestamp = Timestamp
96 , io_bytes_in = CurrentIOBytesIn - PreviousIOBytesIn
97 , io_bytes_out = CurrentIOBytesOut - PreviousIOBytesOut
98 , context_switches = CurrentContextSwitches - PreviousContextSwitches