Embedded Multicore Building Blocks V1.0.0
|
Core sets for thread-to-core affinities. More...
Typedefs | |
typedef opaque_type | embb_core_set_t |
Opaque type representing a set of processor cores. More... | |
Functions | |
unsigned int | embb_core_count_available () |
Returns the number of available processor cores. More... | |
void | embb_core_set_init (embb_core_set_t *core_set, int initializer) |
Initializes the specified core set. More... | |
void | embb_core_set_add (embb_core_set_t *core_set, unsigned int core_number) |
Adds a core to the specified set. More... | |
void | embb_core_set_remove (embb_core_set_t *core_set, unsigned int core_number) |
Removes a core from the specified set. More... | |
int | embb_core_set_contains (const embb_core_set_t *core_set, unsigned int core_number) |
Determines whether a core is contained in the specified set. More... | |
void | embb_core_set_intersection (embb_core_set_t *set1, const embb_core_set_t *set2) |
Computes the intersection of core set1 and set2 . More... | |
void | embb_core_set_union (embb_core_set_t *set1, const embb_core_set_t *set2) |
Computes the union of core set1 and set2 . More... | |
unsigned int | embb_core_set_count (const embb_core_set_t *core_set) |
Returns the number of cores contained in the specified set. More... | |
Core sets for thread-to-core affinities.
typedef opaque_type embb_core_set_t |
Opaque type representing a set of processor cores.
An instance of this type represents a subset of processor cores. Core sets can be used to set thread-to-core affinities. A core in a core set might just represent a logical core (hyper-thread), depending on the underlying hardware. Each core is identified by a unique integer starting with 0. For example, the cores of a quad-core system are represented by the set {0,1,2,3}.
unsigned int embb_core_count_available | ( | ) |
Returns the number of available processor cores.
If the processor supports hyper-threading, each hyper-thread is treated as a separate processor core.
void embb_core_set_init | ( | embb_core_set_t * | core_set, |
int | initializer | ||
) |
Initializes the specified core set.
The second parameter specifies whether the set is initially empty or contains all cores.
core_set
is not NULL.[out] | core_set | Core set to initialize |
[in] | initializer | The set is initially empty if initializer == 0, otherwise it contains all available processor cores. |
void embb_core_set_add | ( | embb_core_set_t * | core_set, |
unsigned int | core_number | ||
) |
Adds a core to the specified set.
If the core is already contained in the set, the operation has no effect.
core_set
is not NULL and core_number
is smaller than embb_core_count_available().[in,out] | core_set | Core set to be manipulated |
[in] | core_number | Number of core to be added. |
void embb_core_set_remove | ( | embb_core_set_t * | core_set, |
unsigned int | core_number | ||
) |
Removes a core from the specified set.
If the core is not in the set, the operation has no effect.
core_set
is not NULL and core_number
is smaller than embb_core_count_available().[in,out] | core_set | Core set to be manipulated |
[in] | core_number | Number of core to be removed |
int embb_core_set_contains | ( | const embb_core_set_t * | core_set, |
unsigned int | core_number | ||
) |
Determines whether a core is contained in the specified set.
core_set
is not NULL and core_number
is smaller than embb_core_count_available().[in] | core_set | Core set |
[in] | core_number | Number of core |
void embb_core_set_intersection | ( | embb_core_set_t * | set1, |
const embb_core_set_t * | set2 | ||
) |
Computes the intersection of core set1
and set2
.
The result is stored in set1
.
set1
and set2
are not NULL.[in,out] | set1 | First set, gets overwritten by the result |
[in] | set2 | Second set |
void embb_core_set_union | ( | embb_core_set_t * | set1, |
const embb_core_set_t * | set2 | ||
) |
Computes the union of core set1
and set2
.
The result is stored in set1
.
set1
and set2
are not NULL.[in,out] | set1 | First set |
[in] | set2 | Second set |
unsigned int embb_core_set_count | ( | const embb_core_set_t * | core_set | ) |
Returns the number of cores contained in the specified set.
core_set
is not NULL.core_set
[in] | core_set | Core set whose elements are counted |