summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMac Mollison <mollison@cs.unc.edu>2009-03-01 00:26:59 -0500
committerMac Mollison <mollison@cs.unc.edu>2009-03-01 00:26:59 -0500
commit6d9ceacb59e1a3dec05b964d6df5974eef5b31c0 (patch)
tree23f08e67319b1d48d99793c57594be56e585a188
parenta67ab292bd7b58b6bebca2c1d4d9105b47b7420c (diff)
Minor changes to EDF output
-rwxr-xr-xrun.py27
-rwxr-xr-xsta.py36
2 files changed, 29 insertions, 34 deletions
diff --git a/run.py b/run.py
index 5fcdb83..1ebaa0e 100755
--- a/run.py
+++ b/run.py
@@ -20,7 +20,8 @@ def oneCPU():
20 trace.print_records() 20 trace.print_records()
21 21
22def myEDF(): 22def myEDF():
23 test = sta.EDF(g6_list,0) 23 test = sta.EDF(g6_list,20000000)
24 #test = sta.EDF(g6_list)
24 test.run_test() 25 test.run_test()
25 26
26def myTrace(): 27def myTrace():
@@ -59,36 +60,24 @@ def sampleTrace():
59 60
60path = '/home/mollison/sta/traces/' 61path = '/home/mollison/sta/traces/'
61 62
62full_list = [
63path + 'st-g6-0.bin',
64path + 'st-g6-1.bin',
65path + 'st-g6-2.bin',
66path + 'st-g6-3.bin',
67path + 'st-x19-0.bin',
68path + 'st-x19-1.bin',
69path + 'st-x19-2.bin',
70path + 'st-x19-3.bin',
71path + 'st0.fg',
72path + 'st1.fg']
73
74short_list = [
75path + 'st-x19-2.bin']
76
77g6_list = [ 63g6_list = [
78path + 'st-g6-0.bin', 64path + 'st-g6-0.bin',
79path + 'st-g6-1.bin', 65path + 'st-g6-1.bin',
80path + 'st-g6-2.bin', 66path + 'st-g6-2.bin',
81path + 'st-g6-3.bin'] 67path + 'st-g6-3.bin']
82 68
69g5_list = [
70path + 'st-g5-0.bin',
71path + 'st-g5-1.bin',
72path + 'st-g5-2.bin',
73path + 'st-g5-3.bin']
74
83x19_list = [ 75x19_list = [
84path + 'st-x19-0.bin', 76path + 'st-x19-0.bin',
85path + 'st-x19-1.bin', 77path + 'st-x19-1.bin',
86path + 'st-x19-2.bin', 78path + 'st-x19-2.bin',
87path + 'st-x19-3.bin'] 79path + 'st-x19-3.bin']
88 80
89simple_list = [
90path + 'st0.fg',
91path + 'st1.fg']
92 81
93 82
94############## 83##############
diff --git a/sta.py b/sta.py
index f3d5408..8332c1e 100755
--- a/sta.py
+++ b/sta.py
@@ -157,7 +157,7 @@ class EDF:
157 if record['type'] == 3: 157 if record['type'] == 3:
158 if not self.check_duplicate_release(record): 158 if not self.check_duplicate_release(record):
159 self.runnables.append(record) 159 self.runnables.append(record)
160 debug("{0} became runnable" 160 print("{0} became runnable"
161 .format(Trace.getStr(record))) 161 .format(Trace.getStr(record)))
162 162
163 #Switch Tos 163 #Switch Tos
@@ -166,18 +166,20 @@ class EDF:
166 self.runnings.append(release_record) 166 self.runnings.append(release_record)
167 check_tuple = self.check_deadline(release_record) 167 check_tuple = self.check_deadline(release_record)
168 if check_tuple[0] == True: 168 if check_tuple[0] == True:
169 debug("{0} became running (VALID)" 169 print("{0} became running (VALID)"
170 .format(Trace.getStr(release_record))) 170 .format(Trace.getStr(release_record)))
171 self.corrects += 1 171 self.corrects += 1
172 else: 172 else:
173 debug('='*50) 173 print('='*50)
174 debug("{0} became running (INVALID)" 174 print("{0} became running (INVALID)"
175 .format(Trace.getStr(release_record))) 175 .format(Trace.getStr(release_record)))
176 debug('Deadline of {0} greater than deadline of {1} in the following record:' 176 print('Deadline of {0} greater than deadline of {1} in the following record:'
177 .format(release_record['deadline'], 177 .format(release_record['deadline'],
178 check_tuple[1]['deadline'])) 178 check_tuple[1]['deadline']))
179 debug(check_tuple[1]) 179 print(check_tuple[1])
180 debug('='*50) 180 self.print_runnables()
181 self.print_runnings()
182 print('='*50)
181 self.errors += 1 183 self.errors += 1
182 184
183 #Switch Aways 185 #Switch Aways
@@ -185,7 +187,7 @@ class EDF:
185 release_record = EDF.pop_job(record, self.runnings) 187 release_record = EDF.pop_job(record, self.runnings)
186 if release_record: 188 if release_record:
187 self.runnables.append(release_record) 189 self.runnables.append(release_record)
188 debug('{0} went from running to runnable' 190 print('{0} went from running to runnable'
189 .format(Trace.getStr(release_record))) 191 .format(Trace.getStr(release_record)))
190 192
191 #Completions 193 #Completions
@@ -193,7 +195,7 @@ class EDF:
193 release_record = EDF.pop_job(record,self.runnings) 195 release_record = EDF.pop_job(record,self.runnings)
194 if not release_record: 196 if not release_record:
195 release_record = EDF.pop_job(record,self.runnables) 197 release_record = EDF.pop_job(record,self.runnables)
196 debug('{0} completed' 198 print('{0} completed'
197 .format(Trace.getStr(release_record))) 199 .format(Trace.getStr(release_record)))
198 200
199 print('Corrects: {0}'.format(self.corrects)) 201 print('Corrects: {0}'.format(self.corrects))
@@ -247,13 +249,17 @@ class EDF:
247 return True 249 return True
248 return False 250 return False
249 251
252 def print_runnables(self):
253 """Print the runnable jobs"""
254 print("Runnable jobs:")
255 for record in self.runnables:
256 print('{0}, {1}'.format(Trace.getStr(record),record['deadline']))
250 257
251#################################### 258 def print_runnings(self):
252# Debug # 259 """Print the runnable jobs"""
253#################################### 260 print("Running jobs:")
254 261 for record in self.runnings:
255def debug(string): 262 print('{0}, {1}'.format(Trace.getStr(record),record['deadline']))
256 print(string)
257 263
258 264
259#################################### 265####################################