summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMac Mollison <mollison@cs.unc.edu>2009-03-02 20:44:04 -0500
committerMac Mollison <mollison@cs.unc.edu>2009-03-02 20:44:04 -0500
commit363ac8597f9dbe356371589b8d2ffe04ecb7e187 (patch)
tree839537db367264b4b3cb952e1e5bb40e311751fc
parent6d9ceacb59e1a3dec05b964d6df5974eef5b31c0 (diff)
Adding timestamp printing next to each event in the EDF test printout
-rwxr-xr-xsta.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/sta.py b/sta.py
index 8332c1e..13670ed 100755
--- a/sta.py
+++ b/sta.py
@@ -121,7 +121,12 @@ class Trace:
121 print("") 121 print("")
122 122
123 def getStr(record): 123 def getStr(record):
124 return "({0},{1})".format(record['pid'],record['job']) 124 time = None
125 if 'when' in record:
126 time = record['when']
127 else:
128 time = record['release_time']
129 return "{0}: ({1},{2})".format(time,record['pid'],record['job'])
125 130
126 131
127################## 132##################
@@ -167,12 +172,12 @@ class EDF:
167 check_tuple = self.check_deadline(release_record) 172 check_tuple = self.check_deadline(release_record)
168 if check_tuple[0] == True: 173 if check_tuple[0] == True:
169 print("{0} became running (VALID)" 174 print("{0} became running (VALID)"
170 .format(Trace.getStr(release_record))) 175 .format(Trace.getStr(record)))
171 self.corrects += 1 176 self.corrects += 1
172 else: 177 else:
173 print('='*50) 178 print('='*50)
174 print("{0} became running (INVALID)" 179 print("{0} became running (INVALID)"
175 .format(Trace.getStr(release_record))) 180 .format(Trace.getStr(record)))
176 print('Deadline of {0} greater than deadline of {1} in the following record:' 181 print('Deadline of {0} greater than deadline of {1} in the following record:'
177 .format(release_record['deadline'], 182 .format(release_record['deadline'],
178 check_tuple[1]['deadline'])) 183 check_tuple[1]['deadline']))
@@ -188,7 +193,7 @@ class EDF:
188 if release_record: 193 if release_record:
189 self.runnables.append(release_record) 194 self.runnables.append(release_record)
190 print('{0} went from running to runnable' 195 print('{0} went from running to runnable'
191 .format(Trace.getStr(release_record))) 196 .format(Trace.getStr(record)))
192 197
193 #Completions 198 #Completions
194 elif record['type'] == 7: 199 elif record['type'] == 7:
@@ -196,7 +201,7 @@ class EDF:
196 if not release_record: 201 if not release_record:
197 release_record = EDF.pop_job(record,self.runnables) 202 release_record = EDF.pop_job(record,self.runnables)
198 print('{0} completed' 203 print('{0} completed'
199 .format(Trace.getStr(release_record))) 204 .format(Trace.getStr(record)))
200 205
201 print('Corrects: {0}'.format(self.corrects)) 206 print('Corrects: {0}'.format(self.corrects))
202 print('Errors : {0}'.format(self.errors)) 207 print('Errors : {0}'.format(self.errors))