Beispiel #1
0
    def reset(self):
        """
        Resets monitoring configuration.
        """

        ret = self.pqos.lib.pqos_mon_reset()
        pqos_handle_error('pqos_mon_reset', ret)
Beispiel #2
0
    def assign_pid(self, technologies, pids):
        """
        Assigns a first available class of service to tasks specified by pids.
        Searches all COS directories from the highest to the lowest.

        While searching for available class of service, it takes into account
        technologies it is intended to use with.
        Note on technologies:
        - this parameter is currently reserved for future use
        - resctrl (Linux interface) will only provide the highest class id common
          to all supported technologies

        Parameters:
            technologies: a list of technologies, available options: mon, l3ca,
                          l2ca and mba
            pids: a list of process IDs

        Returns:
            class of service
        """

        mask = _get_technology_mask(technologies)
        pid_array = _get_list_of_cores(pids)
        pid_array_len = len(pid_array)
        class_id = ctypes.c_uint(0)
        class_id_ref = ctypes.byref(class_id)
        ret = self.pqos.lib.pqos_alloc_assign_pid(mask, pid_array,
                                                  pid_array_len, class_id_ref)
        pqos_handle_error(u'pqos_alloc_assign_pid', ret)
        return class_id.value
Beispiel #3
0
    def assign(self, technologies, cores):
        """
        Assigns a first available class of service to cores.

        While searching for available class of service, it takes into account
        technologies it is intended to use with.
        Note on technologies and cores:
        - if L2 CAT technology is requested then cores need to belong to
          one L2 cluster (same L2ID)
        - if only L3 CAT is requested then cores need to belong to one socket
        - if only MBA is selected then cores need to belong to one socket

        Parameters:
            technologies: a list of technologies, available options: mon, l3ca,
                          l2ca and mba
            cores: a list of cores

        Returns:
            class of service
        """

        mask = _get_technology_mask(technologies)
        class_id = ctypes.c_uint(0)
        class_id_ref = ctypes.byref(class_id)
        core_array_len = len(cores)
        core_array = _get_list_of_cores(cores)
        ret = self.pqos.lib.pqos_alloc_assign(mask, core_array, core_array_len,
                                              class_id_ref)
        pqos_handle_error('pqos_alloc_assign', ret)
        return class_id.value
Beispiel #4
0
    def assign_pid(self, technologies, pids):
        """
        Assigns a first available class of service to tasks specified by pids.
        Searches all COS directories from the highest to the lowest.

        While searching for available class of service, it takes into account
        technologies it is intended to use with.
        Note on technologies:
        - this parameter is currently reserved for future use
        - resctrl (Linux interface) will only provide the highest class id common
          to all supported technologies

        Parameters:
            technologies: a list of technologies, available options: mon, l3ca,
                          l2ca and mba
            pids: a list of process IDs

        Returns:
            class of service
        """

        mask = _get_technology_mask(technologies)
        pid_array = _get_list_of_cores(pids)
        pid_array_len = len(pid_array)
        class_id = ctypes.c_uint(0)
        class_id_ref = ctypes.byref(class_id)
        ret = self.pqos.lib.pqos_alloc_assign_pid(mask, pid_array,
                                                  pid_array_len, class_id_ref)
        pqos_handle_error('pqos_alloc_assign_pid', ret)
        return class_id.value
Beispiel #5
0
    def assign(self, technologies, cores):
        """
        Assigns a first available class of service to cores.

        While searching for available class of service, it takes into account
        technologies it is intended to use with.
        Note on technologies and cores:
        - if L2 CAT technology is requested then cores need to belong to
          one L2 cluster (same L2ID)
        - if only L3 CAT is requested then cores need to belong to one socket
        - if only MBA is selected then cores need to belong to one socket

        Parameters:
            technologies: a list of technologies, available options: mon, l3ca,
                          l2ca and mba
            cores: a list of cores

        Returns:
            class of service
        """

        mask = _get_technology_mask(technologies)
        class_id = ctypes.c_uint(0)
        class_id_ref = ctypes.byref(class_id)
        core_array_len = len(cores)
        core_array = _get_list_of_cores(cores)
        ret = self.pqos.lib.pqos_alloc_assign(mask, core_array, core_array_len,
                                              class_id_ref)
        pqos_handle_error(u'pqos_alloc_assign', ret)
        return class_id.value
Beispiel #6
0
    def stop(self):
        """
        Stops monitoring.
        """

        ref = self.get_ref()
        ret = self.pqos.lib.pqos_mon_stop(ref)
        pqos_handle_error('pqos_mon_stop', ret)
Beispiel #7
0
 def remove_pids(self, pids):
     """
     Removes PIDs from the monitoring group.
     """
     ref = self.get_ref()
     num_pids = len(pids)
     pids_arr = (ctypes.c_uint * num_pids)(*pids)
     ret = self.pqos.lib.pqos_mon_remove_pids(num_pids, pids_arr, ref)
     pqos_handle_error('pqos_mon_remove_pids', ret)
Beispiel #8
0
 def add_pids(self, pids):
     """
     Adds PIDs to the monitoring group.
     """
     ref = self.get_ref()
     num_pids = len(pids)
     pids_arr = (ctypes.c_uint * num_pids)(*pids)
     ret = self.pqos.lib.pqos_mon_add_pids(num_pids, pids_arr, ref)
     pqos_handle_error(u'pqos_mon_add_pids', ret)
Beispiel #9
0
    def get_min_cbm_bits(self):
        """Gets minimum number of bits which must be set in L2 way mask when
        updating a class of service."""

        min_cbm_bits = ctypes.c_uint(0)
        min_cbm_bits_ref = ctypes.byref(min_cbm_bits)
        ret = self.pqos.lib.pqos_l2ca_get_min_cbm_bits(min_cbm_bits_ref)
        pqos_handle_error(u'pqos_l2ca_get_min_cbm_bits', ret)
        return min_cbm_bits.value
Beispiel #10
0
    def get_min_cbm_bits(self):
        """Gets minimum number of bits which must be set in L3 way mask when
        updating a class of service."""

        min_cbm_bits = ctypes.c_uint(0)
        min_cbm_bits_ref = ctypes.byref(min_cbm_bits)
        ret = self.pqos.lib.pqos_l3ca_get_min_cbm_bits(min_cbm_bits_ref)
        pqos_handle_error(u'pqos_l3ca_get_min_cbm_bits', ret)
        return min_cbm_bits.value
Beispiel #11
0
 def get_mba_cos_num(self):
     """
     Retrieves number of memory B/W allocation classes of service from
     a cap structure.
     """
     cos_num = ctypes.c_uint(0)
     ret = self.pqos.lib.pqos_mba_get_cos_num(self.p_cap,
                                              ctypes.byref(cos_num))
     pqos_handle_error(u'pqos_mba_get_cos_num', ret)
     return cos_num.value
Beispiel #12
0
 def is_l2ca_cdp_enabled(self):
     "Retrieves L2 CDP status."
     supported = ctypes.c_int(0)
     enabled = ctypes.c_int(0)
     ret = self.pqos.lib.pqos_l2ca_cdp_enabled(self.p_cap,
                                               ctypes.byref(supported),
                                               ctypes.byref(enabled))
     pqos_handle_error('pqos_l2ca_cdp_enabled', ret)
     return (_get_tristate_bool(supported.value),
             _get_tristate_bool(enabled.value))
Beispiel #13
0
 def is_mba_ctrl_enabled(self):
     "Retrieves MBA CTRL status."
     supported = ctypes.c_int(0)
     enabled = ctypes.c_int(0)
     ret = self.pqos.lib.pqos_mba_ctrl_enabled(self.p_cap,
                                               ctypes.byref(supported),
                                               ctypes.byref(enabled))
     pqos_handle_error(u'pqos_mba_ctrl_enabled', ret)
     return (_get_tristate_bool(supported.value),
             _get_tristate_bool(enabled.value))
Beispiel #14
0
    def assoc_set_pid(self, pid, class_id):
        """
        OS interface to associate a task with a given class of service.

        Parameters:
            pid: process ID
            class_id: class of service
        """

        ret = self.pqos.lib.pqos_alloc_assoc_set_pid(pid, class_id)
        pqos_handle_error('pqos_alloc_assoc_set_pid', ret)
Beispiel #15
0
    def assoc_set(self, core, class_id):
        """
        Associates a logical core with a given class of service.

        Parameters:
            core: a logical core number
            class_id: class of service
        """

        ret = self.pqos.lib.pqos_alloc_assoc_set(core, class_id)
        pqos_handle_error('pqos_alloc_assoc_set', ret)
Beispiel #16
0
    def assoc_set(self, core, class_id):
        """
        Associates a logical core with a given class of service.

        Parameters:
            core: a logical core number
            class_id: class of service
        """

        ret = self.pqos.lib.pqos_alloc_assoc_set(core, class_id)
        pqos_handle_error(u'pqos_alloc_assoc_set', ret)
