Ocean
Ocean::System::Process Class Reference

This class implements basic functions related with the application process. More...

Inheritance diagram for Ocean::System::Process:

Public Types

enum  ProcessPriority {
  PRIORITY_IDLE , PRIORITY_BELOW_NORMAL , PRIORITY_NORMAL , PRIORITY_ABOVE_NORMAL ,
  PRIORITY_HIGH , PRIORITY_REALTIME
}
 Definition of different process priority values. More...
 

Public Member Functions

float currentProcessorLoad () const
 Returns the processor load since the last call to this function. More...
 
float averageProcessorLoad () const
 Returns the average processor load of this process since the creation. More...
 

Static Public Member Functions

static double entireProcessorTime ()
 Returns the entire processor time of this process since the creation. More...
 
static double entireProcessLiveTime ()
 Returns the live time of this process since the creation. More...
 
static long long processStartTime ()
 Returns the start time of this process since 01.01.1970 00:00:00 in UTC time. More...
 
static ProcessPriority priority ()
 Returns the priority of the process. More...
 
static bool setPriority (const ProcessPriority priority)
 Sets the priority of the process. More...
 
static unsigned int currentProcessId ()
 Returns the process id of the current (calling) process. More...
 
- Static Public Member Functions inherited from Ocean::Singleton< Process >
static Process & get ()
 Returns a reference to the unique object. More...
 

Private Member Functions

 Process ()
 Creates a new process object. More...
 

Private Attributes

int64_t loadTimestamp_ = 0ll
 Time of most recent processor load request. More...
 
int64_t loadTime_ = 0ll
 Processor user time of most recent processor load request. More...
 
const unsigned int numberCores_ = 0u
 Number of real CPU cores available in this system. More...
 

Friends

class Singleton< Process >
 

Additional Inherited Members

- Protected Member Functions inherited from Ocean::Singleton< Process >
 Singleton ()=default
 Default constructor. More...
 

Detailed Description

This class implements basic functions related with the application process.

Member Enumeration Documentation

◆ ProcessPriority

Definition of different process priority values.

Enumerator
PRIORITY_IDLE 

The process runs if the system is idle.

PRIORITY_BELOW_NORMAL 

The process has a priority below normal.

PRIORITY_NORMAL 

The process has a normal priority.

PRIORITY_ABOVE_NORMAL 

The process has a priority above normal.

PRIORITY_HIGH 

The process has a high priority.

PRIORITY_REALTIME 

The process has a realtime priority.

Constructor & Destructor Documentation

◆ Process()

Ocean::System::Process::Process ( )
private

Creates a new process object.

As this class is a singleton get access to this object by the singleton.

Member Function Documentation

◆ averageProcessorLoad()

float Ocean::System::Process::averageProcessorLoad ( ) const

Returns the average processor load of this process since the creation.

Returns
Average processor load in percent, with range [0.0, 1.0]

◆ currentProcessId()

static unsigned int Ocean::System::Process::currentProcessId ( )
static

Returns the process id of the current (calling) process.

Returns
The process id of the current process

◆ currentProcessorLoad()

float Ocean::System::Process::currentProcessorLoad ( ) const

Returns the processor load since the last call to this function.

Returns
Current processor load in percent, with range [0.0, 1.0]

◆ entireProcessLiveTime()

static double Ocean::System::Process::entireProcessLiveTime ( )
static

Returns the live time of this process since the creation.

Returns
Live time in seconds

◆ entireProcessorTime()

static double Ocean::System::Process::entireProcessorTime ( )
static

Returns the entire processor time of this process since the creation.

Returns
Entire processor time in seconds

◆ priority()

static ProcessPriority Ocean::System::Process::priority ( )
static

Returns the priority of the process.

Returns
Process priority
Exceptions
NotSupportedExceptionIs thrown if this function is not supported

◆ processStartTime()

static long long Ocean::System::Process::processStartTime ( )
static

Returns the start time of this process since 01.01.1970 00:00:00 in UTC time.

Returns
Start time in microseconds

◆ setPriority()

static bool Ocean::System::Process::setPriority ( const ProcessPriority  priority)
static

Sets the priority of the process.

Parameters
priorityProcess priority to set
Returns
True, if succeeded

Friends And Related Function Documentation

◆ Singleton< Process >

friend class Singleton< Process >
friend

Field Documentation

◆ loadTime_

int64_t Ocean::System::Process::loadTime_ = 0ll
mutableprivate

Processor user time of most recent processor load request.

◆ loadTimestamp_

int64_t Ocean::System::Process::loadTimestamp_ = 0ll
mutableprivate

Time of most recent processor load request.

◆ numberCores_

const unsigned int Ocean::System::Process::numberCores_ = 0u
private

Number of real CPU cores available in this system.


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