Graviola, fix RAPL, shutdown
This commit is contained in:
parent
b3f7476b82
commit
ac56eb5b82
3 changed files with 55 additions and 24 deletions
|
|
@ -356,6 +356,7 @@ python plots.py prof <path/to/log>
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
gcc -O3 powercap.c -o powercap
|
gcc -O3 powercap.c -o powercap
|
||||||
|
sudo chown root powercap
|
||||||
sudo chmod u+s powercap
|
sudo chmod u+s powercap
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
72
exp.py
72
exp.py
|
|
@ -184,8 +184,8 @@ CONFIGS = {
|
||||||
"i5": {
|
"i5": {
|
||||||
"experiments": [
|
"experiments": [
|
||||||
"impl-cipher-ver",
|
"impl-cipher-ver",
|
||||||
"impl-cert-ver",
|
#"impl-cert-ver",
|
||||||
"impl-kex-ver",
|
#"impl-kex-ver",
|
||||||
],
|
],
|
||||||
"setups": [
|
"setups": [
|
||||||
"none",
|
"none",
|
||||||
|
|
@ -193,7 +193,7 @@ CONFIGS = {
|
||||||
"server",
|
"server",
|
||||||
],
|
],
|
||||||
"records": [
|
"records": [
|
||||||
{ "filename": "wikipedia", "repeat": 100 },
|
{ "filename": "wikipedia", "repeat": 500 },
|
||||||
],
|
],
|
||||||
"repodir": "/home/tuxmain/reps/tlsbench",
|
"repodir": "/home/tuxmain/reps/tlsbench",
|
||||||
"expdir": "/dev/shm/exp",
|
"expdir": "/dev/shm/exp",
|
||||||
|
|
@ -209,7 +209,7 @@ CONFIGS = {
|
||||||
"p3_suffix": "",
|
"p3_suffix": "",
|
||||||
"p3_port_plain": 80,
|
"p3_port_plain": 80,
|
||||||
"p3_port_tls": 443,
|
"p3_port_tls": 443,
|
||||||
"idle": "idle - - - - - - - 600.0001013278961 0.0 735 4942 1.7759999999999962 0 -",
|
"idle": "idle - - - - - - - 600.000194311142 0.0 1822 6541 1.3880000000000052 304283035 -",
|
||||||
},
|
},
|
||||||
"i5-local": {
|
"i5-local": {
|
||||||
"experiments": [
|
"experiments": [
|
||||||
|
|
@ -223,7 +223,7 @@ CONFIGS = {
|
||||||
"server-local",
|
"server-local",
|
||||||
],
|
],
|
||||||
"records": [
|
"records": [
|
||||||
{ "filename": "wikipedia", "repeat": 10 },
|
{ "filename": "wikipedia", "repeat": 100 },
|
||||||
],
|
],
|
||||||
"repodir": "/home/exp/exp",
|
"repodir": "/home/exp/exp",
|
||||||
"expdir": "/dev/shm/exp",
|
"expdir": "/dev/shm/exp",
|
||||||
|
|
@ -301,11 +301,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
|
||||||
|
|
@ -421,6 +421,10 @@ def alg_filter(kex, cert, cipher, impl):
|
||||||
return False
|
return False
|
||||||
if cert == "secp384r1" and impl == "boring":
|
if cert == "secp384r1" and impl == "boring":
|
||||||
return False
|
return False
|
||||||
|
if kex == "SECP256R1MLKEM768" and impl == "graviola":
|
||||||
|
return False
|
||||||
|
if kex == "MLKEM768" and impl == "graviola":
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
DOMAINS = []
|
DOMAINS = []
|
||||||
|
|
@ -688,7 +692,7 @@ def run_netreplay(expdir, repodir, record, p2_addr, p2_port, listen_port, tls_mo
|
||||||
if expdir[-1] != "/":
|
if expdir[-1] != "/":
|
||||||
expdir += "/"
|
expdir += "/"
|
||||||
repodir = repodir.removesuffix("/")
|
repodir = repodir.removesuffix("/")
|
||||||
env = {"RUST_LOG": "warning", "EARLYDATA": earlydata}
|
env = {"RUST_LOG": "warning", "SSLKEYLOGFILE": "/dev/shm/netreplay.keys.txt", "EARLYDATA": earlydata}
|
||||||
if ciphers:
|
if ciphers:
|
||||||
env["CIPHERS"] = ciphers
|
env["CIPHERS"] = ciphers
|
||||||
if kexes:
|
if kexes:
|
||||||
|
|
@ -741,8 +745,8 @@ def get_net_stat(ssh):
|
||||||
bytes_out = int(items[8])
|
bytes_out = int(items[8])
|
||||||
return (bytes_in, bytes_out)
|
return (bytes_in, bytes_out)
|
||||||
|
|
||||||
def get_rapl_energy(ssh, expdir):
|
def get_rapl_energy(ssh, repodir):
|
||||||
res = ssh_run(ssh, expdir+"/powercap", hide=True)
|
res = ssh_run(ssh, repodir+"/powercap", hide=True)
|
||||||
items = res.split("\n")
|
items = res.split("\n")
|
||||||
energy = 0
|
energy = 0
|
||||||
for item in items:
|
for item in items:
|
||||||
|
|
@ -750,7 +754,7 @@ def get_rapl_energy(ssh, expdir):
|
||||||
energy += int(item)
|
energy += int(item)
|
||||||
return energy
|
return energy
|
||||||
|
|
||||||
def run_exp(config, only_record=None, idle=False):
|
def run_exp(config, only_record=None, idle=False, shutdown=False):
|
||||||
ssh = None
|
ssh = None
|
||||||
if "p2_ssh" in config:
|
if "p2_ssh" in config:
|
||||||
ssh = connect_ssh(config)
|
ssh = connect_ssh(config)
|
||||||
|
|
@ -794,11 +798,11 @@ def run_exp(config, only_record=None, idle=False):
|
||||||
rpxy_cpu = get_cpu_stat(ssh)
|
rpxy_cpu = get_cpu_stat(ssh)
|
||||||
p2_bytes_in, p2_bytes_out = get_net_stat(ssh)
|
p2_bytes_in, p2_bytes_out = get_net_stat(ssh)
|
||||||
energy = 0
|
energy = 0
|
||||||
energy_rapl
|
energy_rapl = 0
|
||||||
if config["wattmeter"]:
|
if config["wattmeter"]:
|
||||||
energy = wattmeter.get_meter()
|
energy = wattmeter.get_meter()
|
||||||
if config["rapl"]:
|
if config["rapl"]:
|
||||||
energy_rapl = get_rapl_energy(ssh)
|
energy_rapl = get_rapl_energy(ssh, p2_path)
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
time.sleep(600)
|
time.sleep(600)
|
||||||
|
|
@ -809,7 +813,7 @@ def run_exp(config, only_record=None, idle=False):
|
||||||
if config["wattmeter"]:
|
if config["wattmeter"]:
|
||||||
new_energy = wattmeter.get_meter()
|
new_energy = wattmeter.get_meter()
|
||||||
if config["rapl"]:
|
if config["rapl"]:
|
||||||
new_energy_rapl = get_rapl_energy(ssh)
|
new_energy_rapl = get_rapl_energy(ssh, p2_path)
|
||||||
new_p2_bytes_in, new_p2_bytes_out = get_net_stat(ssh)
|
new_p2_bytes_in, new_p2_bytes_out = get_net_stat(ssh)
|
||||||
new_rpxy_cpu = get_cpu_stat(ssh)
|
new_rpxy_cpu = get_cpu_stat(ssh)
|
||||||
rpxy_cpu_diff = new_rpxy_cpu - rpxy_cpu
|
rpxy_cpu_diff = new_rpxy_cpu - rpxy_cpu
|
||||||
|
|
@ -880,7 +884,7 @@ def run_exp(config, only_record=None, idle=False):
|
||||||
if config["wattmeter"]:
|
if config["wattmeter"]:
|
||||||
energy = wattmeter.get_meter()
|
energy = wattmeter.get_meter()
|
||||||
if config["rapl"]:
|
if config["rapl"]:
|
||||||
energy_rapl = get_rapl_energy(ssh)
|
energy_rapl = get_rapl_energy(ssh, p2_path)
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
netreplay = run_netreplay(
|
netreplay = run_netreplay(
|
||||||
|
|
@ -915,7 +919,7 @@ def run_exp(config, only_record=None, idle=False):
|
||||||
#time.sleep(30)
|
#time.sleep(30)
|
||||||
#sh("killall netreplay")
|
#sh("killall netreplay")
|
||||||
try:
|
try:
|
||||||
#ssh_run(ssh, f"rm /dev/shm/access.log /dev/shm/rpxy.log")
|
ssh_run(ssh, f"rm /dev/shm/access.log /dev/shm/rpxy.log")
|
||||||
pass
|
pass
|
||||||
except invoke.exceptions.UnexpectedExit as e:
|
except invoke.exceptions.UnexpectedExit as e:
|
||||||
pass
|
pass
|
||||||
|
|
@ -934,7 +938,7 @@ def run_exp(config, only_record=None, idle=False):
|
||||||
if config["wattmeter"]:
|
if config["wattmeter"]:
|
||||||
new_energy = wattmeter.get_meter()
|
new_energy = wattmeter.get_meter()
|
||||||
if config["rapl"]:
|
if config["rapl"]:
|
||||||
new_energy_rapl = get_rapl_energy(ssh)
|
new_energy_rapl = get_rapl_energy(ssh, p2_path)
|
||||||
new_p2_bytes_in, new_p2_bytes_out = get_net_stat(ssh)
|
new_p2_bytes_in, new_p2_bytes_out = get_net_stat(ssh)
|
||||||
new_rpxy_cpu = get_cpu_stat(ssh)
|
new_rpxy_cpu = get_cpu_stat(ssh)
|
||||||
record_filename = record["filename"]
|
record_filename = record["filename"]
|
||||||
|
|
@ -957,6 +961,8 @@ def run_exp(config, only_record=None, idle=False):
|
||||||
first_set = False
|
first_set = False
|
||||||
if config["wattmeter"]:
|
if config["wattmeter"]:
|
||||||
YAPI.FreeAPI()
|
YAPI.FreeAPI()
|
||||||
|
if shutdown and ssh:
|
||||||
|
ssh_run(ssh, f"python3 {p2_path}/exp.py --shutdown")
|
||||||
|
|
||||||
def update_certs(config):
|
def update_certs(config):
|
||||||
info = platform.freedesktop_os_release()
|
info = platform.freedesktop_os_release()
|
||||||
|
|
@ -1007,6 +1013,7 @@ if __name__ == "__main__":
|
||||||
send <config> Send configs and certs to p2
|
send <config> Send configs and certs to p2
|
||||||
update-certs <config> Update system's certs
|
update-certs <config> Update system's certs
|
||||||
run <config> Run experiment
|
run <config> Run experiment
|
||||||
|
shutdown Shutdown the system
|
||||||
|
|
||||||
Make options:
|
Make options:
|
||||||
-c Make CA cert (otherwise use already existing one)
|
-c Make CA cert (otherwise use already existing one)
|
||||||
|
|
@ -1024,6 +1031,7 @@ Run options:
|
||||||
--count Do not run experiments but display number of experiments
|
--count Do not run experiments but display number of experiments
|
||||||
--record <id> Only play this record
|
--record <id> Only play this record
|
||||||
--idle Also measure when idle
|
--idle Also measure when idle
|
||||||
|
--shutdown Shutdown host and target when finished
|
||||||
""".format(
|
""".format(
|
||||||
sig_algs = " ".join(CERT_SIGN_ALGS),
|
sig_algs = " ".join(CERT_SIGN_ALGS),
|
||||||
configs = " ".join([i for i in CONFIGS]),
|
configs = " ".join([i for i in CONFIGS]),
|
||||||
|
|
@ -1073,7 +1081,29 @@ Run options:
|
||||||
from yoctopuce.yocto_api import *
|
from yoctopuce.yocto_api import *
|
||||||
from yoctopuce.yocto_power import *
|
from yoctopuce.yocto_power import *
|
||||||
|
|
||||||
run_exp(config, only_record=getargv("--record", None), idle="--idle" in sys.argv)
|
bus = None
|
||||||
|
bus_proxy = None
|
||||||
|
shutdown = "--shutdown" in sys.argv
|
||||||
|
if shutdown:
|
||||||
|
from pydbus import SystemBus
|
||||||
|
bus = SystemBus()
|
||||||
|
bus_proxy = bus.get('org.freedesktop.login1', '/org/freedesktop/login1')
|
||||||
|
if bus_proxy.CanPowerOff() != 'yes':
|
||||||
|
print("Cannot power off")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
run_exp(config, only_record=getargv("--record", None), idle="--idle" in sys.argv, shutdown=shutdown)
|
||||||
|
|
||||||
|
if shutdown:
|
||||||
|
bus_proxy.PowerOff(False)
|
||||||
|
elif opt == "shutdown":
|
||||||
|
from pydbus import SystemBus
|
||||||
|
bus = SystemBus()
|
||||||
|
bus_proxy = bus.get('org.freedesktop.login1', '/org/freedesktop/login1')
|
||||||
|
if bus_proxy.CanPowerOff() != 'yes':
|
||||||
|
print("Cannot power off")
|
||||||
|
exit(1)
|
||||||
|
bus_proxy.PowerOff(False)
|
||||||
else:
|
else:
|
||||||
print("Unknown command, use help for help")
|
print("Unknown command, use help for help")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ void read_energy(char *path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
read_energy("/sys/class/powercap/intel-rapl/subsystem/intel-rapl:0:0/energy_uj");
|
read_energy("/sys/class/powercap/intel-rapl:0:0/energy_uj");
|
||||||
read_energy("/sys/class/powercap/intel-rapl/subsystem/intel-rapl:0:1/energy_uj");
|
read_energy("/sys/class/powercap/intel-rapl:0:1/energy_uj");
|
||||||
read_energy("/sys/class/powercap/intel-rapl/subsystem/intel-rapl:0:2/energy_uj");
|
read_energy("/sys/class/powercap/intel-rapl:0:2/energy_uj");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue