upkie  13.1.0
Open-source wheeled biped robots
PerformanceCpuGovernor Class Reference

Set all CPU cores to the "performance" frequency governor while in scope. More...

Public Member Functions

 PerformanceCpuGovernor (int nb_cpus=4, const std::string &cpu_dir="/sys/devices/system/cpu")
 Initialize without changing any CPU governor. More...
 
 ~PerformanceCpuGovernor ()
 Restore the CPU governors found at startup.
 
 PerformanceCpuGovernor (const PerformanceCpuGovernor &)=delete
 
PerformanceCpuGovernor & operator= (const PerformanceCpuGovernor &)=delete
 
bool configure ()
 Set the "performance" governor on all CPU cores. More...
 
std::string read_governor (int cpu) const
 Read the frequency governor of a CPU core. More...
 

Detailed Description

Set all CPU cores to the "performance" frequency governor while in scope.

Latency-sensitive processes such as the pi3hat spine want all cores running at maximum frequency rather than dynamically scaling. This class switches CPU frequency governors to "performance" upon configure, and restores the governors found at startup when it is destroyed.

Writing CPU frequency governors requires root privileges.


The documentation for this class was generated from the following files: