From 05eb6f20c004c2734975871ce2d1711990155738 Mon Sep 17 00:00:00 2001 From: xiaosuGW Date: Wed, 11 Aug 2021 14:52:22 -0500 Subject: [PATCH] upload script meet_deadline_percentage.py --- runtime/tests/meet_deadline_percentage.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 runtime/tests/meet_deadline_percentage.py diff --git a/runtime/tests/meet_deadline_percentage.py b/runtime/tests/meet_deadline_percentage.py new file mode 100644 index 0000000..d2572ce --- /dev/null +++ b/runtime/tests/meet_deadline_percentage.py @@ -0,0 +1,22 @@ +import sys +def count_miss_or_meet_deadline_requests(file_dir): + meet_deadline = 0 + miss_deadline = 0 + fo = open(file_dir, "r+") + for line in fo: + line = line.strip() + if "meet deadline" in line: + meet_deadline += 1 + if "miss deadline" in line: + miss_deadline += 1 + miss_deadline_percentage = (miss_deadline * 100) / (miss_deadline + meet_deadline) + print("meet deadline num:", meet_deadline) + print("miss deadline num:", miss_deadline) + print("miss deadline percentage:", miss_deadline_percentage) + +if __name__ == "__main__": + argv = sys.argv[1:] + if len(argv) < 1: + print("usage ", sys.argv[0], " file dir") + sys.exit() + count_miss_or_meet_deadline_requests(argv[0])