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

Static priority scheduler (real-time). More...

#include <numapp/scheduler.hpp>

Public Types

enum class  Policy : int { Fifo = SCHED_FIFO , Rr = SCHED_RR }
 Scheduler policy. More...
 

Public Member Functions

 StaticScheduler (Policy policy, int priority)
 Create with provided policy and priority.
 
std::error_code SetPriority (int priority)
 Set static priority 0 - 99.
 
std::error_code SetPolicy (Policy policy) noexcept
 Set policy.
 
constexpr int GetPriority () const noexcept
 Get static priority.
 
constexpr Policy GetPolicy () const noexcept
 

Related Symbols

(Note that these are not member symbols.)

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

Applies scheduler to specified thread.

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

Applies specified scheduler to current thread.

std::error_code Apply (StaticScheduler const &scheduler) noexcept
 Apply static scheduler to this thread.
 

Detailed Description

Static priority scheduler (real-time).

Get and set scheduler for the calling thread.

The implementation use the pthread API to query and apply policy.

Permissions

Real-time priority scheduler may require additional permissions provided by CAP_SYS_NICE unless allowed by resource limits (RLIMIT_RTPRIO). See also Permissions.

Related man-page(s):

Definition at line 216 of file scheduler.hpp.

Member Enumeration Documentation

◆ Policy

enum class numapp::StaticScheduler::Policy : int
strong

Scheduler policy.

Enumerator
Fifo 

A first-in, first-out "real-time" policy.

Rr 

A roound-robin, "real-time" policy.

Definition at line 221 of file scheduler.hpp.

Constructor & Destructor Documentation

◆ StaticScheduler()

numapp::StaticScheduler::StaticScheduler ( Policy policy,
int priority )
explicit

Create with provided policy and priority.

Parameters
policyScheduler policy.
priorityStatic priority with a valid range of 1 (low) to 99 (high).
Exceptions
std::system_errorcontaining std::errc::invalid_argument if any argument is invalid.

Member Function Documentation

◆ GetPolicy()

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

Definition at line 279 of file scheduler.hpp.

◆ SetPolicy()

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

Set policy.

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

◆ SetPriority()

std::error_code numapp::StaticScheduler::SetPriority ( int priority)

Set static priority 0 - 99.

Parameters
priorityThe priority to use. Valid range is 0 - 99.
Returns
std::errc::invalid_argument if priority is invalid.

Friends And Related Symbol Documentation

◆ operator<<()

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

Formats scheduler and inserts it to os.

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

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