|
86 | 86 | %% that may or may not be still valid
|
87 | 87 | args_policy_version,
|
88 | 88 | %% running | flow | idle
|
89 |
| - status |
| 89 | + status, |
| 90 | + %% process stats (reductions) |
| 91 | + stats |
90 | 92 | }).
|
91 | 93 |
|
92 | 94 | %%----------------------------------------------------------------------------
|
|
116 | 118 | slave_pids,
|
117 | 119 | synchronised_slave_pids,
|
118 | 120 | recoverable_slaves,
|
119 |
| - state |
| 121 | + state, |
| 122 | + reductions, |
| 123 | + garbage_collection |
120 | 124 | ]).
|
121 | 125 |
|
122 | 126 | -define(CREATION_EVENT_KEYS,
|
@@ -152,7 +156,8 @@ init_state(Q) ->
|
152 | 156 | senders = pmon:new(delegate),
|
153 | 157 | msg_id_to_channel = gb_trees:empty(),
|
154 | 158 | status = running,
|
155 |
| - args_policy_version = 0}, |
| 159 | + args_policy_version = 0, |
| 160 | + stats = rabbit_process_stats:init()}, |
156 | 161 | rabbit_event:init_stats_timer(State, #q.stats_timer).
|
157 | 162 |
|
158 | 163 | init_it(Recover, From, State = #q{q = #amqqueue{exclusive_owner = none}}) ->
|
@@ -925,6 +930,11 @@ i(recoverable_slaves, #q{q = #amqqueue{name = Name,
|
925 | 930 | end;
|
926 | 931 | i(state, #q{status = running}) -> credit_flow:state();
|
927 | 932 | i(state, #q{status = State}) -> State;
|
| 933 | +i(garbage_collection, _S) -> |
| 934 | + {garbage_collection, GC} = erlang:process_info(self(), garbage_collection), |
| 935 | + GC; |
| 936 | +i(reductions, #q{stats = Stats}) -> |
| 937 | + rabbit_process_stats:stat_rate_per_second(Stats, reductions); |
928 | 938 | i(Item, #q{backing_queue_state = BQS, backing_queue = BQ}) ->
|
929 | 939 | BQ:info(Item, BQS).
|
930 | 940 |
|
@@ -1303,10 +1313,11 @@ handle_info({drop_expired, _Vsn}, State) ->
|
1303 | 1313 |
|
1304 | 1314 | handle_info(emit_stats, State) ->
|
1305 | 1315 | emit_stats(State),
|
| 1316 | + State1 = rabbit_process_stats:update(State), |
1306 | 1317 | %% Don't call noreply/1, we don't want to set timers
|
1307 |
| - {State1, Timeout} = next_state(rabbit_event:reset_stats_timer( |
1308 |
| - State, #q.stats_timer)), |
1309 |
| - {noreply, State1, Timeout}; |
| 1318 | + {State2, Timeout} = next_state(rabbit_event:reset_stats_timer( |
| 1319 | + State1, #q.stats_timer)), |
| 1320 | + {noreply, State2, Timeout}; |
1310 | 1321 |
|
1311 | 1322 | handle_info({'DOWN', _MonitorRef, process, DownPid, _Reason},
|
1312 | 1323 | State = #q{q = #amqqueue{exclusive_owner = DownPid}}) ->
|
|
0 commit comments