commit 063ea9bca63343996a8e3e3f6d3c2142bad8681e Author: Mike Perry mikeperry-git@fscked.org Date: Fri Dec 2 17:04:04 2011 -0800
Make the pid target bw actually converge.
This seems to only take a few seconds to do.. Expensive, but probably not prohibitively so? --- NetworkScanners/BwAuthority/README.spec.txt | 2 +- NetworkScanners/BwAuthority/aggregate.py | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/NetworkScanners/BwAuthority/README.spec.txt b/NetworkScanners/BwAuthority/README.spec.txt index bc94eee..e46994c 100644 --- a/NetworkScanners/BwAuthority/README.spec.txt +++ b/NetworkScanners/BwAuthority/README.spec.txt @@ -545,7 +545,7 @@ "bwauthpidtgt=1" If present, the PID setpoint bandwidth F_avg will be re-computed by averaging the F_node values for only those nodes whose - descriptor bandwidth exceeds the F_avg computed from Section 3.1. + descriptor bandwidth exceeds the F_avg.
Note that this parameter causes bwauthbestratio to have no effect. diff --git a/NetworkScanners/BwAuthority/aggregate.py b/NetworkScanners/BwAuthority/aggregate.py index 1dc39ca..ca26b2d 100755 --- a/NetworkScanners/BwAuthority/aggregate.py +++ b/NetworkScanners/BwAuthority/aggregate.py @@ -482,9 +482,14 @@ def main(argv): true_circ_avg[cl] = sum(map(lambda n: (1.0-n.circ_fail_rate), c_nodes))/float(len(c_nodes))
- f_nodes = filter(lambda n: n.desc_bw >= true_filt_avg[cl], c_nodes) + # FIXME: This may be expensive + pid_tgt_avg[cl] = true_filt_avg[cl] + prev_pid_avg = 2*pid_tgt_avg[cl]
- pid_tgt_avg[cl] = sum(map(lambda n: n.filt_bw, f_nodes))/float(len(f_nodes)) + while prev_pid_avg > pid_tgt_avg[cl]: + f_nodes = filter(lambda n: n.desc_bw >= pid_tgt_avg[cl], c_nodes) + prev_pid_avg = pid_tgt_avg[cl] + pid_tgt_avg[cl] = sum(map(lambda n: n.filt_bw, f_nodes))/float(len(f_nodes))
plog("INFO", "Network true_filt_avg["+cl+"]: "+str(true_filt_avg[cl])) plog("INFO", "Network pid_tgt_avg["+cl+"]: "+str(pid_tgt_avg[cl])) @@ -494,9 +499,15 @@ def main(argv): strm_avg = sum(map(lambda n: n.strm_bw, nodes.itervalues()))/float(len(nodes)) circ_avg = sum(map(lambda n: (1.0-n.circ_fail_rate), nodes.itervalues()))/float(len(nodes)) - f_nodes = filter(lambda n: n.desc_bw >= strm_avg, nodes.itervalues)
- pid_avg = sum(map(lambda n: n.filt_bw, f_nodes))/float(len(f_nodes)) + # FIXME: This may be expensive + pid_avg = filt_avg + prev_pid_avg = 2*pid_avg + + while prev_pid_avg > pid_avg: + f_nodes = filter(lambda n: n.desc_bw >= pid_avg, c_nodes) + prev_pid_avg = pid_avg + pid_avg = sum(map(lambda n: n.filt_bw, f_nodes))/float(len(f_nodes))
for cl in ["Guard+Exit", "Guard", "Exit", "Middle"]: true_filt_avg[cl] = filt_avg
tor-commits@lists.torproject.org