Exemplo n.º 1
0
def get_affinitive_nodes() -> List[int]:
    result_mask_pointer = LIBNUMA.numa_get_run_node_mask()
    try:
        result_mask_pointer.contents
    except ValueError:
        raise Exception(f"get run nodes info failed")
    return numa_utils.get_bitset_list(result_mask_pointer)
Exemplo n.º 2
0
def get_allocation_allowed_nodes() -> List[int]:
    result_nodes_pointer = LIBNUMA.numa_get_mems_allowed()
    try:
        result_nodes_pointer.contents
    except ValueError:
        raise Exception(f"get allocation allowed nodes info failed")
    return numa_utils.get_bitset_list(result_nodes_pointer)
Exemplo n.º 3
0
def get_interleave_nodes() -> List[int]:
    result_nodes_pointer = LIBNUMA.numa_get_interleave_mask()
    try:
        result_nodes_pointer.contents
    except ValueError:
        raise Exception(f"get interleave nodes info failed")
    return numa_utils.get_bitset_list(result_nodes_pointer)
Exemplo n.º 4
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 []
Exemplo n.º 5
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)