[tor-commits] [onionperf/master] Fix visualizations.

karsten at torproject.org karsten at torproject.org
Mon Aug 10 09:30:41 UTC 2020


commit b9dbc158666940bc1bb2c7ffccee2b73873c7368
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Sun Jul 12 23:18:29 2020 +0200

    Fix visualizations.
    
    Turns out that stream_info/recvsize contains a string, not an int.
---
 onionperf/visualization.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/onionperf/visualization.py b/onionperf/visualization.py
index 52d08fc..80c0781 100644
--- a/onionperf/visualization.py
+++ b/onionperf/visualization.py
@@ -70,12 +70,12 @@ class TGenVisualization(Visualization):
                                      stream["time_to_last_byte"] = float(s["usecs-to-last-byte-recv"])/1000000
                              if "elapsed_seconds" in stream_data:
                                  s = stream_data["elapsed_seconds"]
-                                 # Explanation of the math below for computing Mbps: From filesize_bytes
-                                 # and payload_progress fields we can compute the number of seconds that
+                                 # Explanation of the math below for computing Mbps: From stream_info/recvsize
+                                 # and payload_progress_recv fields we can compute the number of seconds that
                                  # have elapsed between receiving bytes 524,288 and 1,048,576, which is a
                                  # total amount of 524,288 bytes or 4,194,304 bits or 4.194304 megabits.
                                  # We want the reciprocal of that value with unit megabits per second.
-                                 if stream_data["stream_info"]["recvsize"] == 5242880 and "0.2" in s["payload_progress_recv"]:
+                                 if stream_data["stream_info"]["recvsize"] == "5242880" and "0.2" in s["payload_progress_recv"]:
                                       stream["mbps"] = 4.194304 / (s["payload_progress_recv"]["0.2"] - s["payload_progress_recv"]["0.1"])
                              if "error" in stream_data["transport_info"] and stream_data["transport_info"]["error"] != "NONE":
                                  stream["error_code"] = stream_data["transport_info"]["error"]





More information about the tor-commits mailing list