diff options
Diffstat (limited to 'run_case_study.py')
| -rw-r--r-- | run_case_study.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/run_case_study.py b/run_case_study.py new file mode 100644 index 0000000..d715644 --- /dev/null +++ b/run_case_study.py | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | import os | ||
| 2 | import sys | ||
| 3 | import re | ||
| 4 | import csv | ||
| 5 | def main(): | ||
| 6 | pathName = sys.argv[1] | ||
| 7 | all_tasks = [] | ||
| 8 | levelAB = [] | ||
| 9 | levelC = [] | ||
| 10 | with open(pathName+"/all_tasks.csv", "r") as csv_file: | ||
| 11 | csv_reader = csv.reader(csv_file, delimiter = ',') | ||
| 12 | line = 0 | ||
| 13 | for row in csv_reader: | ||
| 14 | if line > 0: | ||
| 15 | all_tasks.append(row) | ||
| 16 | line += 1 | ||
| 17 | with open(pathName+"/levelAB_pairs.csv", "r") as csv_file: | ||
| 18 | csv_reader = csv.reader(csv_file, delimiter = ',') | ||
| 19 | line = 0 | ||
| 20 | for row in csv_reader: | ||
| 21 | if line > 0: | ||
| 22 | levelAB.append(row) | ||
| 23 | line += 1 | ||
| 24 | with open(pathName+"/levelC_threads.csv", "r") as csv_file: | ||
| 25 | csv_reader = csv.reader(csv_file, delimiter = ',') | ||
| 26 | line = 0 | ||
| 27 | for row in csv_reader: | ||
| 28 | if line > 0: | ||
| 29 | levelC.append(row) | ||
| 30 | line += 1 | ||
| 31 | #os.system('echo "L3:0=L3:0=0000,1=0000,2=0000,3=0000" > /sys/fs/resctrl/schemata') | ||
| 32 | |||
| 33 | with open(pathName+"/l3alloc.csv", "r") as csv_file: | ||
| 34 | csv_reader = csv.reader(csv_file, delimiter = ',') | ||
| 35 | line = 0 | ||
| 36 | ccx = 0 | ||
| 37 | for row in csv_reader: | ||
| 38 | if line > 0: | ||
| 39 | core = int(row[0]) | ||
| 40 | way_AB = int(row[1]) | ||
| 41 | way_C = int(row[3]) | ||
| 42 | # Level C allocation | ||
| 43 | if(core == 1): | ||
| 44 | os.system("mkdir /sys/fs/resctrl/level-c-ccx-0") | ||
| 45 | os.system('echo "L3:0=' + ("%0.4x" % (int("1"*way_C, 2))) + ',1=0000,2=0000,3=0000" > /sys/fs/resctrl/level-c-ccx-0/schemata') | ||
| 46 | |||
| 47 | if(core == 4): | ||
| 48 | os.system("mkdir /sys/fs/resctrl/level-c-ccx-1") | ||
| 49 | os.system('echo "L3:0=0000, 1=' + ("%0.4x" % (int("1"*way_C, 2))) + ',2=0000,3=0000" > /sys/fs/resctrl/level-c-ccx-0/schemata') | ||
| 50 | os.system('mkdir /sys/fs/resctrl/level-ab-core-' + core) | ||
| 51 | if(core < 4): | ||
| 52 | os.system('echo "L3:0=' + ("%0.4x" % (int("1"*way_C + "0"*(16-way_AB), 2))) + ',1=0000,2=0000,3=0000" > /sys/fs/resctrl/level-ab-core-' + core + '/schemata') | ||
| 53 | else: | ||
| 54 | os.system('echo "L3:0=0000,1=' + ("%0.4x" % (int("1"*way_C + "0"*(16-way_AB), 2))) + ',2=0000,3=0000" > /sys/fs/resctrl/level-ab-core-' + core + '/schemata') | ||
| 55 | for task in levelAB: | ||
| 56 | |||
| 57 | #os.system("ls") | ||
| 58 | if __name__ == "__main__": | ||
| 59 | main() | ||
