[tor-commits] [sbws/master] Debug time it takes each measurements iteration

juga at torproject.org juga at torproject.org
Mon Oct 29 09:52:13 UTC 2018


commit 50a2e60576e5f5640a1b37b25b97f0ad8c53696a
Author: juga0 <juga at riseup.net>
Date:   Sun Oct 28 15:14:44 2018 +0000

    Debug time it takes each measurements iteration
---
 sbws/core/scanner.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py
index aef6f6a..6188a19 100644
--- a/sbws/core/scanner.py
+++ b/sbws/core/scanner.py
@@ -344,7 +344,10 @@ def run_speedtest(args, conf):
     pool = Pool(max_pending_results)
     pending_results = []
     while True:
+        num_relays = 0
+        loop_tstart = time.time()
         for target in rp.best_priority():
+            num_relays += 1
             log.debug('Measuring %s %s', target.nickname,
                       target.fingerprint[0:8])
             callback = result_putter(rd)
@@ -360,6 +363,9 @@ def run_speedtest(args, conf):
         while len(pending_results) > 0:
             time.sleep(5)
             pending_results = [r for r in pending_results if not r.ready()]
+        loop_tstop = time.time()
+        loop_tdelta = (loop_tstop - loop_tstart) / 60
+        log.debug("Measured %s relays in %s minutes", num_relays, loop_tdelta)
 
 
 def gen_parser(sub):



More information about the tor-commits mailing list