]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
calculate exponential moving average statistics
authorAlan T. DeKok <aland@freeradius.org>
Fri, 30 Jun 2023 18:22:23 +0000 (14:22 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 30 Jun 2023 18:22:23 +0000 (14:22 -0400)
src/main/process.c

index b1a5a41cb3b496049862f0af0ca37f7f977fee98..d143aae0a626978ba8b24366b7e9763954b5b192 100644 (file)
@@ -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