plot titles

This commit is contained in:
Pascal Engélibert 2026-02-04 10:31:50 +01:00
commit b9a57aa2e8
3 changed files with 54 additions and 47 deletions

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
netreplay netreplay*
powercap powercap
__pycache__ __pycache__
rpxy_* rpxy_*

50
exp.py
View file

@ -35,16 +35,16 @@ CONFIGS = {
"local": { "local": {
"experiments": [ "experiments": [
"impl-cipher-ver", "impl-cipher-ver",
"impl-cert-ver", #"impl-cert-ver",
"impl-kex-ver", #"impl-kex-ver",
], ],
"setups": [ "setups": [
"none-local", #"none-local",
"client-local", "client-local",
"server-local", #"server-local",
], ],
"records": [ "records": [
{ "filename": "youtube", "repeat": 1 }, { "filename": "wikipedia", "repeat": 50 },
], ],
"repodir": "/home/tuxmain/reps/tlsbench", "repodir": "/home/tuxmain/reps/tlsbench",
"expdir": "/dev/shm/exp", "expdir": "/dev/shm/exp",
@ -53,7 +53,7 @@ CONFIGS = {
"p2_addr": "127.0.0.1", "p2_addr": "127.0.0.1",
"p2_repodir": "/home/tuxmain/reps/tlsbench", "p2_repodir": "/home/tuxmain/reps/tlsbench",
"wattmeter": False, "wattmeter": False,
"perf": True, "perf": False,
"rapl": False, "rapl": False,
"perf_dir": "/home/tuxmain/.cache/exp", "perf_dir": "/home/tuxmain/.cache/exp",
"p3_suffix": ".localhost", "p3_suffix": ".localhost",
@ -64,17 +64,17 @@ CONFIGS = {
"pi3": { "pi3": {
"experiments": [ "experiments": [
"impl-cipher-ver", "impl-cipher-ver",
"impl-cert-ver", #"impl-cert-ver",
"impl-kex-ver", #"impl-kex-ver",
"zrtt" #"zrtt"
], ],
"setups": [ "setups": [
"none", #"none",
"client", "client",
"server", #"server",
], ],
"records": [ "records": [
{ "filename": "wikipedia", "repeat": 400 }, { "filename": "wikipedia", "repeat": 10 },
], ],
"repodir": "/home/tuxmain/reps/tlsbench", "repodir": "/home/tuxmain/reps/tlsbench",
"expdir": "/dev/shm/exp", "expdir": "/dev/shm/exp",
@ -333,11 +333,11 @@ CERT_SIGN_ALGS = [
] ]
IMPLS = [ IMPLS = [
"aws_lc", # Amazon's Rust crypto widely used in Rust stuff "aws_lc", # Amazon's Rust crypto widely used in Rust stuff
"boring", # Google's fork of OpenSSL used in Chrome and Android #"boring", # Google's fork of OpenSSL used in Chrome and Android
"graviola", # New crypto in Rust #"graviola", # New crypto in Rust
"openssl", # widely used #"openssl", # widely used
"ring", # used in most Rust stuff #"ring", # used in most Rust stuff
"symcrypt", # Microsoft's crypto #"symcrypt", # Microsoft's crypto
#"wolfcrypt" # used in embedded (won't build with rpxy for now) #"wolfcrypt" # used in embedded (won't build with rpxy for now)
] ]
# Symmetric ciphers # Symmetric ciphers
@ -369,12 +369,12 @@ EXPERIMENTS = {
"impl-cipher-ver": { "impl-cipher-ver": {
"impls": IMPLS, "impls": IMPLS,
"ciphers": [ "ciphers": [
"AES_128_GCM_SHA256", #"AES_128_GCM_SHA256",
"AES_256_GCM_SHA384", #"AES_256_GCM_SHA384",
"CHACHA20_POLY1305_SHA256", #"CHACHA20_POLY1305_SHA256",
"ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,ECDHE_RSA_WITH_AES_128_GCM_SHA256", "ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,ECDHE_RSA_WITH_AES_128_GCM_SHA256",
"ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,ECDHE_RSA_WITH_AES_256_GCM_SHA384", #"ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", #"ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
], ],
"kexes": ["X25519"], "kexes": ["X25519"],
"cert": ["prime256v1"], "cert": ["prime256v1"],
@ -384,7 +384,7 @@ EXPERIMENTS = {
"impl-cert-ver": { "impl-cert-ver": {
"impls": IMPLS, "impls": IMPLS,
"ciphers": [ "ciphers": [
"AES_128_GCM_SHA256", #"AES_128_GCM_SHA256",
"ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,ECDHE_RSA_WITH_AES_128_GCM_SHA256", "ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,ECDHE_RSA_WITH_AES_128_GCM_SHA256",
], ],
"kexes": ["X25519"], "kexes": ["X25519"],
@ -690,10 +690,10 @@ def make_rpxy_config(outdir, domains, cryptodir, config_name, p3_suffix, p3_port
f.close() f.close()
def make_everything(expdir, domains, make_ca, config_only, p3_suffix, p3_port_plain, p3_port_tls): def make_everything(expdir, domains, make_ca, config_only, p3_suffix, p3_port_plain, p3_port_tls):
if not config_only:
os.makedirs(expdir, exist_ok=True)
if expdir[-1] != "/": if expdir[-1] != "/":
expdir += "/" expdir += "/"
if not config_only:
os.makedirs(expdir, exist_ok=True)
for alg in CERT_SIGN_ALGS: for alg in CERT_SIGN_ALGS:
algdir = expdir+"certs/"+alg algdir = expdir+"certs/"+alg
os.makedirs(algdir, exist_ok=True) os.makedirs(algdir, exist_ok=True)

View file

@ -77,6 +77,9 @@ def gnuplot_histogram(**kwargs):
kwargs["machine"] = ", " + kwargs["machine"] kwargs["machine"] = ", " + kwargs["machine"]
else: else:
kwargs["machine"] = "" kwargs["machine"] = ""
titleline = ""
if kwargs["maketitle"]:
titleline = 'set title font "CMU Sans Serif,12" "{object_title} by {criterion_title} ({record}, {side}{machine}) ({unit})"'.format(**kwargs)
cluster = "" cluster = ""
for i in range(kwargs["nb_impls"]-1): for i in range(kwargs["nb_impls"]-1):
cluster += """, "" using {}:xticlabels(1) title col""".format(i+4) cluster += """, "" using {}:xticlabels(1) title col""".format(i+4)
@ -88,7 +91,7 @@ set boxwidth 0.9 absolute
set style fill solid 1.0 border lt -1 set style fill solid 1.0 border lt -1
set style histogram clustered gap 1 title textcolor lt -1 set style histogram clustered gap 1 title textcolor lt -1
set style data histograms set style data histograms
set title font "CMU Sans Serif,12" "{object_title} by {criterion_title} ({record}, {side}{machine}) ({unit})" {titleline}
#set xtics border in scale 0,0 nomirror rotate by -45 autojustify #set xtics border in scale 0,0 nomirror rotate by -45 autojustify
set xtics border in scale 0,0 nomirror autojustify set xtics border in scale 0,0 nomirror autojustify
#set key fixed right top vertical Right noreverse noenhanced autotitle nobox #set key fixed right top vertical Right noreverse noenhanced autotitle nobox
@ -103,7 +106,7 @@ plot \
set term cairolatex pdf set term cairolatex pdf
set output "{plots_dir}/{object}_by_{criterion}_{side}_{record}.tex" set output "{plots_dir}/{object}_by_{criterion}_{side}_{record}.tex"
replot replot
""".format(plots_dir=PLOTS_DIR, cluster=cluster, **kwargs)) """.format(plots_dir=PLOTS_DIR, cluster=cluster, titleline=titleline, **kwargs))
f.close() f.close()
os.system("gnuplot {plots_dir}/{object}_by_{criterion}_{side}_{record}.gnuplot".format(plots_dir=PLOTS_DIR, **kwargs)) os.system("gnuplot {plots_dir}/{object}_by_{criterion}_{side}_{record}.gnuplot".format(plots_dir=PLOTS_DIR, **kwargs))
@ -112,6 +115,8 @@ def gnuplot_stacked_histogram(**kwargs):
kwargs["machine"] = ", " + kwargs["machine"] kwargs["machine"] = ", " + kwargs["machine"]
else: else:
kwargs["machine"] = "" kwargs["machine"] = ""
if kwargs["maketitle"]:
titleline = 'set title font "CMU Sans Serif,12" "{object_title} by {criterion_title} ({record}, {side}{machine}) ({unit})"'.format(**kwargs)
cluster = "" cluster = ""
#for i in range(kwargs["nb_impls"]-1): #for i in range(kwargs["nb_impls"]-1):
# cluster += """, "" using {}:xticlabels(1) title col""".format(i+4) # cluster += """, "" using {}:xticlabels(1) title col""".format(i+4)
@ -123,7 +128,7 @@ set boxwidth 0.9 absolute
set style fill solid 1.0 border lt -1 set style fill solid 1.0 border lt -1
set style histogram rowstacked set style histogram rowstacked
set style data histograms set style data histograms
set title font "CMU Sans Serif,12" "{object_title} by {criterion_title} ({record}, {side}{machine}) ({unit})" {titleline}
set xtics border in scale 0,0 nomirror noenhanced rotate by 30 right set xtics border in scale 0,0 nomirror noenhanced rotate by 30 right
set lmargin 9 set lmargin 9
set rmargin 1 set rmargin 1
@ -140,11 +145,11 @@ set term pict2e font ",10"
set output "{plots_dir}/{object}_by_{criterion}_{side}_{record}.tex" set output "{plots_dir}/{object}_by_{criterion}_{side}_{record}.tex"
set key font ",10" spacing 0.8 set key font ",10" spacing 0.8
replot replot
""".format(plots_dir=PLOTS_DIR, cluster=cluster, **kwargs).replace("aws_lc", "aws-lc")) """.format(plots_dir=PLOTS_DIR, cluster=cluster, titleline=titleline, **kwargs).replace("aws_lc", "aws-lc"))
f.close() f.close()
os.system("gnuplot {plots_dir}/{object}_by_{criterion}_{side}_{record}.gnuplot".format(plots_dir=PLOTS_DIR, **kwargs)) 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, version=None): def make_log_plot(logs, exp, criterion, side, obj, record, machine=None, version=None, maketitle=True):
f = open(f"/dev/shm/plots/{obj}_by_{criterion}_{side}_{record}.dat", "w") f = open(f"/dev/shm/plots/{obj}_by_{criterion}_{side}_{record}.dat", "w")
ciphers = {} ciphers = {}
impls = [] impls = []
@ -208,10 +213,11 @@ def make_log_plot(logs, exp, criterion, side, obj, record, machine=None, version
unit=UNIT[obj], unit=UNIT[obj],
nb_impls=len(impls), nb_impls=len(impls),
record=record, record=record,
machine=machine machine=machine,
maketitle=maketitle
) )
def make_profile_plot(logs, exp, criterion, side, record, no_flamegraph=False, machine=None): def make_profile_plot(logs, exp, criterion, side, record, no_flamegraph=False, machine=None, maketitle=False):
f = open(f"/dev/shm/plots/profile_by_{criterion}_{side}_{record}.dat", "w") f = open(f"/dev/shm/plots/profile_by_{criterion}_{side}_{record}.dat", "w")
runs = [] runs = []
functions = [] functions = []
@ -264,7 +270,8 @@ def make_profile_plot(logs, exp, criterion, side, record, no_flamegraph=False, m
unit=UNIT["profile"], unit=UNIT["profile"],
record=record, record=record,
nb_functions=len(functions)+1, nb_functions=len(functions)+1,
machine=machine machine=machine,
maketitle=maketitle
) )
# Are CPU and energy proportional # Are CPU and energy proportional
@ -384,27 +391,27 @@ if __name__ == "__main__":
os.makedirs("/dev/shm/plots", exist_ok=True) os.makedirs("/dev/shm/plots", exist_ok=True)
no_flamegraph = "-f" in sys.argv no_flamegraph = "-f" in sys.argv
machine = getargv("-m", None) machine = getargv("-m", None)
maketitle = "-t" not in sys.argv
if cmd == "log": 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 side in ["client", "server"]:
for record in records: for record in records:
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, "cpu", record, machine=machine, version="1.3", maketitle=maketitle)
make_log_plot(logs, "impl-cipher-ver", "cipher", side, "energy", record, machine=machine, version="1.3") make_log_plot(logs, "impl-cipher-ver", "cipher", side, "energy", record, machine=machine, version="1.3", maketitle=maketitle)
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, "cpu", record, machine=machine, version="1.3", maketitle=maketitle)
make_log_plot(logs, "impl-cert-ver", "cert", side, "energy", record, machine=machine, version="1.3") make_log_plot(logs, "impl-cert-ver", "cert", side, "energy", record, machine=machine, version="1.3", maketitle=maketitle)
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, "cpu", record, machine=machine, version="1.3", maketitle=maketitle)
make_log_plot(logs, "impl-kex-ver", "kex", side, "energy", record, machine=machine, version="1.3") make_log_plot(logs, "impl-kex-ver", "kex", side, "energy", record, machine=machine, version="1.3", maketitle=maketitle)
make_log_plot(logs, "zrtt", "ed", side, "cpu", record, machine=machine, version="1.3") make_log_plot(logs, "zrtt", "ed", side, "cpu", record, machine=machine, version="1.3", maketitle=maketitle)
make_log_plot(logs, "zrtt", "ed", side, "energy", record, machine=machine, version="1.3") make_log_plot(logs, "zrtt", "ed", side, "energy", record, machine=machine, version="1.3", maketitle=maketitle)
cmp_versions(logs, ["impl-cipher-ver", "impl-cert-ver", "impl-kex-ver"], ["side", "cipher", "cert", "kex", "record"], ["cpu", "energy"])
elif cmd == "prof": elif cmd == "prof":
for side in ["client-local", "server-local"]: for side in ["client-local", "server-local"]:
for record in records: for record in records:
make_profile_plot(logs, "impl-cipher-ver", "cipher", side, record, no_flamegraph=no_flamegraph, machine=machine) make_profile_plot(logs, "impl-cipher-ver", "cipher", side, record, no_flamegraph=no_flamegraph, machine=machine, maketitle=maketitle)
make_profile_plot(logs, "impl-cert-ver", "cert", side, record, no_flamegraph=no_flamegraph, machine=machine) make_profile_plot(logs, "impl-cert-ver", "cert", side, record, no_flamegraph=no_flamegraph, machine=machine, maketitle=maketitle)
make_profile_plot(logs, "impl-kex-ver", "kex", side, record, no_flamegraph=no_flamegraph, machine=machine) make_profile_plot(logs, "impl-kex-ver", "kex", side, record, no_flamegraph=no_flamegraph, machine=machine, maketitle=maketitle)
elif cmd == "correl": elif cmd == "correl":
from scipy import stats from scipy import stats
import matplotlib.pyplot as plt import matplotlib.pyplot as plt