From 8da09ab18819d80c5eda206fde04454e4fccbf1a Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Sun, 25 Oct 2020 18:49:00 -0400 Subject: Don't exit the case study script until confirmed --- run_case_study.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'run_case_study.py') diff --git a/run_case_study.py b/run_case_study.py index eff06fe..b06697f 100755 --- a/run_case_study.py +++ b/run_case_study.py @@ -179,19 +179,19 @@ def main(pathName): binary = "./dis/" + name1 else: print("Invalid suite name " + suite1 + " in Level-A/-B tasks! Exiting...") - exit(1) + return 1 lookupID = name1 + task1 if ID2PID(lookupID): print("ERROR: Task ID {} is already running! Did you end the previous case study?".format(lookupID)) - exit(1) + return 1 # Arg format: arg = " " + lookupID + " -1 " + core + " NULL 0 " + period1 + " " + criticality bench_tsk = subprocess.Popen(input_cmd[name1] + " | numactl --interleave=all " + binary + arg, shell = True) pid_str = ID2PID(lookupID) if not pid_str: print("Unable to launch {} as a solo task! Exiting...".format(name1)) - exit(1) + return 1 # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms) run("echo " + pid_str + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") addpid(pid_str) @@ -207,7 +207,7 @@ def main(pathName): binary2 = "./dis/" + name2 + "_all" else: print("Invalid suite name " + suite1 + " in Level-A/-B tasks! Exiting...") - exit(1) + return 1 pairID += 1 # Used for sem/shm identification in the pair task thread = str(int(core) + 16) # How Linux numbers SMT threads on the 3950X @@ -215,7 +215,7 @@ def main(pathName): lookupID2 = name2 + str(task2) if ID2PID(lookupID1) or ID2PID(lookupID2): print("ERROR: Part of the pair containing task IDs {} and {} is already running! Did you end the previous case study?".format(lookupID1, lookupID2)) - exit(1) + return 1 # Arg format: <0 other core> arg1 = " " + lookupID1 + " -1 " + core + " 0 NULL NULL 0 " + str(pairID) + " " + period1 + " " + criticality arg2 = " " + lookupID2 + " -1 " + thread + " 0 NULL NULL 0 " + str(pairID) + " " + period2 + " " + criticality @@ -226,7 +226,7 @@ def main(pathName): pid2_str = ID2PID(lookupID2) if not pid1_str or not pid2_str: print("Unable to launch {} and {} in a pair! Exiting...".format(name1, name2)) - exit(1) + return 1 # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms) run("echo " + pid1_str + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") run("echo " + pid2_str + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") @@ -254,14 +254,14 @@ def main(pathName): binary = "./dis/" + name else: print("Invalid suite name " + suite + " in Level-A/-B tasks! Exiting...") - exit(1) + return 1 # XXX XXX XXX: FIXME when LITMUS is fixed core = str(int(ccx)*4 + 1); lookupID = name + str(tid) if ID2PID(lookupID): print("ERROR: Task ID {} is already running! Did you end the previous case study?".format(lookupID)) - exit(1) + return 1 # Arg format: arg = " " + lookupID + " -1 " + core + " NULL 0 " + period + " " + str(CRIT_LEVEL_C) bench_tsk = subprocess.Popen(input_cmd[name] + " | numactl --interleave=all " + binary + arg, shell=True) @@ -269,7 +269,7 @@ def main(pathName): pid_str = ID2PID(lookupID) if not pid_str: print("Unable to launch {} as a Level-C thread! Exiting...".format(name)) - exit(1) + return 1 # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms) run("echo " + pid_str + " > /sys/fs/resctrl/level-c-ccx-" + ccx + "/tasks") addpid(pid_str) @@ -285,6 +285,8 @@ if __name__ == "__main__": print("You must run this script as root to enable cache isolation and access LITMUS-RT.") exit(1) pathName = sys.argv[1] - main(pathName) + err = main(pathName) + input("Done. Waiting for termination signal...") + exit(err) -- cgit v1.2.2