Scheduler
schedulability.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import os
4 import re
5 import sys
6 
8  configFilename = ""
9  if (len(sys.argv) < 2):
10  configFilename = "configuration.conf"
11  else:
12  configFilename = sys.argv[1]
13 
14  configPath = "configuration/" + configFilename
15 
16  #let's get the running time:
17  with open(configPath) as f:
18  for line in f:
19  entrymatch = re.match(r'^runningTime *= *([0-9]+)', line) #TODO we should also check that we are in section [scheduler]...
20  if entrymatch:
21  runningTime = float(entrymatch.group(1))
22 
23  reportsFolder = "scratch"
24 
25  missFilename = reportsFolder + "/" + configFilename + "deadlineMissesReport.txt"
26 
27  with open(missFilename) as f:
28  f.readline() #discard first line
29  entries = [[float(elem) for elem in line.split(":")] for line in f]
30  if len(entries) == 0:
31  return 1
32  else:
33  if entries[len(entries)-1][0] < runningTime*0.9:
34  return 1
35  else:
36  return 0
37 
38 
39 if __name__ == '__main__':
41 
42 
43 
44 
45 
46 
47 
def schedulability()