Example #1
0
def node_to_cpus(node: int) -> List[int]:
    cpu_mask = LIBNUMA.numa_allocate_cpumask()
    LIBNUMA.numa_bitmask_clearall(cpu_mask)
    res = LIBNUMA.numa_node_to_cpus(node, cpu_mask)
    if res == 0:
        return numa_utils.get_bitset_list(cpu_mask)
    else:
        return []
Example #2
0
def get_affinitive_cpus(pid: int) -> List[int]:
    cpu_mask = LIBNUMA.numa_allocate_cpumask()
    LIBNUMA.numa_bitmask_clearall(cpu_mask)
    LIBNUMA.numa_sched_getaffinity(pid, cpu_mask)
    return numa_utils.get_bitset_list(cpu_mask)