Beispiel #17
0
    def assoc_set_pid(self, pid, class_id):
        """
        OS interface to associate a task with a given class of service.

        Parameters:
            pid: process ID
            class_id: class of service
        """

        ret = self.pqos.lib.pqos_alloc_assoc_set_pid(pid, class_id)
        pqos_handle_error(u'pqos_alloc_assoc_set_pid', ret)
Beispiel #18
0
    def release(self, cores):
        """
        Reassigns cores to default class of service #0.

        Parameters:
            cores: a list of cores
        """

        core_array_len = len(cores)
        core_array = _get_list_of_cores(cores)
        ret = self.pqos.lib.pqos_alloc_release(core_array, core_array_len)
        pqos_handle_error(u'pqos_alloc_release', ret)
Beispiel #19
0
    def release_pid(self, pids):
        """
        Reassigns tasks specified by pids to default class of service #0.

        Parameters:
            pids: a list of process IDs
        """

        pid_array = _get_list_of_cores(pids)
        pid_array_len = len(pid_array)
        ret = self.pqos.lib.pqos_alloc_release_pid(pid_array, pid_array_len)
        pqos_handle_error(u'pqos_alloc_release_pid', ret)
Beispiel #20
0
    def release(self, cores):
        """
        Reassigns cores to default class of service #0.

        Parameters:
            cores: a list of cores
        """

        core_array_len = len(cores)
        core_array = _get_list_of_cores(cores)
        ret = self.pqos.lib.pqos_alloc_release(core_array, core_array_len)
        pqos_handle_error('pqos_alloc_release', ret)
Beispiel #21
0
    def release_pid(self, pids):
        """
        Reassigns tasks specified by pids to default class of service #0.

        Parameters:
            pids: a list of process IDs
        """

        pid_array = _get_list_of_cores(pids)
        pid_array_len = len(pid_array)
        ret = self.pqos.lib.pqos_alloc_release_pid(pid_array, pid_array_len)
        pqos_handle_error('pqos_alloc_release_pid', ret)
Beispiel #22
0
    def poll(self, groups):
        """
        Polls and updates monitoring data for given monitoring objects.

        Parameters:
            groups: a list of CPqosMonData monitoring object
        """

        refs = [group.get_ref() for group in groups]
        num_groups = len(groups)
        groups_arr = (ctypes.POINTER(CPqosMonData) * num_groups)(*refs)
        ret = self.pqos.lib.pqos_mon_poll(groups_arr, num_groups)
        pqos_handle_error('pqos_mon_poll', ret)
Beispiel #23
0
    def set(self, l2id, coses):
        """
        Sets class of service on a specified l2id.

        Parameters:
            l2id: L2 cache identifier
            coses: a list of PqosCatL2.COS objects, class of service
                   configuration
        """

        pqos_l2_cas = [CPqosL2Ca.from_cos(cos) for cos in coses]
        pqos_l2_ca_arr = (CPqosL2Ca * len(pqos_l2_cas))(*pqos_l2_cas)
        ret = self.pqos.lib.pqos_l2ca_set(l2id, len(pqos_l2_cas),
                                          pqos_l2_ca_arr)
        pqos_handle_error('pqos_l2ca_set', ret)
Beispiel #24
0
    def set(self, socket, coses):
        """
        Sets class of service on a specified socket.

        Parameters:
            socket: a socket number
            coses: a list of PqosCatL2.COS objects, class of service
                   configuration
        """

        pqos_l2_cas = [CPqosL2Ca.from_cos(cos) for cos in coses]
        pqos_l2_ca_arr = (CPqosL2Ca * len(pqos_l2_cas))(*pqos_l2_cas)
        ret = self.pqos.lib.pqos_l2ca_set(socket, len(pqos_l2_cas),
                                          pqos_l2_ca_arr)
        pqos_handle_error(u'pqos_l2ca_set', ret)
Beispiel #25
0
    def set(self, socket, coses):
        """
        Sets class of service on a specified socket.

        Parameters:
            socket: a socket number
            coses: a list of PqosCatL3.COS objects, class of service
                   configuration
        """

        pqos_l3_cas = [CPqosL3Ca.from_cos(cos) for cos in coses]
        pqos_l3_ca_arr = (CPqosL3Ca * len(pqos_l3_cas))(*pqos_l3_cas)
        ret = self.pqos.lib.pqos_l3ca_set(socket, len(pqos_l3_cas),
                                          pqos_l3_ca_arr)
        pqos_handle_error(u'pqos_l3ca_set', ret)
Beispiel #26
0
    def assoc_get(self, core):
        """
        Reads association of a logical core with a class of service.

        Parameters:
            core: a logical core number

        Returns:
            class of service
        """

        class_id = ctypes.c_uint(0)
        ret = self.pqos.lib.pqos_alloc_assoc_get(core, ctypes.byref(class_id))
        pqos_handle_error('pqos_alloc_assoc_get', ret)
        return class_id.value
Beispiel #27
0
    def assoc_get(self, core):
        """
        Reads association of a logical core with a class of service.

        Parameters:
            core: a logical core number

        Returns:
            class of service
        """

        class_id = ctypes.c_uint(0)
        ret = self.pqos.lib.pqos_alloc_assoc_get(core, ctypes.byref(class_id))
        pqos_handle_error(u'pqos_alloc_assoc_get', ret)
        return class_id.value
Beispiel #28
0
    def assoc_get_pid(self, pid):
        """
        OS interface to read association of a task with class of service.

        Parameters:
            pid: process ID

        Returns:
            class of service
        """

        class_id = ctypes.c_uint(0)
        class_id_ref = ctypes.byref(class_id)
        ret = self.pqos.lib.pqos_alloc_assoc_get_pid(pid, class_id_ref)
        pqos_handle_error(u'pqos_alloc_assoc_get_pid', ret)
        return class_id.value
Beispiel #29
0
    def get_type(self, type_str):
        """Retrieves a type of capability from a cap structure.

        Parameters:
            type_str: a string indicating a type of capability, available
                      options: mon, l3ca, l2ca and mba
        """
        type_enum = pqos_get_type_enum(type_str)
        p_cap_item = ctypes.POINTER(CPqosCapability)()
        ret = self.pqos.lib.pqos_cap_get_type(self.p_cap, type_enum,
                                              ctypes.byref(p_cap_item))
        pqos_handle_error(u'pqos_cap_get_type', ret)

        cap_item = p_cap_item.contents
        capability = _get_capability(cap_item, type_str)
        return capability
Beispiel #30
0
    def assoc_get(self, core):
        """
        Reads associated RMID for a given core.

        Parameters:
            core: core ID

        Returns:
            RMID for a given core
        """

        rmid = RmidT(0)
        rmid_ref = ctypes.byref(rmid)
        ret = self.pqos.lib.pqos_mon_assoc_get(core, rmid_ref)
        pqos_handle_error('pqos_mon_assoc_get', ret)
        return rmid.value
Beispiel #31
0
    def assoc_get_pid(self, pid):
        """
        OS interface to read association of a task with class of service.

        Parameters:
            pid: process ID

        Returns:
            class of service
        """

        class_id = ctypes.c_uint(0)
        class_id_ref = ctypes.byref(class_id)
        ret = self.pqos.lib.pqos_alloc_assoc_get_pid(pid, class_id_ref)
        pqos_handle_error('pqos_alloc_assoc_get_pid', ret)
        return class_id.value
Beispiel #32
0
    def _call_func_ref(self, func, arg):
        """
        Calls a function from PQoS library, handles errors and returns
        an integer set by the called function.

        Parameters:
            func: a function from PQoS library
            arg: a function argument

        Returns:
            an integer set by the called function
        """

        result = ctypes.c_uint(0)
        result_ref = ctypes.byref(result)
        ret = func(self.p_cpu, arg, result_ref)
        pqos_handle_error(func.__name__, ret)
        return result.value
Beispiel #33
0
    def _call_func_ref(self, func, arg):
        """
        Calls a function from PQoS library, handles errors and returns
        an integer set by the called function.

        Parameters:
            func: a function from PQoS library
            arg: a function argument

        Returns:
            an integer set by the called function
        """

        result = ctypes.c_uint(0)
        result_ref = ctypes.byref(result)
        ret = func(self.p_cpu, arg, result_ref)
        pqos_handle_error(func.__name__, ret)
        return result.value
Beispiel #34
0
    def get(self, socket):
        """
        Reads classes of service from a socket.

        Parameters:
            socket: a socket number
        """

        cap = PqosCap()
        cos_num = cap.get_l2ca_cos_num()

        l2cas = (CPqosL2Ca * cos_num)()
        num_ca = ctypes.c_uint(0)
        num_ca_ref = ctypes.byref(num_ca)
        ret = self.pqos.lib.pqos_l2ca_get(socket, cos_num, num_ca_ref, l2cas)
        pqos_handle_error(u'pqos_l2ca_get', ret)

        coses = [l2ca.to_cos(self.COS) for l2ca in l2cas]
        return coses
Beispiel #35
0
    def get(self, socket):
        """
        Reads classes of service from a socket.

        Parameters:
            socket: a socket number
        """

        cap = PqosCap()
        cos_num = cap.get_l3ca_cos_num()

        l3cas = (CPqosL3Ca * cos_num)()
        num_ca = ctypes.c_uint(0)
        num_ca_ref = ctypes.byref(num_ca)
        ret = self.pqos.lib.pqos_l3ca_get(socket, cos_num, num_ca_ref, l3cas)
        pqos_handle_error(u'pqos_l3ca_get', ret)

        coses = [l3ca.to_cos(self.COS) for l3ca in l3cas[:num_ca.value]]
        return coses
Beispiel #36
0
    def get(self, l2id):
        """
        Reads classes of service from a L2 ID.

        Parameters:
            l2id: L2 cache identifier
        """

        cap = PqosCap()
        cos_num = cap.get_l2ca_cos_num()

        l2cas = (CPqosL2Ca * cos_num)()
        num_ca = ctypes.c_uint(0)
        num_ca_ref = ctypes.byref(num_ca)
        ret = self.pqos.lib.pqos_l2ca_get(l2id, cos_num, num_ca_ref, l2cas)
        pqos_handle_error('pqos_l2ca_get', ret)

        coses = [l2ca.to_cos(self.COS) for l2ca in l2cas[:num_ca.value]]
        return coses
Beispiel #37
0
    def set(self, socket, requested):
        """
        Sets classes of service defined by requested configuration on a socket.

        Parameters:
            socket: socket ID
            requested: a list of PqosMba.COS objects that define requested MBA
                       configuration

        Returns:
            a list of PqosMba.COS object with actual MBA configuration
        """

        requested_coses = [CPqosMba.from_cos(req) for req in requested]
        num_cos = len(requested_coses)
        cos_arr = (CPqosMba * num_cos)(*requested_coses)
        actual_arr = (CPqosMba * num_cos)()

        ret = self.pqos.lib.pqos_mba_set(socket, num_cos, cos_arr, actual_arr)
        pqos_handle_error(u'pqos_mba_set', ret)

        actual = [cos.to_cos(self.COS) for cos in actual_arr]
        return actual
Beispiel #38
0
    def start_pids(self, pids, events, context=None):
        """
        Starts resource monitoring of a selected processes.

        Parameters:
            pids: a list of process IDs
            events: a list of events, available options: 'l3_occup', 'lmem_bw',
                    'tmem_bw', 'rmem_bw', 'perf_llc_miss', 'perf_ipc'
            context: a pointer to additional information, by default None

        Returns:
            CPqosMonData monitoring data
        """

        group = CPqosMonData()
        group_ref = group.get_ref()
        num_pids = len(pids)
        pids_arr = (ctypes.c_uint * num_pids)(*pids)
        event = _get_event_mask(events)
        ret = self.pqos.lib.pqos_mon_start_pids(num_pids, pids_arr, event,
                                                context, group_ref)
        pqos_handle_error('pqos_mon_start_pids', ret)
        return group
Beispiel #39
0
    def set(self, socket, requested):
        """
        Sets classes of service defined by requested configuration on a socket.

        Parameters:
            socket: socket ID
            requested: a list of PqosMba.COS objects that define requested MBA
                       configuration

        Returns:
            a list of PqosMba.COS object with actual MBA configuration
        """

        requested_coses = [CPqosMba.from_cos(req) for req in requested]
        num_cos = len(requested_coses)
        cos_arr = (CPqosMba * num_cos)(*requested_coses)
        actual_arr = (CPqosMba * num_cos)()

        ret = self.pqos.lib.pqos_mba_set(socket, num_cos, cos_arr, actual_arr)
        pqos_handle_error(u'pqos_mba_set', ret)

        actual = [cos.to_cos(self.COS) for cos in actual_arr]
        return actual
Beispiel #40
0
    def start(self, cores, events, context=None):
        """
        Starts resource monitoring on selected group of cores.

        Parameters:
            cores: a list of core IDs
            events: a list of events, available options: 'l3_occup', 'lmem_bw',
                    'tmem_bw', 'rmem_bw', 'perf_llc_miss', 'perf_ipc'
            context: a pointer to additional information, by defualt None

        Returns:
            CPqosMonData monitoring data
        """

        group = CPqosMonData()
        group_ref = group.get_ref()
        num_cores = len(cores)
        cores_arr = (ctypes.c_uint * num_cores)(*cores)
        event = _get_event_mask(events)
        ret = self.pqos.lib.pqos_mon_start(num_cores, cores_arr, event,
                                           context, group_ref)
        pqos_handle_error(u'pqos_mon_start', ret)
        return group
Beispiel #41
0
    def reset(self, l3_cdp_cfg, l2_cdp_cfg, mba_cfg):
        """
        Resets configuration of allocation technologies.

        Reverts CAT/MBA state to the one after reset:
        - all cores associated with COS0
        - all COS are set to give access to entire resource

        As part of allocation reset CDP and MBA reconfiguration
        can be performed.

        Parameters:
            l3_cdp_cfg: L3 CAT CDP configuration
            l2_cdp_cfg: L2 CAT CDP configuration
            mba_cfg: MBA configuration
        """

        l3_cdp_cfg_enum = _get_cdp_config(l3_cdp_cfg)
        l2_cdp_cfg_enum = _get_cdp_config(l2_cdp_cfg)
        mba_cfg_enum = _get_mba_config(mba_cfg)

        ret = self.pqos.lib.pqos_alloc_reset(l3_cdp_cfg_enum, l2_cdp_cfg_enum,
                                             mba_cfg_enum)
        pqos_handle_error(u'pqos_alloc_reset', ret)
Beispiel #42
0
    def get(self, socket):
        """
        Reads MBA configuration for a socket.

        Parameters:
            socket: socket ID

        Returns:
            a list of PqosMba.COS object with actual MBA configuration
            for a given socket
        """

        cap = PqosCap()
        max_num_cos = cap.get_mba_cos_num()

        num_cos = ctypes.c_uint(0)
        cos_arr = (CPqosMba * max_num_cos)()

        ret = self.pqos.lib.pqos_mba_get(socket, max_num_cos,
                                         ctypes.byref(num_cos), cos_arr)
        pqos_handle_error(u'pqos_mba_get', ret)

        coses = [cos_arr[i].to_cos(self.COS) for i in range(num_cos.value)]
        return coses
Beispiel #43
0
    def reset(self, l3_cdp_cfg, l2_cdp_cfg, mba_cfg):
        """
        Resets configuration of allocation technologies.

        Reverts CAT/MBA state to the one after reset:
        - all cores associated with COS0
        - all COS are set to give access to entire resource

        As part of allocation reset CDP and MBA reconfiguration
        can be performed.

        Parameters:
            l3_cdp_cfg: L3 CAT CDP configuration
            l2_cdp_cfg: L2 CAT CDP configuration
            mba_cfg: MBA configuration
        """

        l3_cdp_cfg_enum = _get_cdp_config(l3_cdp_cfg)
        l2_cdp_cfg_enum = _get_cdp_config(l2_cdp_cfg)
        mba_cfg_enum = _get_mba_config(mba_cfg)

        ret = self.pqos.lib.pqos_alloc_reset(l3_cdp_cfg_enum, l2_cdp_cfg_enum,
                                             mba_cfg_enum)
        pqos_handle_error('pqos_alloc_reset', ret)
Beispiel #44
0
    def get(self, socket):
        """
        Reads MBA configuration for a socket.

        Parameters:
            socket: socket ID

        Returns:
            a list of PqosMba.COS object with actual MBA configuration
            for a given socket
        """

        cap = PqosCap()
        max_num_cos = cap.get_mba_cos_num()

        num_cos = ctypes.c_uint(0)
        cos_arr = (CPqosMba * max_num_cos)()

        ret = self.pqos.lib.pqos_mba_get(socket, max_num_cos,
                                         ctypes.byref(num_cos), cos_arr)
        pqos_handle_error(u'pqos_mba_get', ret)

        coses = [cos_arr[i].to_cos(self.COS) for i in range(num_cos.value)]
        return coses
Beispiel #45
0
    def fini(self):
        "Finalizes PQoS library."

        ret = self.lib.pqos_fini()
        pqos_handle_error(u'pqos_fini', ret)
Beispiel #46
0
    def __init__(self):
        self.pqos = Pqos()

        self.p_cpu = ctypes.POINTER(CPqosCpuInfo)()
        ret = self.pqos.lib.pqos_cap_get(None, ctypes.byref(self.p_cpu))
        pqos_handle_error(u'pqos_cap_get', ret)