NUMA++ 0.12.0
Loading...
Searching...
No Matches
schedulerExample2.cpp
Go to the documentation of this file.
1/**
2 * @file
3 * @copyright
4 * SPDX-FileCopyrightText: 2023-2023 European Southern Observatory (ESO)
5 *
6 * SPDX-License-Identifier: LGPL-3.0-only
7 */
8#include <iostream>
9#include <numapp/numa.hpp>
10#include <numapp/scheduler.hpp>
11
12int main() {
13 using namespace numapp;
14 if (!NumaAvailable()) {
15 std::cout << "NUMA not available";
16 return -1;
17 }
18
20
22 auto sched = current.GetScheduler<numapp::DynamicScheduler>();
23 std::cout << "Nice: " << sched.GetNice() << std::endl;
24 }
25
26 // Or get underlying variant
27 std::variant<DynamicScheduler, StaticScheduler, IdleScheduler> variant = current.Get();
28}
Normal non-realtime scheduler that use dynamic priority (nice value).
int GetNice() const noexcept
Get dynamic nice value.
A sum-type of all supported schedulers.
SchedulerVariant const & Get() const noexcept
Get the underlying scheduler.
static Scheduler MakeFromActive()
Return active scheduler policy for this thread.
constexpr T GetScheduler() const
Get the held scheduler.
constexpr bool HoldsScheduler() const noexcept
Query the held scheduler.
bool NumaAvailable() noexcept
Query whether system has NUMA support.
Definition numa.hpp:35
Contains scheduler declarations.