Ocean
Loading...
Searching...
No Matches
Ocean::Platform::Android::Processor Class Reference

This class implements processor functions. More...

#include <Processor.h>

Public Types

using Frequency = unsigned int
 Definition of a processor operation frequency.
 

Static Public Member Functions

static constexpr Frequency invalidFrequency ()
 Returns an invalid frequency.
 
static unsigned int installedCores ()
 Returns the number of installed CPU cores.
 
static Frequency currentFrequency (const unsigned int core=0u)
 Returns the current operation frequency of a specified core.
 
static Frequency maxFrequency (const unsigned int core=0u)
 Returns the maximal operation frequency of a specified core.
 
static Frequency minFrequency (const unsigned int core=0u)
 Returns the minimal operation frequency of a specified core.
 
static bool currentThreadAffinity (uint32_t &cpuMask)
 Returns the CPU affinity of the current thread.
 
static bool setCurrentThreadAffinity (const uint32_t cpuMask)
 Sets the CPU affinity of the current thread.
 
static bool setCurrentThreadAffinity (const unsigned int firstCPU, const unsigned int lastCPU)
 Sets the CPU affinity of the current thread.
 

Detailed Description

This class implements processor functions.

Member Typedef Documentation

◆ Frequency

Definition of a processor operation frequency.

Member Function Documentation

◆ currentFrequency()

static Frequency Ocean::Platform::Android::Processor::currentFrequency ( const unsigned int  core = 0u)
static

Returns the current operation frequency of a specified core.

Parameters
coreThe core to return the current frequency for
Returns
Frequency in kHz otherwise invalidFrequency

◆ currentThreadAffinity()

static bool Ocean::Platform::Android::Processor::currentThreadAffinity ( uint32_t &  cpuMask)
static

Returns the CPU affinity of the current thread.

The affinity defines on which CPU cores the thread is allowed to run.

Parameters
cpuMaskThe affinity mask, each bit is associated with the corresponding CPU
Returns
True, if succeeded

◆ installedCores()

static unsigned int Ocean::Platform::Android::Processor::installedCores ( )
static

Returns the number of installed CPU cores.

Returns
Number of installed CPU cores, 0 if the number could not be determined

◆ invalidFrequency()

constexpr Processor::Frequency Ocean::Platform::Android::Processor::invalidFrequency ( )
staticconstexpr

Returns an invalid frequency.

◆ maxFrequency()

static Frequency Ocean::Platform::Android::Processor::maxFrequency ( const unsigned int  core = 0u)
static

Returns the maximal operation frequency of a specified core.

Parameters
coreThe core to return the maximal frequency for
Returns
Frequency in kHz otherwise invalidFrequency

◆ minFrequency()

static Frequency Ocean::Platform::Android::Processor::minFrequency ( const unsigned int  core = 0u)
static

Returns the minimal operation frequency of a specified core.

Parameters
coreThe core to return the minimal frequency for
Returns
Frequency in kHz otherwise invalidFrequency

◆ setCurrentThreadAffinity() [1/2]

static bool Ocean::Platform::Android::Processor::setCurrentThreadAffinity ( const uint32_t  cpuMask)
static

Sets the CPU affinity of the current thread.

The affinity defines on which CPU cores the thread is allowed to run.
Beware: Depending on the Android device, setting CPU affinity may not be allowed, or may be restricted to a subset of all cores.

Parameters
cpuMaskThe affinity mask, each bit is associated with the corresponding CPU
Returns
True, if succeeded

◆ setCurrentThreadAffinity() [2/2]

static bool Ocean::Platform::Android::Processor::setCurrentThreadAffinity ( const unsigned int  firstCPU,
const unsigned int  lastCPU 
)
static

Sets the CPU affinity of the current thread.

The affinity defines on which CPU cores the thread is allowed to run.
This function allows to specify a range of CPUs (not a mask). Beware: Depending on the Android device, setting CPU affinity may not be allowed, or may be restricted to a subset of all cores.

Parameters
firstCPUThe index of the first CPU to set, with range [0, 31]
lastCPUThe index of the last (including) CPU to set, with range [firstCPU, 31]
Returns
True, if succeeded

The documentation for this class was generated from the following file: