Module cpu

Module cpu 

Source
Expand description

CPU-related operational helpers (affinity probing/pinning). CPU-related operational helpers.

Platform support

  • Linux: uses sched_getaffinity / sched_setaffinity.
  • Other OSes: functions return an error.

Contracts

  • Pinning affects the current thread only.
  • CPU ids are OS CPU indices as used by the kernel.

Functionsยง

current_thread_allowed_cpus
Returns the list of CPUs the current thread is allowed to run on (Linux).
fmt_cpu_list
Format a list of CPU ids as a comma-separated string.
pin_current_thread_to_cpu
Pins the current thread to the given CPU (Linux).