Changeset

10314:bbc879eab1bf

util.statistics: Add a total count for rate counters, counting from server start.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 10 Oct 2019 16:58:02 +0200
parents 10313:b52f916e1813
children 10315:d4c538a7d655
files util/statistics.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/util/statistics.lua	Wed Oct 09 23:20:22 2019 +0200
+++ b/util/statistics.lua	Thu Oct 10 16:58:02 2019 +0200
@@ -57,12 +57,14 @@
 			end;
 		end;
 		rate = function (name)
-			local since, n = time(), 0;
+			local since, n, total = time(), 0, 0;
 			registry[name..":rate"] = function ()
+				total = total + n;
 				local t = time();
 				local stats = {
 					rate = n/(t-since);
 					count = n;
+					total = total;
 				};
 				since, n = t, 0;
 				return "rate", stats.rate, stats;