summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMac Mollison <mollison@cs.unc.edu>2010-04-03 22:55:54 -0400
committerMac Mollison <mollison@cs.unc.edu>2010-04-03 22:55:54 -0400
commit8e177eeb507e19ed82685ec598611180ec869ff0 (patch)
tree6a9c21958e2e83c7d73f2634842a849a0b060bf0
parent010139704cf40d1acb084e6088bc8cb855bf5095 (diff)
Bugfix for blocking
-rw-r--r--unit_trace/gedf_test.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/unit_trace/gedf_test.py b/unit_trace/gedf_test.py
index 0cab857..d4586ce 100644
--- a/unit_trace/gedf_test.py
+++ b/unit_trace/gedf_test.py
@@ -182,7 +182,8 @@ def _gedf_check(eligible,on_cpu,when,m,first_event_this_timestamp):
182 all.sort(key=lambda x: 0 if (x in on_cpu) else 1) 182 all.sort(key=lambda x: 0 if (x in on_cpu) else 1)
183 all.sort(key=lambda x: x.deadline) 183 all.sort(key=lambda x: x.deadline)
184 184
185 # Check those that actually should be running 185 # Check those that actually should be running, to look for priority
186 # inversions
186 for x in range(0,min(m,len(all))): 187 for x in range(0,min(m,len(all))):
187 job = all[x] 188 job = all[x]
188 189
@@ -201,14 +202,10 @@ def _gedf_check(eligible,on_cpu,when,m,first_event_this_timestamp):
201 job.inversion_start = None 202 job.inversion_start = None
202 job.inversion_end = None 203 job.inversion_end = None
203 204
204 # Check those that actually should not be running 205 # Check those that actually should not be running, to record the end of any
206 # priority inversions
205 for x in range(m,len(all)): 207 for x in range(m,len(all)):
206 job = all[x] 208 job = all[x]
207
208 # It actually is running. We don't care.
209
210 # It isn't running, but an inversion_start exists (i.e. it is still
211 # marked as being inverted)
212 if job not in on_cpu and job.inversion_start is not None: 209 if job not in on_cpu and job.inversion_start is not None:
213 job.inversion_end = when 210 job.inversion_end = when
214 errors.append(Error(job, eligible, on_cpu, 211 errors.append(Error(job, eligible, on_cpu,
@@ -216,4 +213,14 @@ def _gedf_check(eligible,on_cpu,when,m,first_event_this_timestamp):
216 job.inversion_start = None 213 job.inversion_start = None
217 job.inversion_end = None 214 job.inversion_end = None
218 215
216 # Look for priority inversions among blocked tasks and end them
217 all = filter(lambda x:x.is_blocked and x.inversion_start is not None,
218 on_cpu + eligible)
219 for job in all:
220 job.inversion_end = when
221 errors.append(Error(job, eligible, on_cpu,
222 first_event_this_timestamp))
223 job.inversion_start = None
224 job.inversion_end = None
225
219 return errors 226 return errors