ThreadSchedule 1.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
profiles.hpp File Reference

High-level thread configuration profiles and helpers. More...

#include "concepts.hpp"
#include "scheduler_policy.hpp"
#include "thread_pool.hpp"
#include "thread_registry.hpp"
#include <optional>
#include <string>
Include dependency graph for profiles.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  threadschedule::ThreadProfile
 Declarative profile describing desired scheduling. More...

Functions

auto threadschedule::profiles::realtime () -> ThreadProfile
 Highest priority profile. Uses FIFO on Linux (if permitted), falls back to OTHER on Windows.
auto threadschedule::profiles::low_latency () -> ThreadProfile
 Low-latency interactive profile using RR scheduling.
auto threadschedule::profiles::throughput () -> ThreadProfile
 Throughput-oriented profile favoring batch scheduling.
auto threadschedule::profiles::background () -> ThreadProfile
 Background profile for very low priority work.
template<typename ThreadLike, std::enable_if_t< is_thread_like_v< ThreadLike >, int > = 0>
auto threadschedule::apply_profile (ThreadLike &t, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to a single thread wrapper or view.
auto threadschedule::apply_profile (ThreadControlBlock &t, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to a thread control block.
auto threadschedule::apply_profile (RegisteredThreadInfo &t, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to a registered thread info.
auto threadschedule::apply_profile (ThreadPool &pool, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to all workers of a simple ThreadPool.
auto threadschedule::apply_profile (HighPerformancePool &pool, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to all workers of a HighPerformancePool.
auto threadschedule::apply_profile (ThreadRegistry &reg, Tid tid, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to a registry-controlled thread by TID.

Detailed Description

High-level thread configuration profiles and helpers.

Provides simple presets (e.g. realtime, low_latency, throughput, background) and utility functions to apply them to single threads, thread pools, or registry-managed threads. Profiles abstract low-level flags like policy, priority, and optional CPU affinity into a single intent.

Definition in file profiles.hpp.

Function Documentation

◆ apply_profile() [1/6]

auto threadschedule::apply_profile ( HighPerformancePool & pool,
ThreadProfile const & p ) -> expected<void, std::error_code>
inline

Apply a profile to all workers of a HighPerformancePool.

Definition at line 143 of file profiles.hpp.

◆ apply_profile() [2/6]

auto threadschedule::apply_profile ( RegisteredThreadInfo & t,
ThreadProfile const & p ) -> expected<void, std::error_code>
inline

Apply a profile to a registered thread info.

Definition at line 116 of file profiles.hpp.

◆ apply_profile() [3/6]

auto threadschedule::apply_profile ( ThreadControlBlock & t,
ThreadProfile const & p ) -> expected<void, std::error_code>
inline

Apply a profile to a thread control block.

Definition at line 98 of file profiles.hpp.

◆ apply_profile() [4/6]

template<typename ThreadLike, std::enable_if_t< is_thread_like_v< ThreadLike >, int > = 0>
auto threadschedule::apply_profile ( ThreadLike & t,
ThreadProfile const & p ) -> expected<void, std::error_code>
inline

Apply a profile to a single thread wrapper or view.

Definition at line 80 of file profiles.hpp.

◆ apply_profile() [5/6]

auto threadschedule::apply_profile ( ThreadPool & pool,
ThreadProfile const & p ) -> expected<void, std::error_code>
inline

Apply a profile to all workers of a simple ThreadPool.

Definition at line 124 of file profiles.hpp.

◆ apply_profile() [6/6]

auto threadschedule::apply_profile ( ThreadRegistry & reg,
Tid tid,
ThreadProfile const & p ) -> expected<void, std::error_code>
inline

Apply a profile to a registry-controlled thread by TID.

Definition at line 161 of file profiles.hpp.

◆ background()

auto threadschedule::profiles::background ( ) -> ThreadProfile
inline

Background profile for very low priority work.

Definition at line 70 of file profiles.hpp.

◆ low_latency()

auto threadschedule::profiles::low_latency ( ) -> ThreadProfile
inline

Low-latency interactive profile using RR scheduling.

Definition at line 54 of file profiles.hpp.

◆ realtime()

auto threadschedule::profiles::realtime ( ) -> ThreadProfile
inline

Highest priority profile. Uses FIFO on Linux (if permitted), falls back to OTHER on Windows.

Definition at line 40 of file profiles.hpp.

◆ throughput()

auto threadschedule::profiles::throughput ( ) -> ThreadProfile
inline

Throughput-oriented profile favoring batch scheduling.

Definition at line 62 of file profiles.hpp.