Constant time

This commit is contained in:
Pascal Engélibert 2026-03-13 14:58:15 +01:00
commit 7ae94371a8
5 changed files with 81 additions and 24 deletions

36
exp.py
View file

@ -87,7 +87,7 @@ CONFIGS = {
True,
],
"records": [
{ "filename": "wikipedia", "repeat": 1000 },
{ "filename": "wikipedia", "repeat": 10000, "time": 90 },
],
"repo_dir": "/home/tuxmain/reps/tlsbench",
"exp_dir": "/dev/shm/exp",
@ -102,7 +102,7 @@ CONFIGS = {
"rapl": False,
"sa": True,
"listen_port": 8080,
"idle": "idle - - - - - - - - - 600.000081539154 0.0 896 4792 0.5399999999999991 0 -",
"idle": "idle - - - - - - - - - - - 600.000081539154 0.0 896 4792 0.5399999999999991 0 -",
"notify_listen": ("0.0.0.0", 8090),
"notify_addr": "192.168.3.1:8090",
},
@ -245,10 +245,11 @@ CONFIGS = {
},
"g5k": {
"experiments": [
"impl-cipher-ver",
"impl-cert-ver",
"impl-kex-ver",
"zrtt",
#"impl-cipher-ver",
#"impl-cert-ver",
#"impl-kex-ver",
#"zrtt",
"realistic",
],
"sides": [
"client",
@ -259,7 +260,7 @@ CONFIGS = {
True,
],
"records": [
{ "filename": "wikipedia", "repeat": 12000 },
{ "filename": "wikipedia", "repeat": 12000, "time": 60 },
],
"repo_dir": "/home/pengelib/tlsbench",
"exp_dir": "/dev/shm/exp",
@ -638,7 +639,9 @@ def run_netreplay_client(ssh, exp_dir, repo_dir, record, remote_addr, remote_por
env["CIPHERS"] = ciphers
if kexes:
env["KEXES"] = kexes
cmd = [repo_dir+"/netreplay"+("" if impl == None else ("-"+impl)), repo_dir+"/records/"+record["filename"], "client", remote_addr, str(remote_port), "-r", str(record["repeat"]), "--certs", certs_dir]
cmd = [repo_dir+"/netreplay"+("" if impl == None else ("-"+impl)), repo_dir+"/records/"+record["filename"], "client", remote_addr, str(remote_port), "--certs", certs_dir]
if "repeat" in record:
cmd += ["-r", str(record["repeat"])]
if debug:
cmd.append("-d")
if tls:
@ -911,7 +914,7 @@ def run_exp(config, only_record=None, idle=False, shutdown=False, debug=False):
# Measure
cpu = 0
if config["sa"]:
cpu = get_cpu_stat(ssh, ["netreplay-"+impl, "tokio-runtime-w"])
cpu = get_cpu_stat(ssh, ["netreplay-"+impl, "tokio-runtime-w", "tokio-rt-worker"])
remote_bytes_in, remote_bytes_out = get_net_stat(ssh)
energy = 0
energy_rapl = 0
@ -922,9 +925,15 @@ def run_exp(config, only_record=None, idle=False, shutdown=False, debug=False):
start = time.time()
# Wait for the client to terminate
signal.alarm(3600)
signal.alarm(record["time"] if "time" in record else 3600)
session_count = 0
try:
notify_socket.recv(4)
while True:
rec_count = int.from_bytes(notify_socket.recv(4))
if rec_count == 0xffffffff:
break
if rec_count > session_count:
session_count = rec_count
except Timeout:
print("TIMEOUT: stop")
@ -953,7 +962,7 @@ def run_exp(config, only_record=None, idle=False, shutdown=False, debug=False):
# Measure CPU after (as it may update only after the process is killed)
new_cpu = 0
if config["sa"]:
new_cpu = get_cpu_stat(ssh, ["netreplay-"+impl, "tokio-runtime-w"])
new_cpu = get_cpu_stat(ssh, ["netreplay-"+impl, "tokio-runtime-w", "tokio-rt-worker"])
record_filename = record["filename"]
cpu_diff = new_cpu - cpu
@ -962,11 +971,10 @@ def run_exp(config, only_record=None, idle=False, shutdown=False, debug=False):
energy_diff = new_energy - energy
energy_rapl_diff = new_energy_rapl - energy_rapl
time_diff = end - start
repeats = record["repeat"]
while True:
try:
with open(logfile_path, "a") as logfile:
logfile.write(f"{expname} {impl} {alg} {kex} {cipher} {earlydata} {side} {tls_int} {record_filename} {repeats} {start} {end} {time_diff} {cpu_diff} {remote_bytes_in_diff} {remote_bytes_out_diff} {energy_diff} {energy_rapl_diff} {prof_filename}\n")
logfile.write(f"{expname} {impl} {alg} {kex} {cipher} {earlydata} {side} {tls_int} {record_filename} {session_count} {start} {end} {time_diff} {cpu_diff} {remote_bytes_in_diff} {remote_bytes_out_diff} {energy_diff} {energy_rapl_diff} {prof_filename}\n")
logfile.close()
break
except Exception as e: