Skip to content

Replace sysconf() with sched_getaffinity() #72

@vitalyvch

Description

@vitalyvch

replace sysconf() with sched_getaffinity(). It allows to ignore non-actual CPUs.

example:

//...
cpu_set_t set;

sched_getaffinity(0, sizeof(cpu_set_t), &set)

long cpu_qty = CPU_COUNT(&set);
//...

Existing solution will have problems with off-line CPUs, and CPUs in PWR-OFF C-state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions