From: Alan T. DeKok Date: Fri, 30 Jun 2023 18:22:23 +0000 (-0400) Subject: calculate exponential moving average statistics X-Git-Tag: release_3_2_4~220 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=309fe1eab37f1cd23b541a4fe4dd5327341e6f40;p=thirdparty%2Ffreeradius-server.git calculate exponential moving average statistics --- diff --git a/src/main/process.c b/src/main/process.c index b1a5a41cb3b..d143aae0a62 100644 --- a/src/main/process.c +++ b/src/main/process.c @@ -2864,6 +2864,18 @@ int request_proxy_reply(RADIUS_PACKET *packet) request->priority = RAD_LISTEN_PROXY; #ifdef WITH_STATS + /* + * The average includes our time to receive packets and + * look them up in the hashes, which should be the same + * for all packets. + * + * We update the response time only for the FIRST packet + * we receive. + */ + if (request->home_server->ema.window > 0) { + radius_stats_ema(&request->home_server->ema, &request->proxy->timestamp, &now); + } + /* * Update the proxy listener stats here, because only one * thread accesses that at a time. The home_server and