Profile graphs

This commit is contained in:
Pascal Engélibert 2025-11-26 17:05:05 +01:00
commit a81a01f394
5 changed files with 115 additions and 56 deletions

27
exp.py
View file

@ -33,13 +33,14 @@ CONFIGS = {
"setups": [
"none-local",
"client-local",
#"server-local",
"server-local",
],
"p2_hostname": "localhost",
"p2_addr": "127.0.0.1",
"p2_repodir": "/home/tuxmain/reps/tlsbench",
"wattmeter": False,
"perf": True,
"perf_dir": "/home/tuxmain/.cache/exp",
"p3_suffix": ".localhost",
"p3_port_plain": 8080,
"p3_port_tls": 8443,
@ -75,7 +76,7 @@ DOMAINS_ = [
]
RECORDS = [
{ "filename": "youtube", "repeat": 2 },
{ "filename": "youtube", "repeat": 1 },
#{ "filename": "peertube", "repeat": 10 },
#{ "filename": "wikipedia", "repeat": 1 },
#{ "filename": "apple", "repeat": 1000 },
@ -90,8 +91,8 @@ CERT_SIGN_ALGS = [
IMPLS = [
"aws_lc_rs", # Amazon's Rust crypto widely used in Rust stuff
#"boring", # Google's fork of OpenSSL used in Chrome and Android
"openssl", # widely used
"ring", # used in most Rust stuff
#"openssl", # widely used
#"ring", # used in most Rust stuff
#"symcrypt", # Microsoft's crypto
#"wolfcrypt" # used in embedded (won't build with rpxy for now)
]
@ -519,9 +520,14 @@ def run_exp(expdir, config, only_record=None, idle=False):
logfile_name = "log-"+timestr
logfile_path = expdir+"/"+logfile_name
logfile = open(logfile_path, "w")
logfile.write("exp impl alg kex cipher setup record time cpu bytes_in bytes_out Wh\n")
logfile.write("exp impl alg kex cipher setup record time cpu bytes_in bytes_out Wh prof\n")
logfile.close()
perf_dir = ""
if config["perf"]:
perf_dir = config["perf_dir"]
os.makedirs(perf_dir, exist_ok=True)
if idle:
print("Measuring idle...")
rpxy_cpu = get_cpu_stat(ssh)
@ -547,7 +553,7 @@ def run_exp(expdir, config, only_record=None, idle=False):
while True:
try:
with open(logfile_path, "a") as logfile:
logfile.write(f"idle - - - - - - {time_diff} {rpxy_cpu_diff} {p2_bytes_in_diff} {p2_bytes_out_diff} {energy_diff}\n")
logfile.write(f"idle - - - - - - {time_diff} {rpxy_cpu_diff} {p2_bytes_in_diff} {p2_bytes_out_diff} {energy_diff} -\n")
logfile.close()
break
except Exception as e:
@ -582,14 +588,17 @@ def run_exp(expdir, config, only_record=None, idle=False):
for record in exp["records"]:
print(f"EXPERIMENT {expname}: {impl} {alg} {kex} {cipher} {setup}")
p2_rpxy_config = SETUPS[setup]["rpxy_config"]
vars = {"CIPHERS": cipher, "KEXES": kex, "RUST_LOG": "debug", "LD_PRELOAD": "/dev/shm/openssl-3.6.0/libssl.so.3 /dev/shm/openssl-3.6.0/libcrypto.so.3"}
vars = {"CIPHERS": cipher, "KEXES": kex, "RUST_LOG": "warning"}
cmd = f"{p2_path}/rpxy_rustls_{impl} --config {expdir}/configs/{p2_rpxy_config}.toml --log-dir /dev/shm"
#cmd = f"{p2_path}/rpxy_rustls_{impl} --config {expdir}/configs/{p2_rpxy_config}.toml"
ssh_run_bg(ssh, cmd, env=vars)
time.sleep(1)
prof_filename = "-"
if config["perf"]:
prof_filename = f"{perf_dir}/perf-{timestr}-{run_id}.data"
rpxy_pid = ssh_run(ssh, f"pidof rpxy_rustls_{impl}").removesuffix("\n")
ssh_run_bg(ssh, f"perf record -F 997 --call-graph dwarf,64000 -g -o {expdir}/perf-{timestr}-{run_id}.data -p {rpxy_pid}")
ssh_run_bg(ssh, f"perf record -F 997 --call-graph dwarf,64000 -g -o {prof_filename} -p {rpxy_pid}")
run_id += 1
@ -648,7 +657,7 @@ def run_exp(expdir, config, only_record=None, idle=False):
while True:
try:
with open(logfile_path, "a") as logfile:
logfile.write(f"{expname} {impl} {alg} {kex} {cipher} {setup} {record_filename} {time_diff} {rpxy_cpu_diff} {p2_bytes_in_diff} {p2_bytes_out_diff} {energy_diff}\n")
logfile.write(f"{expname} {impl} {alg} {kex} {cipher} {setup} {record_filename} {time_diff} {rpxy_cpu_diff} {p2_bytes_in_diff} {p2_bytes_out_diff} {energy_diff} {prof_filename}\n")
logfile.close()
break
except Exception as e: