Profile
This commit is contained in:
parent
f005d68e50
commit
0335dac6d4
4 changed files with 378 additions and 157 deletions
72
plots.py
72
plots.py
|
|
@ -59,15 +59,15 @@ def gnuplot_histogram(**kwargs):
|
|||
cluster = ""
|
||||
for i in range(kwargs["nb_impls"]-1):
|
||||
cluster += """, "" using {}:xticlabels(1) title col""".format(i+4)
|
||||
f = open("{plots_dir}/{object}_by_{criterion}_{side}.gnuplot".format(plots_dir=PLOTS_DIR, **kwargs), "w")
|
||||
f = open("{plots_dir}/{object}_by_{criterion}_{side}_{record}.gnuplot".format(plots_dir=PLOTS_DIR, **kwargs), "w")
|
||||
f.write("""\
|
||||
set terminal pngcairo enhanced font "CMU Sans Serif,11" fontscale 1.0 size 800, 600
|
||||
set output "{plots_dir}/{object}_by_{criterion}_{side}.png"
|
||||
set output "{plots_dir}/{object}_by_{criterion}_{side}_{record}.png"
|
||||
set boxwidth 0.9 absolute
|
||||
set style fill solid 1.0 border lt -1
|
||||
set style histogram clustered gap 1 title textcolor lt -1
|
||||
set style data histograms
|
||||
set title font "CMU Sans Serif,12" "{object_title} by {criterion_title} ({side} side) ({unit})"
|
||||
set title font "CMU Sans Serif,12" "{object_title} by {criterion_title} ({record}, {side} side) ({unit})"
|
||||
#set xtics border in scale 0,0 nomirror rotate by -45 autojustify
|
||||
set xtics border in scale 0,0 nomirror autojustify
|
||||
#set key fixed right top vertical Right noreverse noenhanced autotitle nobox
|
||||
|
|
@ -77,53 +77,53 @@ set xrange [ * : * ] noreverse writeback
|
|||
set yrange [ 0 : * ]
|
||||
set grid y lt 1 lw .75 lc "gray"
|
||||
plot \
|
||||
newhistogram "", "{plots_dir}/{object}_by_{criterion}_{side}.dat" using 2:xticlabels(1) notitle col, \
|
||||
newhistogram "", "{plots_dir}/{object}_by_{criterion}_{side}.dat" using 3:xticlabels(1) title col{cluster}
|
||||
newhistogram "", "{plots_dir}/{object}_by_{criterion}_{side}_{record}.dat" using 2:xticlabels(1) notitle col, \
|
||||
newhistogram "", "{plots_dir}/{object}_by_{criterion}_{side}_{record}.dat" using 3:xticlabels(1) title col{cluster}
|
||||
""".format(plots_dir=PLOTS_DIR, cluster=cluster, **kwargs))
|
||||
f.close()
|
||||
os.system("gnuplot {plots_dir}/{object}_by_{criterion}_{side}.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_plot(records, exp, criterion, side, obj):
|
||||
f = open(f"/dev/shm/plots/{obj}_by_{criterion}_{side}.dat", "w")
|
||||
def make_plot(logs, exp, criterion, side, obj, record):
|
||||
f = open(f"/dev/shm/plots/{obj}_by_{criterion}_{side}_{record}.dat", "w")
|
||||
ciphers = {}
|
||||
impls = []
|
||||
plain_line = None
|
||||
idle_val = None
|
||||
|
||||
for record in records:
|
||||
if record["exp"] == "idle":
|
||||
idle_val = float(record[COL[obj]]) / float(record["time"])
|
||||
if record["exp"] != exp:
|
||||
for log in logs:
|
||||
if log["exp"] == "idle":
|
||||
idle_val = float(log[COL[obj]]) / float(log["time"])
|
||||
if log["exp"] != exp or log["record"] != record:
|
||||
continue
|
||||
if record["setup"] == "none":
|
||||
plain_line = "plain {}".format(float(record[COL[obj]]) - idle_val * float(record["time"]))
|
||||
if log["setup"] == "none":
|
||||
plain_line = "plain {}".format(float(log[COL[obj]]) - idle_val * float(log["time"]))
|
||||
|
||||
if plain_line == None:
|
||||
return
|
||||
|
||||
for record in records:
|
||||
if record["exp"] != exp:
|
||||
for log in logs:
|
||||
if log["exp"] != exp or log["record"] != record:
|
||||
continue
|
||||
elif record["setup"] == side:
|
||||
if record[COL[criterion]] not in ciphers:
|
||||
ciphers[record[COL[criterion]]] = {}
|
||||
ciphers[record[COL[criterion]]][record["impl"]] = float(record[COL[obj]]) - idle_val * float(record["time"])
|
||||
if record["impl"] not in impls:
|
||||
impls.append(record["impl"])
|
||||
elif log["setup"] == side:
|
||||
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"])
|
||||
if log["impl"] not in impls:
|
||||
impls.append(log["impl"])
|
||||
impls.sort()
|
||||
f.write("{} none {}\n".format(criterion, " ".join(impls)))
|
||||
f.write(plain_line+" -"*len(impls)+"\n")
|
||||
for cipher in ciphers:
|
||||
f.write("{}({}) - {}\n".format(
|
||||
ALG_LABEL[cipher],
|
||||
VER_LABEL[record["cipher"]],
|
||||
VER_LABEL[log["cipher"]],
|
||||
" ".join([
|
||||
str(ciphers[cipher][impl])
|
||||
for impl in impls
|
||||
]),
|
||||
))
|
||||
f.close()
|
||||
gnuplot_histogram(object=obj, criterion=criterion, side=side, object_title=OBJ_TITLE[obj], criterion_title=CRITERION_TITLE[criterion], unit=UNIT[obj], nb_impls=len(impls))
|
||||
gnuplot_histogram(object=obj, criterion=criterion, side=side, object_title=OBJ_TITLE[obj], criterion_title=CRITERION_TITLE[criterion], unit=UNIT[obj], nb_impls=len(impls), record=record)
|
||||
|
||||
if __name__ == "__main__":
|
||||
logfile_name = sys.argv[1]
|
||||
|
|
@ -133,20 +133,24 @@ if __name__ == "__main__":
|
|||
|
||||
colnames = lines[0].removesuffix("\n").split(" ")
|
||||
|
||||
records = []
|
||||
logs = []
|
||||
records = {}
|
||||
for line in lines[1:]:
|
||||
cols = line.removesuffix("\n").split(" ")
|
||||
record = {}
|
||||
log = {}
|
||||
for col in range(len(cols)):
|
||||
record[colnames[col]] = cols[col]
|
||||
records.append(record)
|
||||
log[colnames[col]] = cols[col]
|
||||
if log["record"] != "-":
|
||||
records[log["record"]] = ()
|
||||
logs.append(log)
|
||||
|
||||
os.makedirs("/dev/shm/plots", exist_ok=True)
|
||||
|
||||
for side in ["client", "server"]:
|
||||
make_plot(records, "impl-cipher-ver", "cipher", side, "cpu")
|
||||
make_plot(records, "impl-cipher-ver", "cipher", side, "energy")
|
||||
make_plot(records, "impl-cert-ver", "cert", side, "cpu")
|
||||
make_plot(records, "impl-cert-ver", "cert", side, "energy")
|
||||
make_plot(records, "impl-kex-ver", "kex", side, "cpu")
|
||||
make_plot(records, "impl-kex-ver", "kex", side, "energy")
|
||||
for record in records:
|
||||
make_plot(logs, "impl-cipher-ver", "cipher", side, "cpu", record)
|
||||
make_plot(logs, "impl-cipher-ver", "cipher", side, "energy", record)
|
||||
make_plot(logs, "impl-cert-ver", "cert", side, "cpu", record)
|
||||
make_plot(logs, "impl-cert-ver", "cert", side, "energy", record)
|
||||
make_plot(logs, "impl-kex-ver", "kex", side, "cpu", record)
|
||||
make_plot(logs, "impl-kex-ver", "kex", side, "energy", record)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue