def __get_core_info():
    if core_id_to_package_id:
        return
    core_id = 0
    while True:
        try:
            pkg_i = file_get_int(sys_package_f % core_id)
        except:
            break
        core_id_to_package_id[core_id] = pkg_i
        core_id_to_thread_siblings[core_id] = \
          mask.comma_sep_hex_to_int(file_get_strip(sys_thread_sibs_f %
                                                   core_id))
        core_id_to_core_siblings[core_id] = \
          mask.comma_sep_hex_to_int(file_get_strip(sys_core_sibs_f % core_id))
        core_id += 1
示例#2
0
def __get_core_info():
    if core_id_to_package_id:
        return
    core_id = 0
    while True:
        try:
            pkg_i = file_get_int(sys_package_f % core_id)
        except:
            break
        core_id_to_package_id[core_id] = pkg_i
        core_id_to_thread_siblings[core_id] = \
          mask.comma_sep_hex_to_int(file_get_strip(sys_thread_sibs_f %
                                                   core_id))
        core_id_to_core_siblings[core_id] = \
          mask.comma_sep_hex_to_int(file_get_strip(sys_core_sibs_f % core_id))
        core_id += 1
示例#3
0
def get_local_cores(ethname):
    """Return a list of cores which are NUMA-local to the specified NIC"""
    try:
        cpumask = file_get_strip(sys_ethname_local_cpus_f % ethname)
    except:
        cpumask = '0'  # in case kernel doesn't support local_cpus return no cores
    cpumask = mask.comma_sep_hex_to_int(cpumask)
    cpulist = mask.to_int_list(cpumask)
    return cpulist
示例#4
0
def __get_cache_info():
    global shared_caches, core_id_to_package_id
    if shared_caches:
        return
    if not core_id_to_package_id:
        __get_core_info()
    shared_caches = set()
    for core_id in core_id_to_package_id.keys():
        for index in range(0, 100):
            try:
                cpumask = file_get_strip(sys_cache_cpu_map_f % (core_id,index))
            except:
                break
            cpumask = mask.comma_sep_hex_to_int(cpumask)
            cpulist = mask.to_int_list(cpumask)
            if len(cpulist) > 1:
                level = file_get_int(sys_cache_level_f % (core_id, index))
                cpumask = mask.to_int(cpumask)
                c = (level, cpumask)
                shared_caches.add(c)
def __get_cache_info():
    global shared_caches, core_id_to_package_id
    if shared_caches:
        return
    if not core_id_to_package_id:
        __get_core_info()
    shared_caches = set()
    for core_id in core_id_to_package_id.keys():
        for index in range(0, 100):
            try:
                cpumask = file_get_strip(sys_cache_cpu_map_f %
                                         (core_id, index))
            except:
                break
            cpumask = mask.comma_sep_hex_to_int(cpumask)
            cpulist = mask.to_int_list(cpumask)
            if len(cpulist) > 1:
                level = file_get_int(sys_cache_level_f % (core_id, index))
                cpumask = mask.to_int(cpumask)
                c = (level, cpumask)
                shared_caches.add(c)