Ocean
|
This class implements basic functions relating the system processor. More...
Public Member Functions | |
unsigned int | cores () const |
Returns the number of available processor cores. More... | |
ProcessorInstructions | instructions () |
Returns the supported instruction set of the processor. More... | |
bool | forceCores (const unsigned int cores) |
Forces a user defined number of processor cores. More... | |
bool | forceInstructions (const ProcessorInstructions instructions) |
Forces a user-defined processor instruction set. More... | |
Static Public Member Functions | |
static std::string | brand () |
Returns the processor's brand. More... | |
static unsigned int | realCores () |
Returns the number of available processor cores currently detectable. More... | |
static ProcessorInstructions | realInstructions () |
Returns the supported instruction set of the processor. More... | |
static std::string | translateInstructions (const ProcessorInstructions instructions) |
Translates a set of processor instructions to a readable string. More... | |
template<bool tIndependentOfBinary> | |
static ProcessorInstructions | bestInstructionGroup (const ProcessorInstructions instructions) |
Returns the best group of instructions value for a set of given processor instructions. More... | |
static bool | isLittleEndian () |
Returns whether the processor/system is using the little endian convention (like e.g., x86) or whether the big endian convention is used. More... | |
template<> | |
ProcessorInstructions | bestInstructionGroup (const ProcessorInstructions instructions) |
Static Public Member Functions inherited from Ocean::Singleton< Processor > | |
static Processor & | get () |
Returns a reference to the unique object. More... | |
Private Member Functions | |
Processor () | |
Constructs a new processor object. More... | |
Static Private Member Functions | |
static unsigned int | realCoresApple () |
Returns the number of available processor cores currently detectable. More... | |
static std::string | deviceModelAppleIOS () |
Returns the device name of the Apple iOS device. More... | |
static constexpr ProcessorInstructions | invalidProcessorInstructions () |
Returns invalid processor instructions. More... | |
Private Attributes | |
unsigned int | forcedCores_ = 0u |
Explicitly forced number of processor cores. More... | |
ProcessorInstructions | forcedProcessorInstructions_ = invalidProcessorInstructions() |
Explicitly forced CPU instructions. More... | |
ProcessorInstructions | processorInstructions_ = invalidProcessorInstructions() |
The real instructions of the processor. More... | |
Lock | lock_ |
The lock of the processor class. More... | |
Friends | |
class | Singleton< Processor > |
Additional Inherited Members | |
Protected Member Functions inherited from Ocean::Singleton< Processor > | |
Singleton ()=default | |
Default constructor. More... | |
This class implements basic functions relating the system processor.
|
private |
Constructs a new processor object.
|
inlinestatic |
Returns the best group of instructions value for a set of given processor instructions.
The function may return the following groups in the following order: PI_GROUP_AVX_2_SSE_4_1, PI_GROUP_SSE_4_1, PI_GROUP_AVX_2_SSE_2, PI_GROUP_AVX_2, PI_GROUP_SSE_2, PI_GROUP_NEON.
instructions | The set of instructions for which the best group will be returned |
tIndependentOfBinary | True, to return the best group without checking the binaries capabilities; False, to return groups which are supported by the current binary only |
|
inlinestatic |
|
static |
Returns the processor's brand.
|
inline |
Returns the number of available processor cores.
If an explicit number of processors has been forced by the user, the user defined number will be returned.
|
staticprivate |
Returns the device name of the Apple iOS device.
bool Ocean::Processor::forceCores | ( | const unsigned int | cores | ) |
bool Ocean::Processor::forceInstructions | ( | const ProcessorInstructions | instructions | ) |
Forces a user-defined processor instruction set.
The forced instruction set will be returned instead of the real instruction set using the instructions() function.
instructions | The instruction set to be forced, -1 to remove the previously forced instruction set |
|
inline |
Returns the supported instruction set of the processor.
If an explicit instruction set has been forced by the user, the user defined instruction set will be returned.
|
staticconstexprprivate |
Returns invalid processor instructions.
|
inlinestatic |
Returns whether the processor/system is using the little endian convention (like e.g., x86) or whether the big endian convention is used.
|
static |
Returns the number of available processor cores currently detectable.
|
staticprivate |
Returns the number of available processor cores currently detectable.
|
static |
Returns the supported instruction set of the processor.
|
static |
Translates a set of processor instructions to a readable string.
instructions | The instructions to be translated |
|
private |
Explicitly forced number of processor cores.
|
private |
Explicitly forced CPU instructions.
|
mutableprivate |
The lock of the processor class.
|
private |
The real instructions of the processor.