commit fe1be7ba6e4f3e7703fd2208b9db315f758716e0 Merge: 6380445 2abbad4 Author: juga0 juga@riseup.net Date: Mon Oct 29 09:18:48 2018 +0000
Merge branch 'ticket28216_torflow_diff'
CHANGELOG.md | 2 ++ sbws/globals.py | 3 +++ sbws/lib/v3bwfile.py | 22 ++++++++++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-)
diff --cc sbws/lib/v3bwfile.py index a070150,4b851d0..72ab58c --- a/sbws/lib/v3bwfile.py +++ b/sbws/lib/v3bwfile.py @@@ -592,7 -591,22 +595,22 @@@ class V3BWFile(object) 'allowed', (1 - accuracy_ratio) * 100, margin * 100)
@staticmethod - def is_max_bw_diff_perc_reachede(bw_lines, max_bw_diff_perc, - MAX_BW_DIFF_PERC): - sum_consensus_bw = sum([l.desc_obs_bw_bs_last for l in bw_lines]) ++ def is_max_bw_diff_perc_reached(bw_lines, ++ max_bw_diff_perc=MAX_BW_DIFF_PERC): ++ sum_consensus_bw = sum([l.desc_bw_obs_last for l in bw_lines]) + sum_bw = sum([l.bw for l in bw_lines]) + diff = min(sum_consensus_bw, sum_bw) / max(sum_consensus_bw, sum_bw) + diff_perc = diff * 100 + log.info("The difference between the total consensus bandwidth " + "and the total measured bandwidth is %s%% percent", + diff_perc) + if diff_perc > MAX_BW_DIFF_PERC: + log.warning("It is more than %s%%", max_bw_diff_perc) + return True + return False + + @staticmethod - def bw_torflow_scale(bw_lines, desc_obs_bws=TORFLOW_OBS_MEAN, + def bw_torflow_scale(bw_lines, desc_bw_obs_type=TORFLOW_OBS_MEAN, cap=TORFLOW_BW_MARGIN, num_round_dig=TORFLOW_ROUND_DIG, reverse=False): """
tor-commits@lists.torproject.org