Data Structures | |
struct | topo_cpuset_t |
Set of CPUs represented as a bitmask. More... | |
Defines | |
#define | TOPO_CPUSET_ZERO (topo_cpuset_t){ .s[0 ... TOPO_CPUSUBSET_COUNT-1] = TOPO_CPUSUBSET_ZERO } |
Predefined cpuset with no CPU set. | |
#define | TOPO_CPUSET_FULL (topo_cpuset_t){ .s[0 ... TOPO_CPUSUBSET_COUNT-1] = TOPO_CPUSUBSET_FULL } |
Predefined cpuset with all CPUs set. | |
#define | TOPO_CPUSET_CPU(cpu) ({ topo_cpuset_t __set = TOPO_CPUSET_ZERO; TOPO_CPUSUBSET_CPUSUBSET(__set,cpu) = TOPO_CPUSUBSET_VAL(cpu); __set; }) |
Predefined cpuset with CPU cpu set. | |
#define | TOPO_CPUSET_STRING_LENGTH (TOPO_CPUSET_SUBSTRING_COUNT*(TOPO_CPUSET_SUBSTRING_LENGTH+1)) |
Maximal required length of a string for printing a CPU set. | |
#define | TOPO_PRIxCPUSET "s" |
Printf format for printing a CPU set. | |
#define | topo_cpuset_foreach_begin(cpu, set) |
Loop macro iterating on CPU set set . | |
#define | topo_cpuset_foreach_end() } |
End of loop. | |
Functions | |
static __inline__ int | topo_cpuset_snprintf (char *__topo_restrict buf, size_t buflen, const topo_cpuset_t *__topo_restrict set) |
Stringify a cpuset. | |
static __inline__ void | topo_cpuset_from_string (const char *__topo_restrict string, topo_cpuset_t *__topo_restrict set) |
Parse a cpuset string. | |
static __inline__ void | topo_cpuset_zero (topo_cpuset_t *set) |
Primitives & macros for building, modifying and consulting "sets" of cpus. | |
static __inline__ void | topo_cpuset_fill (topo_cpuset_t *set) |
Fill CPU set set . | |
static __inline__ void | topo_cpuset_from_ulong (topo_cpuset_t *set, unsigned long mask) |
Setup CPU set set from unsigned long mask . | |
static __inline__ void | topo_cpuset_from_ith_ulong (topo_cpuset_t *set, int i, unsigned long mask) |
Setup CPU set set from unsigned long mask used as i -th subset. | |
static __inline__ unsigned long | topo_cpuset_to_ulong (const topo_cpuset_t *set) |
Convert the beginning part of CPU set set into unsigned long mask . | |
static __inline__ unsigned long | topo_cpuset_to_ith_ulong (const topo_cpuset_t *set, int i) |
Convert the i -th subset of CPU set set into unsigned long mask. | |
static __inline__ void | topo_cpuset_cpu (topo_cpuset_t *set, unsigned cpu) |
Clear CPU set set and set CPU cpu . | |
static __inline__ void | topo_cpuset_all_but_cpu (topo_cpuset_t *set, unsigned cpu) |
Clear CPU set set and set all but the CPU cpu . | |
static __inline__ void | topo_cpuset_set (topo_cpuset_t *set, unsigned cpu) |
Add CPU cpu in CPU set set . | |
static __inline__ void | topo_cpuset_set_range (topo_cpuset_t *set, unsigned begincpu, unsigned endcpu) |
Add CPUs from begincpu to endcpu in CPU set set . | |
static __inline__ void | topo_cpuset_clr (topo_cpuset_t *set, unsigned cpu) |
Remove CPU cpu from CPU set set . | |
static __inline__ int | topo_cpuset_isset (const topo_cpuset_t *set, unsigned cpu) |
Test whether CPU cpu is part of set set . | |
static __inline__ int | topo_cpuset_iszero (const topo_cpuset_t *set) |
Test whether set set is zero. | |
static __inline__ int | topo_cpuset_isfull (const topo_cpuset_t *set) |
Test whether set set is full. | |
static __inline__ int | topo_cpuset_isequal (const topo_cpuset_t *set1, const topo_cpuset_t *set2) |
Test whether set set1 is equal to set set2 . | |
static __inline__ int | topo_cpuset_intersects (const topo_cpuset_t *set1, const topo_cpuset_t *set2) |
Test whether sets set1 and set2 intersects. | |
static __inline__ int | topo_cpuset_isincluded (const topo_cpuset_t *sub_set, const topo_cpuset_t *super_set) |
Test whether set sub_set is part of set super_set . | |
static __inline__ void | topo_cpuset_orset (topo_cpuset_t *set, const topo_cpuset_t *modifier_set) |
Or set modifier_set into set set . | |
static __inline__ void | topo_cpuset_andset (topo_cpuset_t *set, const topo_cpuset_t *modifier_set) |
And set modifier_set into set set . | |
static __inline__ void | topo_cpuset_clearset (topo_cpuset_t *set, const topo_cpuset_t *modifier_set) |
Clear set modifier_set out of set set . | |
static __inline__ void | topo_cpuset_xorset (topo_cpuset_t *set, const topo_cpuset_t *modifier_set) |
Xor set set with set modifier_set . | |
static __inline__ int | topo_cpuset_first (const topo_cpuset_t *cpuset) |
Compute the first CPU (least significant bit) in CPU set set . | |
static __inline__ void | topo_cpuset_singlify (topo_cpuset_t *set) |
Keep a single CPU among those set in CPU set set . | |
static __inline__ int | topo_cpuset_compar_first (const topo_cpuset_t *set1, const topo_cpuset_t *set2) |
Compar CPU sets set1 and set2 using their first set bit. | |
static __inline__ int | topo_cpuset_compar (const topo_cpuset_t *set1, const topo_cpuset_t *set2) |
Compar CPU sets set1 and set2 using their last bits. | |
static __inline__ int | topo_cpuset_weight (const topo_cpuset_t *set) |
Compute the weight of CPU set set . |
#define TOPO_CPUSET_CPU | ( | cpu | ) | ({ topo_cpuset_t __set = TOPO_CPUSET_ZERO; TOPO_CPUSUBSET_CPUSUBSET(__set,cpu) = TOPO_CPUSUBSET_VAL(cpu); __set; }) |
Predefined cpuset with CPU cpu
set.
#define topo_cpuset_foreach_begin | ( | cpu, | |||
set | ) |
Value:
for (cpu = 0; cpu < TOPO_NBMAXCPUS; cpu++) \ if (topo_cpuset_isset(set, cpu)) {
set
.
It yields on each cpu that is member of the set. It uses variables set
(the cpu set) and cpu
(the loop variable)
#define topo_cpuset_foreach_end | ( | ) | } |
#define TOPO_CPUSET_FULL (topo_cpuset_t){ .s[0 ... TOPO_CPUSUBSET_COUNT-1] = TOPO_CPUSUBSET_FULL } |
Predefined cpuset with all CPUs set.
#define TOPO_CPUSET_STRING_LENGTH (TOPO_CPUSET_SUBSTRING_COUNT*(TOPO_CPUSET_SUBSTRING_LENGTH+1)) |
Maximal required length of a string for printing a CPU set.
Fewer characters may be needed if part of the CPU set is empty.
#define TOPO_CPUSET_ZERO (topo_cpuset_t){ .s[0 ... TOPO_CPUSUBSET_COUNT-1] = TOPO_CPUSUBSET_ZERO } |
Predefined cpuset with no CPU set.
#define TOPO_PRIxCPUSET "s" |
Printf format for printing a CPU set.
static __inline__ void topo_cpuset_all_but_cpu | ( | topo_cpuset_t * | set, | |
unsigned | cpu | |||
) | [static] |
Clear CPU set set
and set all but the CPU cpu
.
static __inline__ void topo_cpuset_andset | ( | topo_cpuset_t * | set, | |
const topo_cpuset_t * | modifier_set | |||
) | [static] |
And set modifier_set
into set set
.
static __inline__ void topo_cpuset_clearset | ( | topo_cpuset_t * | set, | |
const topo_cpuset_t * | modifier_set | |||
) | [static] |
Clear set modifier_set
out of set set
.
static __inline__ void topo_cpuset_clr | ( | topo_cpuset_t * | set, | |
unsigned | cpu | |||
) | [static] |
Remove CPU cpu
from CPU set set
.
static __inline__ int topo_cpuset_compar | ( | const topo_cpuset_t * | set1, | |
const topo_cpuset_t * | set2 | |||
) | [static] |
Compar CPU sets set1
and set2
using their last bits.
Higher most significant bit is higher. The empty CPU set is considered lower than anything.
static __inline__ int topo_cpuset_compar_first | ( | const topo_cpuset_t * | set1, | |
const topo_cpuset_t * | set2 | |||
) | [static] |
Compar CPU sets set1
and set2
using their first set bit.
Smaller least significant bit is smaller. The empty CPU set is considered higher than anything.
static __inline__ void topo_cpuset_cpu | ( | topo_cpuset_t * | set, | |
unsigned | cpu | |||
) | [static] |
Clear CPU set set
and set CPU cpu
.
static __inline__ void topo_cpuset_fill | ( | topo_cpuset_t * | set | ) | [static] |
Fill CPU set set
.
static __inline__ int topo_cpuset_first | ( | const topo_cpuset_t * | cpuset | ) | [static] |
Compute the first CPU (least significant bit) in CPU set set
.
static __inline__ void topo_cpuset_from_ith_ulong | ( | topo_cpuset_t * | set, | |
int | i, | |||
unsigned long | mask | |||
) | [static] |
Setup CPU set set
from unsigned long mask
used as i
-th subset.
static __inline__ void topo_cpuset_from_string | ( | const char *__topo_restrict | string, | |
topo_cpuset_t *__topo_restrict | set | |||
) | [static] |
Parse a cpuset string.
Must start and end with a digit.
static __inline__ void topo_cpuset_from_ulong | ( | topo_cpuset_t * | set, | |
unsigned long | mask | |||
) | [static] |
Setup CPU set set
from unsigned long mask
.
static __inline__ int topo_cpuset_intersects | ( | const topo_cpuset_t * | set1, | |
const topo_cpuset_t * | set2 | |||
) | [static] |
Test whether sets set1
and set2
intersects.
static __inline__ int topo_cpuset_isequal | ( | const topo_cpuset_t * | set1, | |
const topo_cpuset_t * | set2 | |||
) | [static] |
Test whether set set1
is equal to set set2
.
static __inline__ int topo_cpuset_isfull | ( | const topo_cpuset_t * | set | ) | [static] |
Test whether set set
is full.
static __inline__ int topo_cpuset_isincluded | ( | const topo_cpuset_t * | sub_set, | |
const topo_cpuset_t * | super_set | |||
) | [static] |
Test whether set sub_set
is part of set super_set
.
static __inline__ int topo_cpuset_isset | ( | const topo_cpuset_t * | set, | |
unsigned | cpu | |||
) | [static] |
Test whether CPU cpu
is part of set set
.
static __inline__ int topo_cpuset_iszero | ( | const topo_cpuset_t * | set | ) | [static] |
Test whether set set
is zero.
static __inline__ void topo_cpuset_orset | ( | topo_cpuset_t * | set, | |
const topo_cpuset_t * | modifier_set | |||
) | [static] |
Or set modifier_set
into set set
.
static __inline__ void topo_cpuset_set | ( | topo_cpuset_t * | set, | |
unsigned | cpu | |||
) | [static] |
Add CPU cpu
in CPU set set
.
static __inline__ void topo_cpuset_set_range | ( | topo_cpuset_t * | set, | |
unsigned | begincpu, | |||
unsigned | endcpu | |||
) | [static] |
Add CPUs from begincpu
to endcpu
in CPU set set
.
static __inline__ void topo_cpuset_singlify | ( | topo_cpuset_t * | set | ) | [static] |
Keep a single CPU among those set in CPU set set
.
Might be used before binding so that the process does not have a chance of migrating between multiple logical CPUs in the original mask.
static __inline__ int topo_cpuset_snprintf | ( | char *__topo_restrict | buf, | |
size_t | buflen, | |||
const topo_cpuset_t *__topo_restrict | set | |||
) | [static] |
Stringify a cpuset.
Up to buflen
characters may be written in buffer buf
.
static __inline__ unsigned long topo_cpuset_to_ith_ulong | ( | const topo_cpuset_t * | set, | |
int | i | |||
) | [static] |
Convert the i
-th subset of CPU set set
into unsigned long mask.
static __inline__ unsigned long topo_cpuset_to_ulong | ( | const topo_cpuset_t * | set | ) | [static] |
Convert the beginning part of CPU set set
into unsigned long mask
.
static __inline__ int topo_cpuset_weight | ( | const topo_cpuset_t * | set | ) | [static] |
Compute the weight of CPU set set
.
static __inline__ void topo_cpuset_xorset | ( | topo_cpuset_t * | set, | |
const topo_cpuset_t * | modifier_set | |||
) | [static] |
Xor set set
with set modifier_set
.
static __inline__ void topo_cpuset_zero | ( | topo_cpuset_t * | set | ) | [static] |
Primitives & macros for building, modifying and consulting "sets" of cpus.
Empty CPU set set