ThreadSchedule 2.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
topology.hpp File Reference

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>
Include dependency graph for topology.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  threadschedule::CpuTopology
 Snapshot of basic CPU/NUMA topology. More...

Namespaces

namespace  threadschedule

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.

Detailed Description

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.