Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correcting kB_s and MB_s in UDP for correct calculation #34

Merged
merged 2 commits into from
Apr 13, 2019
Merged

correcting kB_s and MB_s in UDP for correct calculation #34

merged 2 commits into from
Apr 13, 2019

Conversation

gleichda
Copy link
Contributor

During using of the Python Wrapper I saw that kB_s and MB_s are not correctly calculated. This is the fix for it

@coveralls
Copy link

coveralls commented Jun 15, 2018

Coverage Status

Coverage remained the same at 97.625% when pulling f80cd3e on mirgleich:master into 6656d04 on thiezn:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.625% when pulling 8fa7019 on mirgleich:master into 6656d04 on thiezn:master.

4 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.625% when pulling 8fa7019 on mirgleich:master into 6656d04 on thiezn:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.625% when pulling 8fa7019 on mirgleich:master into 6656d04 on thiezn:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.625% when pulling 8fa7019 on mirgleich:master into 6656d04 on thiezn:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.625% when pulling 8fa7019 on mirgleich:master into 6656d04 on thiezn:master.

@ChristofKaufmann
Copy link
Contributor

Yes, it is wrong currently. However, there is a comment, that says:

# Bits are measured in 10**3 terms
# Bytes are measured in 2**10 terms

So your fix should actually be:

diff --git a/iperf3/iperf3.py b/iperf3/iperf3.py
index 7aceed1..a3f5c4e 100755
--- a/iperf3/iperf3.py
+++ b/iperf3/iperf3.py
@@ -841,8 +841,8 @@ class TestResult(object):
                 self.jitter_ms = self.json['end']['sum']['jitter_ms']
                 self.kbps = self.bps / 1000
                 self.Mbps = self.kbps / 1000
-                self.kB_s = self.kbps / (8 * 1024)
-                self.MB_s = self.Mbps / 1024
+                self.kB_s = self.bps / (8 * 1024)
+                self.MB_s = self.kB_s / 1024
                 self.packets = self.json['end']['sum']['packets']
                 self.lost_packets = self.json['end']['sum']['lost_packets']
                 self.lost_percent = self.json['end']['sum']['lost_percent']

@gleichda
Copy link
Contributor Author

gleichda commented Feb 1, 2019

Thanks @ChristofKaufmann adapted the code

@thiezn thiezn merged commit 7c7786c into thiezn:master Apr 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants