fixes, TLS1.2
This commit is contained in:
parent
ac56eb5b82
commit
08fd52eedb
3 changed files with 105 additions and 41 deletions
86
plots.py
86
plots.py
|
|
@ -48,6 +48,8 @@ COL = {
|
|||
"cert": "alg",
|
||||
"kex": "kex",
|
||||
"ed": "ed",
|
||||
"side": "setup",
|
||||
"record": "record",
|
||||
}
|
||||
# Physical units by object
|
||||
UNIT = {
|
||||
|
|
@ -142,7 +144,7 @@ replot
|
|||
f.close()
|
||||
os.system("gnuplot {plots_dir}/{object}_by_{criterion}_{side}_{record}.gnuplot".format(plots_dir=PLOTS_DIR, **kwargs))
|
||||
|
||||
def make_log_plot(logs, exp, criterion, side, obj, record, machine=None):
|
||||
def make_log_plot(logs, exp, criterion, side, obj, record, machine=None, version=None):
|
||||
f = open(f"/dev/shm/plots/{obj}_by_{criterion}_{side}_{record}.dat", "w")
|
||||
ciphers = {}
|
||||
impls = []
|
||||
|
|
@ -162,6 +164,12 @@ def make_log_plot(logs, exp, criterion, side, obj, record, machine=None):
|
|||
|
||||
for log in logs:
|
||||
if log["exp"] == exp and log["record"] == record and log["setup"] == side:
|
||||
#ver = VER_LABEL[log["cipher"]]
|
||||
#if log[COL[criterion]]+"/"+ver not in ciphers:
|
||||
# ciphers[log[COL[criterion]]+"/"+ver] = {}
|
||||
#ciphers[log[COL[criterion]]+"/"+ver][log["impl"]] = float(log[COL[obj]]) - idle_val * float(log["time"])
|
||||
if version != None and VER_LABEL[log["cipher"]] != version:
|
||||
continue
|
||||
if log[COL[criterion]] not in ciphers:
|
||||
ciphers[log[COL[criterion]]] = {}
|
||||
ciphers[log[COL[criterion]]][log["impl"]] = float(log[COL[obj]]) - idle_val * float(log["time"])
|
||||
|
|
@ -174,14 +182,15 @@ def make_log_plot(logs, exp, criterion, side, obj, record, machine=None):
|
|||
for impl in impls:
|
||||
if impl not in ciphers[cipher]:
|
||||
ciphers[cipher][impl] = 0
|
||||
"""f.write("{}({}) - {}\n".format(
|
||||
ALG_LABEL[cipher],
|
||||
VER_LABEL[log["cipher"]],
|
||||
" ".join([
|
||||
str(ciphers[cipher][impl])
|
||||
for impl in impls
|
||||
]),
|
||||
))"""
|
||||
#cipher_parts = cipher.split("/")
|
||||
#f.write("{}({}) - {}\n".format(
|
||||
# ALG_LABEL[cipher_parts[0]],
|
||||
# cipher_parts[1],
|
||||
# " ".join([
|
||||
# str(ciphers[cipher][impl])
|
||||
# for impl in impls
|
||||
# ]),
|
||||
#))
|
||||
f.write("{} - {}\n".format(
|
||||
ALG_LABEL[cipher],
|
||||
" ".join([
|
||||
|
|
@ -298,6 +307,48 @@ def make_linear_regression(logs):
|
|||
#plt.show()
|
||||
plt.savefig(f"{PLOTS_DIR}/correlation_energy_cpu.png")
|
||||
|
||||
# Measure relative difference between TLS versions
|
||||
def cmp_versions(logs, exps, criteria, objs):
|
||||
ciphers = {}
|
||||
idle_val = None
|
||||
|
||||
for log in logs:
|
||||
if log["exp"] == "idle":
|
||||
idle_val = {obj:float(log[COL[obj]]) / float(log["time"]) for obj in objs}
|
||||
|
||||
for log in logs:
|
||||
if log["exp"] not in exps or log["setup"] == "none":
|
||||
continue
|
||||
ver = VER_LABEL[log["cipher"]]
|
||||
if ver not in ciphers:
|
||||
ciphers[ver] = {}
|
||||
key = []
|
||||
for criterion in criteria:
|
||||
key.append(ALG_LABEL.get(log[COL[criterion]], log[COL[criterion]]))
|
||||
key = "/".join(key)
|
||||
if key not in ciphers[ver]:
|
||||
ciphers[ver][key] = log
|
||||
|
||||
diff_rel_max = {obj:0.0 for obj in objs}
|
||||
diff_rel_sum = {obj:0.0 for obj in objs}
|
||||
diff_rel_num = {obj:0 for obj in objs}
|
||||
for key in ciphers["1.2"]:
|
||||
if key not in ciphers["1.3"]:
|
||||
continue
|
||||
log12 = ciphers["1.2"][key]
|
||||
log13 = ciphers["1.3"][key]
|
||||
for obj in objs:
|
||||
val12 = float(log12[COL[obj]]) - idle_val[obj] * float(log12["time"])
|
||||
val13 = float(log13[COL[obj]]) - idle_val[obj] * float(log13["time"])
|
||||
# Difference relative to the mean of the two values
|
||||
diff_rel = abs(val12 - val13) / ((val12 + val13) / 2)
|
||||
diff_rel_max[obj] = max(diff_rel_max[obj], diff_rel)
|
||||
diff_rel_sum[obj] += diff_rel
|
||||
diff_rel_num[obj] += 1
|
||||
diff_rel_avg = {obj:diff_rel_sum[obj]/diff_rel_num[obj] for obj in objs}
|
||||
print("Diff rel max: ", diff_rel_max)
|
||||
print("Diff rel avg: ", diff_rel_avg)
|
||||
|
||||
def getargv(arg:str, default="", n:int=1, args:list=sys.argv):
|
||||
if arg in args and len(args) > args.index(arg)+n:
|
||||
return args[args.index(arg)+n]
|
||||
|
|
@ -331,16 +382,17 @@ if __name__ == "__main__":
|
|||
machine = getargv("-m", None)
|
||||
|
||||
if cmd == "log":
|
||||
cmp_versions(logs, ["impl-cipher-ver", "impl-cert-ver", "impl-kex-ver"], ["side", "cipher", "cert", "kex", "record"], ["cpu", "energy"])
|
||||
for side in ["client", "server"]:
|
||||
for record in records:
|
||||
make_log_plot(logs, "impl-cipher-ver", "cipher", side, "cpu", record, machine=machine)
|
||||
make_log_plot(logs, "impl-cipher-ver", "cipher", side, "energy", record, machine=machine)
|
||||
make_log_plot(logs, "impl-cert-ver", "cert", side, "cpu", record, machine=machine)
|
||||
make_log_plot(logs, "impl-cert-ver", "cert", side, "energy", record, machine=machine)
|
||||
make_log_plot(logs, "impl-kex-ver", "kex", side, "cpu", record, machine=machine)
|
||||
make_log_plot(logs, "impl-kex-ver", "kex", side, "energy", record, machine=machine)
|
||||
make_log_plot(logs, "zrtt", "ed", side, "cpu", record, machine=machine)
|
||||
make_log_plot(logs, "zrtt", "ed", side, "energy", record, machine=machine)
|
||||
make_log_plot(logs, "impl-cipher-ver", "cipher", side, "cpu", record, machine=machine, version="1.3")
|
||||
make_log_plot(logs, "impl-cipher-ver", "cipher", side, "energy", record, machine=machine, version="1.3")
|
||||
make_log_plot(logs, "impl-cert-ver", "cert", side, "cpu", record, machine=machine, version="1.3")
|
||||
make_log_plot(logs, "impl-cert-ver", "cert", side, "energy", record, machine=machine, version="1.3")
|
||||
make_log_plot(logs, "impl-kex-ver", "kex", side, "cpu", record, machine=machine, version="1.3")
|
||||
make_log_plot(logs, "impl-kex-ver", "kex", side, "energy", record, machine=machine, version="1.3")
|
||||
make_log_plot(logs, "zrtt", "ed", side, "cpu", record, machine=machine, version="1.3")
|
||||
make_log_plot(logs, "zrtt", "ed", side, "energy", record, machine=machine, version="1.3")
|
||||
elif cmd == "prof":
|
||||
for side in ["client-local", "server-local"]:
|
||||
for record in records:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue