aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-05-22 13:10:13 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-05-22 13:10:13 -0400
commite17645921697351bd968f034a85299c02332ad16 (patch)
treeac9139f6586e0ab9e82ed3367e3d8086e761fe26
parentb7380c730702f5c8a41ca89b007facd815f8d31d (diff)
Fix broken demand calculation
Felipe Cerqueira reported incorrect QPA results. The root cause was a corner case in the demand calculation. This patch fixes the underestimation of demand if time == deadline and adds a test case discovered by Felipe that triggered the bug.
-rw-r--r--native/include/tasks.h2
-rw-r--r--tests/edf.py16
2 files changed, 17 insertions, 1 deletions
diff --git a/native/include/tasks.h b/native/include/tasks.h
index 092e21a..0f53060 100644
--- a/native/include/tasks.h
+++ b/native/include/tasks.h
@@ -69,7 +69,7 @@ class Task
69 69
70 void bound_demand(const integral_t &time, integral_t &demand) const 70 void bound_demand(const integral_t &time, integral_t &demand) const
71 { 71 {
72 if (time <= deadline) 72 if (time < deadline)
73 demand = 0; 73 demand = 0;
74 else 74 else
75 { 75 {
diff --git a/tests/edf.py b/tests/edf.py
index ee388ee..3dffb6d 100644
--- a/tests/edf.py
+++ b/tests/edf.py
@@ -171,3 +171,19 @@ class Test_QPA(unittest.TestCase):
171 def test_edf_schedulable(self): 171 def test_edf_schedulable(self):
172 self.ts.append(tasks.SporadicTask( 10, 100, deadline=15)) 172 self.ts.append(tasks.SporadicTask( 10, 100, deadline=15))
173 self.assertFalse(edf.is_schedulable(1, self.ts)) 173 self.assertFalse(edf.is_schedulable(1, self.ts))
174
175 def test_qpa_known_unschedulable(self):
176 qpa = edf.native.QPATest(1)
177 ts1 = tasks.TaskSystem([
178 tasks.SporadicTask(331, 15000, deadline=2688),
179 tasks.SporadicTask(3654, 77000, deadline=3849)
180 ])
181 self.assertFalse(qpa.is_schedulable(sched.get_native_taskset(ts1)))
182
183 ts2 = tasks.TaskSystem([tasks.SporadicTask(331, 15000, deadline=2688),
184 tasks.SporadicTask(413, 34000, deadline=1061),
185 tasks.SporadicTask(3654, 77000, deadline=3849),
186 tasks.SporadicTask(349, 70000, deadline=20189),
187 tasks.SporadicTask(1113, 83000, deadline=10683),
188 ])
189 self.assertFalse(qpa.is_schedulable(sched.get_native_taskset(ts2)))