CK
← Back to C-Kernel-Engine Docs
Doxygen Source Documentation
Loading...
Searching...
No Matches
ck_topology.h
Go to the documentation of this file.
1
#ifndef CK_TOPOLOGY_H
2
#define CK_TOPOLOGY_H
3
4
/* Generic CPU topology discovery for dispatch decisions.
5
*
6
* Everything is derived at runtime from the process's allowed CPU set
7
* (sched_getaffinity) and per-CPU capacity exported by the kernel
8
* (/sys/devices/system/cpu/cpuN/cpu_capacity, with cpufreq max-frequency as
9
* fallback). Nothing is hardcoded to a specific machine, and CPUs outside
10
* the process's allowed set are never considered. On non-Linux platforms or
11
* when no capacity information exists, every allowed CPU is treated as equal
12
* (homogeneous), which is also the x86 result.
13
*/
14
15
/* Number of CPUs the process may run on (affinity-aware). */
16
int
ck_topology_allowed_cpus
(
void
);
17
18
/* Nonzero when the allowed CPUs have meaningfully different performance
19
* capacity (max/min capacity ratio > 1.15, e.g. big.LITTLE). Zero on
20
* homogeneous systems and when capacity is unknown. */
21
int
ck_topology_heterogeneous
(
void
);
22
23
/* Fill `cpus` with the allowed CPU ids in the top capacity tier (the "big"
24
* cores), ascending. Returns the number written (never more than max_cpus).
25
* On homogeneous/unknown systems the top tier is every allowed CPU. */
26
int
ck_topology_big_cpus
(
int
*cpus,
int
max_cpus);
27
28
#endif
/* CK_TOPOLOGY_H */
ck_topology_heterogeneous
int ck_topology_heterogeneous(void)
Definition
ck_topology.c:148
ck_topology_big_cpus
int ck_topology_big_cpus(int *cpus, int max_cpus)
Definition
ck_topology.c:154
ck_topology_allowed_cpus
int ck_topology_allowed_cpus(void)
Definition
ck_topology.c:142
include
ck_topology.h
Generated by
1.15.0