[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [sbws/master] Add methods to log stats



commit be90985edd6dff57d33be095cde1f3926382fd09
Author: juga0 <juga@xxxxxxxxxx>
Date:   Fri Aug 31 14:07:53 2018 +0000

    Add methods to log stats
---
 sbws/lib/v3bwfile.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py
index 545cd77..5621557 100644
--- a/sbws/lib/v3bwfile.py
+++ b/sbws/lib/v3bwfile.py
@@ -724,6 +724,22 @@ class V3BWFile(object):
     def median_bw(self):
         return median([l.bw for l in self.bw_lines])
 
+    @property
+    def max_bw(self):
+        return max([l.bw for l in self.bw_lines])
+
+    @property
+    def min_bw(self):
+        return min([l.bw for l in self.bw_lines])
+
+    @property
+    def info_stats(self):
+        if not self.bw_lines:
+            return
+        [log.info(': '.join([attr, str(getattr(self, attr))])) for attr in
+         ['sum_bw', 'mean_bw', 'median_bw', 'num',
+          'max_bw', 'min_bw']]
+
     def bw_line_for_node_id(self, node_id):
         """Returns the bandwidth line for a given node fingerprint.
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits