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
juga
sbws
Commits
5a9be7c5
Commit
5a9be7c5
authored
Aug 30, 2018
by
juga
Browse files
Add methods to obtain median/last observed bw
parent
f34d0c0d
Changes
1
Show whitespace changes
Inline
Side-by-side
sbws/lib/v3bwfile.py
View file @
5a9be7c5
...
...
@@ -317,6 +317,24 @@ class V3BWLine(object):
for
rt
in
_ResultType
])
return
rt_dict
@
staticmethod
def
desc_obs_bw_bs_mean_from_results
(
results
):
desc_obs_bws
=
[]
for
r
in
results
:
if
r
.
relay_observed_bandwidth
is
not
None
:
desc_obs_bws
.
append
(
r
.
relay_observed_bandwidth
)
if
desc_obs_bws
:
return
max
(
round
(
mean
(
desc_obs_bws
)),
1
)
return
None
@
staticmethod
def
desc_obs_bw_bs_last_from_results
(
results
):
# the last is at the end of the list
for
r
in
reversed
(
results
):
if
r
.
relay_observed_bandwidth
is
not
None
:
return
r
.
relay_observed_bandwidth
return
None
@
property
def
bw_keyvalue_tuple_ls
(
self
):
"""Return list of KeyValue Bandwidth Line tuples."""
...
...
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