diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-05-17 09:41:49 -0400 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-05-17 09:41:49 -0400 |
| commit | c2e3e08ef2ce90237b7b50efd0adc1e2848a3729 (patch) | |
| tree | 9574a97377fafda742c6b75a21971a6c909e8394 /tests | |
| parent | 7cd7212e7273c9c137e4bb1825d2b9f3842c882d (diff) | |
C++: Properly consider priority ceilings in DPCP bound
The bound should not reflect requests executed by agents that can be preempted.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/locking.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/locking.py b/tests/locking.py index 73cd8f1..b16c453 100644 --- a/tests/locking.py +++ b/tests/locking.py | |||
| @@ -440,6 +440,42 @@ class Test_dpcp_terms(unittest.TestCase): | |||
| 440 | self.assertEqual(6 + 3, res.get_remote_count(2)) | 440 | self.assertEqual(6 + 3, res.get_remote_count(2)) |
| 441 | self.assertEqual(6 * 3 + 3 * 5, res.get_remote_blocking(2)) | 441 | self.assertEqual(6 * 3 + 3 * 5, res.get_remote_blocking(2)) |
| 442 | 442 | ||
| 443 | def test_priority_ceiling(self): | ||
| 444 | self.rsi = cpp.ResourceSharingInfo(4) | ||
| 445 | |||
| 446 | self.rsi.add_task(10, 10, 2, 100) | ||
| 447 | self.rsi.add_request(0, 1, 3) | ||
| 448 | |||
| 449 | self.rsi.add_task(25, 25, 3, 200) | ||
| 450 | self.rsi.add_request(0, 1, 5) | ||
| 451 | |||
| 452 | self.rsi.add_task(50, 50, 4, 300) | ||
| 453 | self.rsi.add_request(1, 1, 7) | ||
| 454 | |||
| 455 | self.rsi.add_task(100, 100, 1, 400) | ||
| 456 | self.rsi.add_request(1, 1, 9) | ||
| 457 | |||
| 458 | self.loc = cpp.ResourceLocality() | ||
| 459 | self.loc.assign_resource(0, 1) | ||
| 460 | self.loc.assign_resource(1, 1) | ||
| 461 | |||
| 462 | res = cpp.dpcp_bounds(self.rsi, self.loc) | ||
| 463 | |||
| 464 | self.assertEqual(1, res.get_remote_count(0)) | ||
| 465 | self.assertEqual(5, res.get_remote_blocking(0)) | ||
| 466 | |||
| 467 | self.assertEqual(4, res.get_remote_count(1)) | ||
| 468 | self.assertEqual(4 * 3, res.get_remote_blocking(1)) | ||
| 469 | |||
| 470 | self.assertEqual(6 + 3 + 1, res.get_remote_count(2)) | ||
| 471 | self.assertEqual(6 * 3 + 3 * 5 + 1 * 9, res.get_remote_blocking(2)) | ||
| 472 | |||
| 473 | self.assertEqual(0, res.get_remote_count(3)) | ||
| 474 | self.assertEqual(0, res.get_remote_blocking(3)) | ||
| 475 | |||
| 476 | self.assertEqual(11 + 5 + 3, res.get_local_count(3)) | ||
| 477 | self.assertEqual(11 * 3 + 5 * 5 + 3 * 7, res.get_local_blocking(3)) | ||
| 478 | |||
| 443 | 479 | ||
| 444 | class Test_mpcp_terms(unittest.TestCase): | 480 | class Test_mpcp_terms(unittest.TestCase): |
| 445 | 481 | ||
