3#include <numapp/numa.hpp>
6void ThreadFunc(std::chrono::milliseconds duration) {
9 std::this_thread::sleep_for(duration);
14 using namespace std::chrono_literals;
16 std::cout <<
"NUMA not available";
22 auto thread =
MakeThread(
"myThread", policies, &ThreadFunc, 500ms);
static CpuAffinity MakeFromCpuStringAll(char const *cpustring)
Create CpuAffinity from `cpustring` without considering current cpuset.
static CpuAffinity MakeFromActive()
Create current affinity settings.
Combines the the available NUMA policy types in one object.
void SetCpuAffinity(std::optional< CpuAffinity > affinity) noexcept
Set CPU affinity.
bool NumaAvailable() noexcept
Query whether system has NUMA support.
std::thread MakeThread(std::string_view thread_name, NumaPolicies const &policies, Func &&func, Args &&... args)
Primary overload accepting string-view for thread_name.
Contains declarations for numapp thread utilities.