diff options
| author | Karsten Loesing <karsten.loesing@gmx.net> | 2020-05-28 22:46:01 +0200 |
|---|---|---|
| committer | Karsten Loesing <karsten.loesing@gmx.net> | 2020-05-28 22:46:01 +0200 |
| commit | 73855c0bf1f1017c21520ef10b8f05be25e4f80a (patch) | |
| tree | f10f107635b318543bd809e6104d615d6c787d29 | |
| parent | 96cf57f8862b5341d1e0724aecef2c294fe81f3b (diff) | |
Add CDF-DL graph.task-33257
Implements #33257.
| -rw-r--r-- | onionperf/visualization.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/onionperf/visualization.py b/onionperf/visualization.py index a4b2a47..2df1793 100644 --- a/onionperf/visualization.py +++ b/onionperf/visualization.py @@ -42,6 +42,7 @@ class TGenVisualization(Visualization): self.__plot_lastbyte_box() self.__plot_lastbyte_bar() self.__plot_lastbyte_time() + self.__plot_throughput_ecdf() self.__plot_downloads_count() self.__plot_errors_count() self.__plot_errors_time() @@ -58,6 +59,16 @@ class TGenVisualization(Visualization): transfer["server"] = "onion" if ".onion:" in transfer_data["endpoint_remote"] else "public" if "elapsed_seconds" in transfer_data: s = transfer_data["elapsed_seconds"] + if "payload_progress" in s: + # Explanation of the math below for computing Mbps: From filesize_bytes + # and payload_progress 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 transfer_data["filesize_bytes"] == 1048576 and "1.0" in s["payload_progress"]: + transfer["mbps"] = 4.194304 / (s["payload_progress"]["1.0"] - s["payload_progress"]["0.5"]) + if transfer_data["filesize_bytes"] == 5242880 and "0.2" in s["payload_progress"]: + transfer["mbps"] = 4.194304 / (s["payload_progress"]["0.2"] - s["payload_progress"]["0.1"]) if "first_byte" in s: transfer["time_to_first_byte"] = s["first_byte"] if "last_byte" in s: @@ -116,6 +127,13 @@ class TGenVisualization(Visualization): title="Time to download last of {0} bytes from {1} service over time".format(bytes, server), xlabel="Download start time", ylabel="Download time (s)") + def __plot_throughput_ecdf(self): + for server in self.data["server"].unique(): + self.__draw_ecdf(x="mbps", hue="label", hue_name="Data set", + data=self.data[self.data["server"] == server], + title="Throughput when downloading from {0} server".format(server), + xlabel="Throughput (Mbps)", ylabel="Cumulative Fraction") + def __plot_downloads_count(self): for bytes in np.sort(self.data["filesize_bytes"].unique()): for server in self.data["server"].unique(): |
