Esempio n. 1
0
    def test_assoc_get(self, lib):
        "Tests assoc_get() method."

        def pqos_allc_assoc_get_m(core, class_id_ref):
            "Mock pqos_alloc_assoc_get()."

            self.assertEqual(core, 2)
            ctypes_ref_set_uint(class_id_ref, 5)
            return 0

        lib.pqos_alloc_assoc_get = MagicMock(side_effect=pqos_allc_assoc_get_m)

        alloc = PqosAlloc()
        class_id = alloc.assoc_get(2)

        lib.pqos_alloc_assoc_get.assert_called_once()
        self.assertEqual(class_id, 5)
Esempio n. 2
0
    def test_assoc_get(self, lib):
        "Tests assoc_get() method."

        def pqos_allc_assoc_get_m(core, class_id_ref):
            "Mock pqos_alloc_assoc_get()."

            self.assertEqual(core, 2)
            ctypes_ref_set_uint(class_id_ref, 5)
            return 0

        lib.pqos_alloc_assoc_get = MagicMock(side_effect=pqos_allc_assoc_get_m)

        alloc = PqosAlloc()
        class_id = alloc.assoc_get(2)

        lib.pqos_alloc_assoc_get.assert_called_once()
        self.assertEqual(class_id, 5)
Esempio n. 3
0
def print_allocation_config():
    """
    Prints allocation configuration.
    """

    l3ca = PqosCatL3()
    alloc = PqosAlloc()
    cpuinfo = PqosCpuInfo()
    sockets = cpuinfo.get_sockets()

    for socket in sockets:
        try:
            coses = l3ca.get(socket)

            print("L3CA COS definitions for Socket %u:" % socket)

            for cos in coses:
                cos_params = (cos.class_id, cos.mask)
                print("    L3CA COS%u => MASK 0x%x" % cos_params)
        except:
            print("Error")
            raise

    for socket in sockets:
        try:
            print("Core information for socket %u:" % socket)

            cores = cpuinfo.get_cores(socket)

            for core in cores:
                class_id = alloc.assoc_get(core)
                try:
                    print("    Core %u => COS%u" % (core, class_id))
                except:
                    print("    Core %u => ERROR" % core)
        except:
            print("Error")
            raise
Esempio n. 4
0
def print_allocation_config():
    """
    Prints allocation configuration.
    """

    alloc = PqosAlloc()
    cpuinfo = PqosCpuInfo()
    sockets = cpuinfo.get_sockets()

    for socket in sockets:
        try:
            print("Core information for socket %u:" % socket)

            cores = cpuinfo.get_cores(socket)

            for core in cores:
                class_id = alloc.assoc_get(core)
                try:
                    print("    Core %u => COS%u" % (core, class_id))
                except:
                    print("    Core %u => ERROR" % core)
        except:
            print("Error")
            raise