Embedded Multicore Building Blocks V1.0.0
|
Represents a set of processor cores, used to set thread-to-core affinities. More...
#include <core_set.h>
Public Member Functions | |
CoreSet () | |
Constructs an empty core set. More... | |
CoreSet (bool value) | |
Constructs a core set with all or no cores. More... | |
CoreSet (const CoreSet &to_copy) | |
Constructs a copy of the specified core set. More... | |
CoreSet & | operator= (const CoreSet &to_assign) |
Assigns an existing core set. More... | |
void | Reset (bool value) |
Resets the core set according to the specified value. More... | |
void | Add (unsigned int core) |
Adds one core to the core set. More... | |
void | Remove (unsigned int core) |
Removes one core from the core set. More... | |
bool | IsContained (unsigned int core) const |
Checks whether the specified core is included in the set. More... | |
unsigned int | Count () const |
Counts the number of cores in the set. More... | |
CoreSet | operator& (const CoreSet &rhs) const |
Intersects this core set with the specified one. More... | |
CoreSet | operator| (const CoreSet &rhs) const |
Unites this core set with the specified one. More... | |
CoreSet & | operator&= (const CoreSet &rhs) |
Intersects this core set with the specified one and overwrites this core set. More... | |
CoreSet & | operator|= (const CoreSet &rhs) |
Unites this core set with the specified one an overwrites this core set. More... | |
embb_core_set_t const & | GetInternal () const |
Provides access to internal representation to use it with C API. More... | |
Static Public Member Functions | |
static unsigned int | CountAvailable () |
Returns the number of available processor cores. More... | |
Represents a set of processor cores, used to set thread-to-core affinities.
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}.
This class is essentially a wrapper for the underlying C implementation.
embb::base::CoreSet::CoreSet | ( | ) |
Constructs an empty core set.
|
explicit |
Constructs a core set with all or no cores.
[in] | value | true includes all cores in the set, false excludes all |
embb::base::CoreSet::CoreSet | ( | const CoreSet & | to_copy | ) |
Constructs a copy of the specified core set.
[in] | to_copy | Core set to copy |
|
static |
Returns the number of available processor cores.
If the processor supports hyper-threading, each hyper-thread is treated as a separate processor core.
Assigns an existing core set.
*this
[in] | to_assign | Core set to assign |
void embb::base::CoreSet::Reset | ( | bool | value | ) |
Resets the core set according to the specified value.
[in] | value | true includes all cores in the set, false excludes all |
void embb::base::CoreSet::Add | ( | unsigned int | core | ) |
Adds one core to the core set.
[in] | core | Core to add (from 0 to number of cores - 1) |
void embb::base::CoreSet::Remove | ( | unsigned int | core | ) |
Removes one core from the core set.
[in] | core | Core to remove (from 0 to number of cores - 1) |
bool embb::base::CoreSet::IsContained | ( | unsigned int | core | ) | const |
Checks whether the specified core is included in the set.
true
if core is included, otherwise false
[in] | core | Core to check (from 0 to number of cores - 1) |
unsigned int embb::base::CoreSet::Count | ( | ) | const |
Counts the number of cores in the set.
Intersects this core set with the specified one.
This core set is not modified by the operation.
[in] | rhs | Core set on right-hand side of intersection operation |
Unites this core set with the specified one.
This core set is not modified by the operation.
[in] | rhs | Core set on right-hand side of union operation |
Intersects this core set with the specified one and overwrites this core set.
*this
[in] | rhs | Core set on right-hand side of intersection operation |
Unites this core set with the specified one an overwrites this core set.
*this
[in] | rhs | Core set on right-hand side of union operation |
embb_core_set_t const& embb::base::CoreSet::GetInternal | ( | ) | const |
Provides access to internal representation to use it with C API.