Commit 142e1ad4 authored by Cecylia Bocovich's avatar Cecylia Bocovich
Browse files

Removed bandwidth log from makecsv

Updated readme and removed total bandwidth time measurements from
bridgetest and makecsv because we use pcap files to get a more accurate
idea of throughput.
parent 7e4bf94e
Prerequesites:
#Python 2.7 and related packages
apt install python python-pip
pip install stem
#Python 3 and related packages
apt install python python-pip3
pip3 install stem
#obfs4 and tor
apt install obfs4proxy tor torsocks
......@@ -18,7 +18,7 @@ Add to crontab to run tests 4x a day:
0 */6 * * * cd ~/bridgetest && ./bridgetest.sh [SITENAME]
Generate a CSV file from logs:
find log -name '*.log' | sort | ./makecsv > bridgetest.csv 2> bandwidth.csv
find log -name '*.log' | sort | ./makecsv > bridgetest.csv
Make a graph:
Rscript graph.R bridgetest.csv
......@@ -54,16 +54,9 @@ def download_file(socks_port):
logging.info("Attempting to download large file")
try:
start = time.time()
subprocess.run(["/usr/bin/torsocks", "-P", str(socks_port), "wget", "-O", "/dev/null", LARGE_FILE_URL], check=True)
stop = time.time()
download_time = stop - start
except subprocess.CalledProcessError as e:
logging.info("failed to download file: %s", e)
download_time = -1
finally:
return download_time
def start_tor(tor_config):
......@@ -154,10 +147,7 @@ with open(bridge_lines_file) as f:
continue
#Now try a large file download
download_time = download_file(socks_port)
f = open(os.path.join(".", "%s.log" % nickname), 'a')
f.write("Downloaded " + str(download_time) + "s\n")
f.close()
download_file(socks_port)
tor_proc.terminate()
tor_proc.wait()
......
......@@ -12,18 +12,13 @@ locale.setlocale(locale.LC_ALL, "C")
# Dec 01 20:57:53.000 [notice] Bootstrapped 0%: Starting
bootstrapped_re = re.compile(r'^(\w+ \d+ \d\d:\d\d:\d\d\.\d\d\d) \[\w+\] Bootstrapped (\d+)%')
bandwidth_re = re.compile(r'^Downloaded (-?\d+.\d+)s')
csvW = csv.DictWriter(sys.stdout, fieldnames=("timestamp", "site", "runid", "nickname", "percent"))
csvW.writeheader()
csvE = csv.DictWriter(sys.stderr, fieldnames=("site", "runid", "nickname", "download"))
csvE.writeheader()
def process_log(f, site, runid, nickname):
for line in f:
m = bootstrapped_re.match(line)
n = bandwidth_re.match(line)
if m is not None:
timestamp = datetime.datetime.strptime(m.group(1), "%b %d %H:%M:%S.%f")
......@@ -39,16 +34,6 @@ def process_log(f, site, runid, nickname):
"percent": percent,
}
csvW.writerow(row)
elif n is not None:
download_time = n.group(1)
row = {
"site": site,
"runid": runid,
"nickname": nickname,
"download": download_time,
}
csvE.writerow(row)
for filename in sys.stdin:
filename = filename.strip()
......
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