NUMA++ 0.11.0
Loading...
Searching...
No Matches
numapp::DynamicScheduler Class Reference

Normal non-realtime scheduler that use dynamic priority (nice value). More...

#include <numapp/scheduler.hpp>

Public Types

enum class  Policy : int { Other = SCHED_OTHER , Batch = SCHED_BATCH }
 Sheduler policy. More...
 

Public Member Functions

 DynamicScheduler (Policy policy=Policy::Other, int nice=0)
 
std::error_code SetNice (int value) noexcept
 Set dynamic nice value (dynamic priority) of thread.
 
std::error_code SetPolicy (Policy policy) noexcept
 Set policy.
 
int GetNice () const noexcept
 Get dynamic nice value.
 
constexpr Policy GetPolicy () const noexcept
 

Related Symbols

(Note that these are not member symbols.)

std::ostream & operator<< (std::ostream &os, DynamicScheduler const &scheduler)
 Formats scheduler and inserts it to os.
 
std::ostream & operator<< (std::ostream &os, DynamicScheduler const &policy)
 Formats policy and inserts it to os.
 
Apply Scheduler to Specified Thread

Applies scheduler to specified thread.

std::error_code Apply (pid_t thread, DynamicScheduler const &scheduler) noexcept
 Apply dynamic scheduler to specified thread.
 
Apply Scheduler to Current Thread

Applies specified scheduler to current thread.

std::error_code Apply (DynamicScheduler const &scheduler) noexcept
 Apply dynamic scheduler to this thread.
 

Detailed Description

Normal non-realtime scheduler that use dynamic priority (nice value).

Note
The "nice" value is a type of inverse dynamic scheduling priority where lower values (less nice) have higher priority.

To apply a lower value requires CAP_SYS_NICE privilege.

Related man-page(s):

Definition at line 326 of file scheduler.hpp.

Member Enumeration Documentation

◆ Policy

enum class numapp::DynamicScheduler::Policy : int
strong

Sheduler policy.

Enumerator
Other 

The standard round-robin time-sharing policy.

This is referred to as SCHED_NORMAL in the kernel.

Batch 

For "batch" style execution of processes.

Definition at line 331 of file scheduler.hpp.

Constructor & Destructor Documentation

◆ DynamicScheduler()

numapp::DynamicScheduler::DynamicScheduler ( Policy policy = Policy::Other,
int nice = 0 )
explicit
Parameters
policyScheduling policy.
niceNiceness value with range [-20 - 19], where -20 is the highest priority and 19 lowest priority.
Exceptions
std::system_errorwith std::errc::invalid_argument on error.

Member Function Documentation

◆ GetPolicy()

Policy numapp::DynamicScheduler::GetPolicy ( ) const
inlineconstexprnoexcept
Returns
policy.

Definition at line 389 of file scheduler.hpp.

◆ SetNice()

std::error_code numapp::DynamicScheduler::SetNice ( int value)
noexcept

Set dynamic nice value (dynamic priority) of thread.

Higher value means "more" nice and correspondingly lower scheduling priority.

Parameters
valuethe dynamic priority. Valid range is [-20 - 19].
Returns
std::errc::invalid_argument if value is out of range.

◆ SetPolicy()

std::error_code numapp::DynamicScheduler::SetPolicy ( Policy policy)
noexcept

Set policy.

Returns
std::errc::invalid_argument if policy is invalid.

Friends And Related Symbol Documentation

◆ operator<<() [1/2]

std::ostream & operator<< ( std::ostream & os,
DynamicScheduler const & policy )
related

Formats policy and inserts it to os.

Parameters
osoutput stream to insert into.
policyPolicy to format.
Returns
os

◆ operator<<() [2/2]

std::ostream & operator<< ( std::ostream & os,
DynamicScheduler const & scheduler )
related

Formats scheduler and inserts it to os.

Parameters
osoutput stream to insert into.
schedulerDynamicScheduler to format.
Returns
os

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