Commit 8e650d83 authored by Matt Traudt's avatar Matt Traudt Committed by Matt Traudt
Browse files

Change bw values in v3bw file to be in KiB

GH: closes #97
parent 66de536b
......@@ -34,7 +34,7 @@ def result_data_to_v3bw_line(data, fingerprint):
assert isinstance(res, ResultSuccess)
results = data[fingerprint]
nick = results[0].nickname
speeds = [dl['amount'] / dl['duration']
speeds = [dl['amount'] / dl['duration'] / 1024
for r in results for dl in r.downloads]
speed = median(speeds)
rtts = [rtt for r in results for rtt in r.rtts]
......
......@@ -93,7 +93,7 @@ def dotsbws_success_result(empty_dotsbws_datadir):
server_ip = '169.254.100.2'
scanner_nick = 'SBWSscanner'
rtts = [4.242]
downloads = [{'duration': 4, 'amount': 40}]
downloads = [{'duration': 4, 'amount': 40*1024}]
t = time.time()
relay = Result.Relay(fp1, nick, relay_ip)
result = ResultSuccess(rtts, downloads, relay, circ, server_ip,
......@@ -121,7 +121,7 @@ def dotsbws_success_result_one_relay(empty_dotsbws_datadir):
server_ip = '169.254.100.2'
scanner_nick = 'SBWSscanner'
rtts = [5, 25]
downloads = [{'duration': 4, 'amount': 40}]
downloads = [{'duration': 4, 'amount': 40*1024}]
t = time.time()
relay = Result.Relay(fp1, nick, relay_ip)
result = ResultSuccess(rtts, downloads, relay, circ, server_ip,
......@@ -129,7 +129,7 @@ def dotsbws_success_result_one_relay(empty_dotsbws_datadir):
write_result_to_datadir(result, dd)
rtts = [10, 20]
downloads = [{'duration': 4, 'amount': 80}]
downloads = [{'duration': 4, 'amount': 80*1024}]
t = time.time()
result = ResultSuccess(rtts, downloads, relay, circ, server_ip,
scanner_nick, t=t)
......@@ -154,7 +154,7 @@ def dotsbws_success_result_two_relays(empty_dotsbws_datadir):
server_ip = '169.254.100.3'
scanner_nick = 'SBWSscanner'
rtts = [5, 25]
downloads = [{'duration': 4, 'amount': 40}]
downloads = [{'duration': 4, 'amount': 40*1024}]
t = time.time()
relay = Result.Relay(fp1, nick, relay_ip)
result = ResultSuccess(rtts, downloads, relay, circ, server_ip,
......@@ -162,7 +162,7 @@ def dotsbws_success_result_two_relays(empty_dotsbws_datadir):
write_result_to_datadir(result, dd)
rtts = [10, 20]
downloads = [{'duration': 4, 'amount': 80}]
downloads = [{'duration': 4, 'amount': 80*1024}]
t = time.time()
result = ResultSuccess(rtts, downloads, relay, circ, server_ip,
scanner_nick, t=t)
......@@ -173,7 +173,7 @@ def dotsbws_success_result_two_relays(empty_dotsbws_datadir):
nick = 'CowSayWhat2'
relay_ip = '169.254.100.2'
rtts = [50, 250]
downloads = [{'duration': 4, 'amount': 400}]
downloads = [{'duration': 4, 'amount': 400*1024}]
t = time.time()
relay = Result.Relay(fp1, nick, relay_ip)
result = ResultSuccess(rtts, downloads, relay, circ, server_ip,
......@@ -181,7 +181,7 @@ def dotsbws_success_result_two_relays(empty_dotsbws_datadir):
write_result_to_datadir(result, dd)
rtts = [100, 200]
downloads = [{'duration': 4, 'amount': 800}]
downloads = [{'duration': 4, 'amount': 800*1024}]
t = time.time()
result = ResultSuccess(rtts, downloads, relay, circ, server_ip,
scanner_nick, t=t)
......
......@@ -104,7 +104,7 @@ def test_generate_single_success_noscale(dotsbws_success_result, caplog,
v = 'version={}'.format(version)
assert stdout_lines[1] == v
bw = round(median([dl['amount'] / dl['duration']
bw = round(median([dl['amount'] / dl['duration'] / 1024
for dl in result.downloads]))
rtt = median([round(r * 1000) for r in result.rtts])
bw_line = 'node_id=${} bw={} nick={} rtt={} time={}'.format(
......@@ -166,8 +166,8 @@ def test_generate_single_relay_success_noscale(
v = 'version={}'.format(version)
assert stdout_lines[1] == v
speeds = [dl['amount'] / dl['duration'] for r in results
for dl in r.downloads]
speeds = [dl['amount'] / dl['duration'] / 1024
for r in results for dl in r.downloads]
speed = round(median(speeds))
rtt = round(median([round(r * 1000) for r in result.rtts]))
bw_line = 'node_id=${} bw={} nick={} rtt={} time={}'.format(
......@@ -233,8 +233,8 @@ def test_generate_two_relays_success_noscale(
r1_time = round(max([r.time for r in r1_results]))
r1_name = r1_results[0].nickname
r1_fingerprint = r1_results[0].fingerprint
r1_speeds = [dl['amount'] / dl['duration'] for r in r1_results
for dl in r.downloads]
r1_speeds = [dl['amount'] / dl['duration'] / 1024
for r in r1_results for dl in r.downloads]
r1_speed = round(median(r1_speeds))
r1_rtt = round(median([round(rtt * 1000) for r in r1_results
for rtt in r.rtts]))
......@@ -246,8 +246,8 @@ def test_generate_two_relays_success_noscale(
r2_time = round(max([r.time for r in r2_results]))
r2_name = r2_results[0].nickname
r2_fingerprint = r2_results[0].fingerprint
r2_speeds = [dl['amount'] / dl['duration'] for r in r2_results
for dl in r.downloads]
r2_speeds = [dl['amount'] / dl['duration'] / 1024
for r in r2_results for dl in r.downloads]
r2_speed = round(median(r2_speeds))
r2_rtt = round(median([round(rtt * 1000) for r in r2_results
for rtt in r.rtts]))
......
Supports Markdown
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