-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheval.py
42 lines (36 loc) · 1.12 KB
/
eval.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
import pathlib
import statistics
import subprocess
import psutil
from src.consts import CFLAGS as CFLAGS
from utils.utils import extract_mul_nums
FILEPATH = pathlib.Path(__file__).resolve().parent
BASE_PATH = os.path.join(FILEPATH)
BENCHMARK_FREQ = 5
def eval_single_proc(eval):
pid = os.getpid()
core = psutil.Process(pid).cpu_num()
with open(os.path.join(BASE_PATH, "results", "res.csv"), "w") as f:
f.write("Filename,SABLE(ns)\n")
for fname in eval:
output = subprocess.check_output(["taskset", "-a", "-c", str(core), f"{BASE_PATH}/split-and-binaries/{fname}/{fname}"]).decode("utf-8").split("\n")[0]
output = extract_mul_nums(output)
median_exec_time_unroll = statistics.median([float(x) for x in output])
f.write(f"{fname},{median_exec_time_unroll}\n")
f.flush()
print(f"Done {fname}")
if __name__ == "__main__":
eval = [
# "std1_Jac3",
# "ts-palko",
# "dbir2",
# "Zd_Jac2",
# "dbir1",
# "msc23052",
# "heart1",
# "nemsemm1",
# "bcsstk36",
"karted"
]
eval_single_proc(eval)