|
ThreadSchedule 1.0.0
Modern C++ thread management library
|
Hardware topology helpers (CPU count, NUMA nodes) and affinity builders. More...
#include "scheduler_policy.hpp"#include <cctype>#include <thread>#include <vector>#include <fstream>#include <string>#include <unistd.h>Go to the source code of this file.
Classes | |
| struct | threadschedule::CpuTopology |
| Snapshot of basic CPU/NUMA topology. More... | |
Functions | |
| auto | threadschedule::read_topology () -> CpuTopology |
| Discover basic topology. Linux: reads /sys for NUMA nodes. Windows: single node, sequential CPU indices. | |
| auto | threadschedule::affinity_for_node (int node_index, int thread_index, int threads_per_node=1) -> ThreadAffinity |
| Build a ThreadAffinity for the given NUMA node. | |
| auto | threadschedule::distribute_affinities_by_numa (size_t num_threads) -> std::vector< ThreadAffinity > |
| Distribute thread affinities across NUMA nodes in round-robin order. | |
Hardware topology helpers (CPU count, NUMA nodes) and affinity builders.
Exposes lightweight discovery of CPU/NUMA topology and convenience functions to construct NUMA-aware ThreadAffinity masks. On Linux, NUMA nodes are detected via sysfs (nodeX/cpulist). On Windows, nodes default to 1 and CPUs are assigned sequentially.
Definition in file topology.hpp.
|
inline |
Build a ThreadAffinity for the given NUMA node.
| node_index | NUMA node index (wraps if out of range) |
| thread_index | Used to select CPU(s) within node |
| threads_per_node | Optionally include multiple CPUs per thread |
Definition at line 137 of file topology.hpp.
|
inline |
Distribute thread affinities across NUMA nodes in round-robin order.
Definition at line 162 of file topology.hpp.
|
inline |
Discover basic topology. Linux: reads /sys for NUMA nodes. Windows: single node, sequential CPU indices.
Definition at line 42 of file topology.hpp.