update meet_deadline_percentage.py to counter requests number for each function

main
xiaosuGW 3 years ago
parent 3327af8aaa
commit 7a2d45ddbf

@ -1,5 +1,11 @@
import sys import sys
from collections import defaultdict
def def_value():
return 0
def count_miss_or_meet_deadline_requests(file_dir): def count_miss_or_meet_deadline_requests(file_dir):
request_counter = defaultdict(def_value)
meet_deadline = 0 meet_deadline = 0
miss_deadline = 0 miss_deadline = 0
max_sc = 0 max_sc = 0
@ -8,8 +14,13 @@ def count_miss_or_meet_deadline_requests(file_dir):
line = line.strip() line = line.strip()
if "meet deadline" in line: if "meet deadline" in line:
meet_deadline += 1 meet_deadline += 1
name = line.split(" ")[5]
request_counter[name] += 1
if "miss deadline" in line: if "miss deadline" in line:
miss_deadline += 1 miss_deadline += 1
name = line.split(" ")[11]
request_counter[name] += 1
#print("name:", name)
if "scheduling count" in line: if "scheduling count" in line:
s_c = int(line.split(" ")[3]) s_c = int(line.split(" ")[3])
if max_sc < s_c: if max_sc < s_c:
@ -21,6 +32,8 @@ def count_miss_or_meet_deadline_requests(file_dir):
print("miss deadline percentage:", miss_deadline_percentage) print("miss deadline percentage:", miss_deadline_percentage)
print("scheduling counter:", max_sc) print("scheduling counter:", max_sc)
for key,value in request_counter.items():
print(key + ":" + str(value))
if __name__ == "__main__": if __name__ == "__main__":
argv = sys.argv[1:] argv = sys.argv[1:]
if len(argv) < 1: if len(argv) < 1:

Loading…
Cancel
Save