Ejemplo n.º 1
0
    def test_priority_ceiling(self):
        self.rsi = cpp.ResourceSharingInfo(4)

        self.rsi.add_task(10, 10, 2, 100)
        self.rsi.add_request(0, 1, 3)

        self.rsi.add_task(25, 25, 3, 200)
        self.rsi.add_request(0, 1, 5)

        self.rsi.add_task(50, 50, 4, 300)
        self.rsi.add_request(1, 1, 7)

        self.rsi.add_task(100, 100, 1, 400)
        self.rsi.add_request(1, 1, 9)

        self.loc = cpp.ResourceLocality()
        self.loc.assign_resource(0, 1)
        self.loc.assign_resource(1, 1)

        res = cpp.dpcp_bounds(self.rsi, self.loc)

        self.assertEqual(1, res.get_remote_count(0))
        self.assertEqual(5, res.get_remote_blocking(0))

        self.assertEqual(4, res.get_remote_count(1))
        self.assertEqual(4 * 3, res.get_remote_blocking(1))

        self.assertEqual(6 + 3 + 1, res.get_remote_count(2))
        self.assertEqual(6 * 3 + 3 * 5 + 1 * 9, res.get_remote_blocking(2))

        self.assertEqual(0, res.get_remote_count(3))
        self.assertEqual(0, res.get_remote_blocking(3))

        self.assertEqual(11 + 5 + 3, res.get_local_count(3))
        self.assertEqual(11 * 3 + 5 * 5 + 3 * 7, res.get_local_blocking(3))
Ejemplo n.º 2
0
def apply_dpcp_bounds(all_tasks, resource_mapping):
    # The DPCP bounds are expressed in terms of task periods,
    # not response time.
    model = get_cpp_model(all_tasks)
    res = cpp.dpcp_bounds(model, resource_mapping)

    for i, t in enumerate(all_tasks):
        # remote blocking <=> suspension time
        t.suspended = res.get_remote_blocking(i)
        # all blocking, including arrival blocking
        t.blocked = res.get_blocking_term(i)
Ejemplo n.º 3
0
    def test_remote_blocking(self):
        res = cpp.dpcp_bounds(self.rsi, self.loc)

        self.assertEqual(0, res.get_remote_count(3))
        self.assertEqual(0, res.get_remote_blocking(3))

        self.assertEqual(1, res.get_remote_count(0))
        self.assertEqual(7, res.get_remote_blocking(0))

        self.assertEqual(5, res.get_remote_count(1))
        self.assertEqual(4 * 3 + 1 * 7, res.get_remote_blocking(1))

        self.assertEqual(6 + 3, res.get_remote_count(2))
        self.assertEqual(6 * 3 + 3 * 5, res.get_remote_blocking(2))
Ejemplo n.º 4
0
    def test_local_blocking(self):
        res = cpp.dpcp_bounds(self.rsi, self.loc)

        self.assertEqual(0, res.get_local_count(0))
        self.assertEqual(0, res.get_local_blocking(0))

        self.assertEqual(0, res.get_local_count(1))
        self.assertEqual(0, res.get_local_blocking(1))

        self.assertEqual(0, res.get_local_count(2))
        self.assertEqual(0, res.get_local_blocking(2))

        self.assertEqual(11 + 5 + 3, res.get_local_count(3))
        self.assertEqual(11 * 3 + 5 * 5 + 3 * 7, res.get_local_blocking(3))
Ejemplo n.º 5
0
def apply_dpcp_bounds(all_tasks, resource_mapping,
                      use_text_book_definition=False):
    # The DPCP bounds are expressed in terms of task periods,
    # not response time, in the original definition.
    model = get_cpp_model(all_tasks, use_text_book_definition)
    topo  = get_cpp_topology(resource_mapping)
    res = cpp.dpcp_bounds(model, topo)

    for i,t in enumerate(all_tasks):
        # remote blocking <=> suspension time
        t.suspended = res.get_remote_blocking(i)
        # all blocking, including arrival blocking
        t.blocked   = res.get_blocking_term(i)

    return res
Ejemplo n.º 6
0
def apply_dpcp_bounds(all_tasks, resource_mapping,
                      use_text_book_definition=False):
    # The DPCP bounds are expressed in terms of task periods,
    # not response time, in the original definition.
    model = get_cpp_model(all_tasks, use_text_book_definition)
    topo  = get_cpp_topology(resource_mapping)
    res = cpp.dpcp_bounds(model, topo)

    for i,t in enumerate(all_tasks):
        # remote blocking <=> suspension time
        t.suspended = res.get_remote_blocking(i)
        # all blocking, including arrival blocking
        t.blocked   = res.get_blocking_term(i)

    return res