Commit fb82eac8 authored by juga  's avatar juga
Browse files

v3bwfile, tests: add desc_bw_bur attribute

And method to obtain it from results.
parent f3f0d49e
......@@ -50,7 +50,7 @@ BW_KEYVALUES_BASIC = ['node_id', 'bw']
BW_KEYVALUES_FILE = BW_KEYVALUES_BASIC + \
['master_key_ed25519', 'nick', 'rtt', 'time',
'success', 'error_stream', 'error_circ', 'error_misc']
BW_KEYVALUES_EXTRA_BWS = ['bw_median', 'bw_mean', 'desc_bw_avg',
BW_KEYVALUES_EXTRA_BWS = ['bw_median', 'bw_mean', 'desc_bw_avg', 'desc_bw_bur',
'desc_bw_obs_last', 'desc_bw_obs_mean']
BW_KEYVALUES_EXTRA = BW_KEYVALUES_FILE + BW_KEYVALUES_EXTRA_BWS
BW_KEYVALUES_INT = ['bw', 'rtt', 'success', 'error_stream',
......@@ -336,6 +336,8 @@ class V3BWLine(object):
results_recent)
kwargs['desc_bw_avg'] = \
cls.desc_bw_avg_from_results(results_recent)
kwargs['desc_bw_bur'] = \
cls.desc_bw_bur_from_results(results_recent)
kwargs['desc_bw_obs_last'] = \
cls.desc_bw_obs_last_from_results(results_recent)
kwargs['desc_bw_obs_mean'] = \
......@@ -427,6 +429,14 @@ class V3BWLine(object):
return r.relay_average_bandwidth
return None
@staticmethod
def desc_bw_bur_from_results(results):
"""Obtain the last descriptor bandwidth burst from the results."""
for r in reversed(results):
if r.relay_burst_bandwidth is not None:
return r.relay_burst_bandwidth
return None
@staticmethod
def desc_bw_obs_mean_from_results(results):
desc_bw_obs_ls = []
......
......@@ -40,7 +40,7 @@ header_extra_str = LINE_SEP.join(header_extra_ls) + LINE_SEP
# Line produced without any scaling.
raw_bwl_str = "bw=56 bw_mean=61423 bw_median=55656 "\
"desc_bw_avg=1000000000 desc_bw_obs_last=524288 "\
"desc_bw_avg=1000000000 desc_bw_bur=1000000000 desc_bw_obs_last=524288 "\
"desc_bw_obs_mean=524288 error_circ=0 error_misc=0 error_stream=1 " \
"master_key_ed25519=g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s " \
"nick=A " \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment