From a3a2c1e5a471b425d971dfb776ba324266b2881b Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 24 May 2019 17:32:59 +0100 Subject: Store IRCSocket connect_time, show bytes read/write per second in stats.py --- modules/stats.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/stats.py') diff --git a/modules/stats.py b/modules/stats.py index d25f6914..e8f1ea5b 100644 --- a/modules/stats.py +++ b/modules/stats.py @@ -49,6 +49,7 @@ class Module(ModuleManager.BaseModule): return {"networks": networks, "channels": channels, "users": users} def _server_stats(self, server): + connected_seconds = time.time()-server.connect_time return { "hostname": server.connection_params.hostname, "port": server.connection_params.port, @@ -58,7 +59,10 @@ class Module(ModuleManager.BaseModule): server.nickname, server.username, server.hostname), "users": len(server.users), "bytes-written": server.socket.bytes_written, + "bytes-written-per-second": + server.socket.bytes_written/connected_seconds, "bytes-read": server.socket.bytes_read, + "bytes-read-per-second": server.socket.bytes_read/connected_seconds, "channels": { c.name: self._channel_stats(c) for c in server.channels }, -- cgit v1.3.1-10-gc9f91