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
2e152530
Commit
2e152530
authored
Apr 01, 2018
by
Matt Traudt
Browse files
Add last successful measurement time to v3bw files
parent
b2704ae3
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/commands/generate.py
View file @
2e152530
...
...
@@ -10,18 +10,19 @@ import time
class
V3BWLine
:
def
__init__
(
self
,
fp
,
bw
,
nick
,
rtts
):
def
__init__
(
self
,
fp
,
bw
,
nick
,
rtts
,
last_time
):
self
.
fp
=
fp
self
.
bw
=
bw
self
.
nick
=
nick
# convert to ms
rtts
=
[
round
(
r
*
1000
)
for
r
in
rtts
]
self
.
rtt
=
round
(
median
(
rtts
))
self
.
time
=
last_time
def
__str__
(
self
):
frmt
=
'node_id={fp} bw={sp} nick={n} rtt={rtt}'
frmt
=
'node_id={fp} bw={sp} nick={n} rtt={rtt}
time={t}
'
return
frmt
.
format
(
fp
=
self
.
fp
,
sp
=
round
(
self
.
bw
),
n
=
self
.
nick
,
rtt
=
self
.
rtt
)
rtt
=
self
.
rtt
,
t
=
self
.
time
)
def
result_data_to_v3bw_line
(
data
,
fingerprint
):
...
...
@@ -35,7 +36,8 @@ def result_data_to_v3bw_line(data, fingerprint):
for
r
in
results
for
dl
in
r
.
downloads
]
speed
=
median
(
speeds
)
rtts
=
[
rtt
for
r
in
results
for
rtt
in
r
.
rtts
]
return
V3BWLine
(
fingerprint
,
speed
,
nick
,
rtts
)
last_time
=
round
(
max
([
r
.
time
for
r
in
results
]))
return
V3BWLine
(
fingerprint
,
speed
,
nick
,
rtts
,
last_time
)
def
warn_if_not_accurate_enough
(
lines
,
constant
):
...
...
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