Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
sbws
Commits
212ba3fd
Commit
212ba3fd
authored
Apr 21, 2018
by
Matt Traudt
Committed by
Matt Traudt
Apr 22, 2018
Browse files
Make the conversion to KiB in a better place
parent
8e650d83
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/core/generate.py
View file @
212ba3fd
...
...
@@ -14,8 +14,9 @@ log = logging.getLogger(__name__)
class
V3BWLine
:
def
__init__
(
self
,
fp
,
bw
,
nick
,
rtts
,
last_time
):
self
.
fp
=
fp
self
.
bw
=
max
(
round
(
bw
),
1
)
self
.
nick
=
nick
# convert to KiB and make sure the answer is at least 1
self
.
bw
=
max
(
round
(
bw
/
1024
),
1
)
# convert to ms
rtts
=
[
round
(
r
*
1000
)
for
r
in
rtts
]
self
.
rtt
=
round
(
median
(
rtts
))
...
...
@@ -34,7 +35,7 @@ def result_data_to_v3bw_line(data, fingerprint):
assert
isinstance
(
res
,
ResultSuccess
)
results
=
data
[
fingerprint
]
nick
=
results
[
0
].
nickname
speeds
=
[
dl
[
'amount'
]
/
dl
[
'duration'
]
/
1024
speeds
=
[
dl
[
'amount'
]
/
dl
[
'duration'
]
for
r
in
results
for
dl
in
r
.
downloads
]
speed
=
median
(
speeds
)
rtts
=
[
rtt
for
r
in
results
for
rtt
in
r
.
rtts
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment