diff options
author | leochanj105 <leochanj@live.unc.edu> | 2020-10-24 02:47:38 -0400 |
---|---|---|
committer | leochanj105 <leochanj@live.unc.edu> | 2020-10-24 02:47:38 -0400 |
commit | 450ce6915597da9f06442be6cc3235b53f30d59c (patch) | |
tree | fcf5601c8d1a2fced18e5da92927a23952b96101 /run_case_study.py | |
parent | 063497e1c39be585914dc2e69445313632530de6 (diff) | |
parent | e0c5691110f38f63d1955a711fc7f786333bcaad (diff) |
wip
Diffstat (limited to 'run_case_study.py')
-rw-r--r-- | run_case_study.py | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/run_case_study.py b/run_case_study.py index 9d07198..7da8f4e 100644 --- a/run_case_study.py +++ b/run_case_study.py | |||
@@ -2,12 +2,22 @@ import os | |||
2 | import sys | 2 | import sys |
3 | import re | 3 | import re |
4 | import csv | 4 | import csv |
5 | import time | ||
5 | import subprocess | 6 | import subprocess |
7 | |||
8 | all_pids=[] | ||
6 | def run(command): | 9 | def run(command): |
7 | print(command) | 10 | print(command) |
8 | #os.system(command) | 11 | os.system(command) |
12 | def addpid(pid): | ||
13 | with open("./pids.txt", "a") as f: | ||
14 | f.write(str(pid) + "\n") | ||
15 | |||
9 | 16 | ||
10 | def main(): | 17 | def main(): |
18 | with open("./pids.txt", "w") as f: | ||
19 | f.write("") | ||
20 | |||
11 | pathName = sys.argv[1] | 21 | pathName = sys.argv[1] |
12 | tacle_pairs_path = "./all_pairs" | 22 | tacle_pairs_path = "./all_pairs" |
13 | tacle_baseline_path = "./baseline" | 23 | tacle_baseline_path = "./baseline" |
@@ -91,9 +101,6 @@ def main(): | |||
91 | pairID = 0 | 101 | pairID = 0 |
92 | i = 0 | 102 | i = 0 |
93 | for task in levelAB: | 103 | for task in levelAB: |
94 | i+=1 | ||
95 | if(i>1): | ||
96 | break; | ||
97 | task1 = int(task[2]) | 104 | task1 = int(task[2]) |
98 | task2 = int(task[5]) | 105 | task2 = int(task[5]) |
99 | name1 = all_tasks[task1][2] | 106 | name1 = all_tasks[task1][2] |
@@ -120,11 +127,11 @@ def main(): | |||
120 | binary = "./baseline/bin/" + name1 + arg | 127 | binary = "./baseline/bin/" + name1 + arg |
121 | else: | 128 | else: |
122 | binary = dis_inputs[name1] + " | ./dis/" + name1 + arg | 129 | binary = dis_inputs[name1] + " | ./dis/" + name1 + arg |
123 | #proc = subprocess.open([binary + " &"], shell = True) | 130 | proc = subprocess.Popen([binary], shell = True) |
124 | print(binary + " &" ) | 131 | #print(binary + " &" ) |
125 | pid = 0#proc.pid | 132 | pid = proc.pid |
126 | run("sudo echo " + pid + " > sudo /sys/fs/resctrl/level-ab-core-" + core + "/tasks") | 133 | run("sudo echo " + str(pid) + " > sudo /sys/fs/resctrl/level-ab-core-" + core + "/tasks") |
127 | 134 | addpid(pid) | |
128 | else: | 135 | else: |
129 | pairID += 1 | 136 | pairID += 1 |
130 | arg1 = " NULL -1 " + core + " 0 NULL NULL 0 " + str(pairID) + " " + period1 + " " + criticality | 137 | arg1 = " NULL -1 " + core + " 0 NULL NULL 0 " + str(pairID) + " " + period1 + " " + criticality |
@@ -136,18 +143,20 @@ def main(): | |||
136 | else: | 143 | else: |
137 | binary1 = dis_inputs[name1] + " | ./dis/" + name1 + "_all" + arg1 | 144 | binary1 = dis_inputs[name1] + " | ./dis/" + name1 + "_all" + arg1 |
138 | binary2 = dis_inputs[name2] + " | ./dis/" + name2 + "_all" + arg2 | 145 | binary2 = dis_inputs[name2] + " | ./dis/" + name2 + "_all" + arg2 |
139 | #proc1 = subprocess.Popen(["sudo numactl --membind=0 " + binary1 + " &"], shell = True) | 146 | proc1 = subprocess.Popen(["sudo numactl --membind=0 " + binary1], shell = True) |
140 | #proc2 = subprocess.Popen(["sudo numactl --membind=1 " + binary2 + " &"], shell = True) | 147 | proc2 = subprocess.Popen(["sudo numactl --membind=1 " + binary2], shell = True) |
141 | print("sudo numactl --membind=0 " + binary1 + " &") | 148 | #print("sudo numactl --membind=0 " + binary1 + " &") |
142 | print("sudo numactl --membind=1 " + binary2 + " &") | 149 | #print("sudo numactl --membind=1 " + binary2 + " &") |
143 | pid1 = 0#proc1.pid | 150 | pid1 = proc2.pid + 1 |
144 | pid2 = 0#proc2.pid | 151 | pid2 = proc2.pid + 3 |
145 | 152 | ||
146 | run("sudo echo " + str(pid1) + " > sudo /sys/fs/resctrl/level-ab-core-" + core + "/tasks") | 153 | run("sudo echo " + str(pid1) + " > sudo /sys/fs/resctrl/level-ab-core-" + core + "/tasks") |
147 | run("sudo echo " + str(pid2) + " > sudo /sys/fs/resctrl/level-ab-core-" + core + "/tasks") | 154 | run("sudo echo " + str(pid2) + " > sudo /sys/fs/resctrl/level-ab-core-" + core + "/tasks") |
148 | exit(1) | 155 | addpid(pid1) |
156 | addpid(pid2) | ||
149 | 157 | ||
150 | for task in levelC: | 158 | for task in levelC: |
159 | continue | ||
151 | i+=1 | 160 | i+=1 |
152 | if(i>8): | 161 | if(i>8): |
153 | break | 162 | break |
@@ -177,5 +186,8 @@ def main(): | |||
177 | run("sudo echo " + str(pid) + " > sudo /sys/fs/resctrl/level-ab-ccx-" + ccx + "/tasks") | 186 | run("sudo echo " + str(pid) + " > sudo /sys/fs/resctrl/level-ab-ccx-" + ccx + "/tasks") |
178 | #os.system("/playpen/mc2/liblitmus/release_ts") | 187 | #os.system("/playpen/mc2/liblitmus/release_ts") |
179 | #os.system("ls") | 188 | #os.system("ls") |
189 | time.sleep(3) | ||
180 | if __name__ == "__main__": | 190 | if __name__ == "__main__": |
181 | main() | 191 | main() |
192 | |||
193 | |||