Robot Control Library
CPU

Description

Control CPU scaling governer.

<rc/cpu.h>

Functions to read and set the current CPU scaling function. This is not specific to the beaglebone and should work on any linux system, however since the beaglebone has a single cpu core, this only changes the govenor for one core.

Author
James Strawson
Date
3/7/2018

Typedefs

typedef enum rc_governor_t rc_governor_t
 

Functions

int rc_cpu_set_governor (rc_governor_t gov)
 Sets the CPU governor. See rc_governor_t. More...
 
int rc_cpu_get_freq (void)
 Returns the current clock speed of the Beaglebone's Sitara processor in the form of the provided enumerated type. It will never return the FREQ_ONDEMAND value as the intention of this function is to see the clock speed as set by either the user or the ondemand governor itself. More...
 
int rc_cpu_print_freq (void)
 Prints the current frequency to the screen. For example "600mhz". More...
 

Enumeration Type Documentation

◆ rc_governor_t

available CPU governors

Enumerator
RC_GOV_POWERSAVE 

Sets CPU to slowest speed.

RC_GOV_PERFORMANCE 

Sets CPU to fastest speed.

RC_GOV_ONDEMAND 

Default automatic scaling.

RC_GOV_SCHEDUTIL 

Like ONDEMAND but newer algorithm.

RC_GOV_CONSERVATIVE 

Automatically scales the cpu but still tries to save power.

Function Documentation

◆ rc_cpu_set_governor()

int rc_cpu_set_governor ( rc_governor_t  gov)

Sets the CPU governor. See rc_governor_t.

This is the equivalent to running 'cpufreq-set -g {governor}' from the command line but can be called in your C program instead.

Parameters
[in]govDesired governor
Returns
0 on success, -1 on failure.
Examples:
rc_cpu.c.

◆ rc_cpu_get_freq()

int rc_cpu_get_freq ( void  )

Returns the current clock speed of the Beaglebone's Sitara processor in the form of the provided enumerated type. It will never return the FREQ_ONDEMAND value as the intention of this function is to see the clock speed as set by either the user or the ondemand governor itself.

Returns
frequency in hz

◆ rc_cpu_print_freq()

int rc_cpu_print_freq ( void  )

Prints the current frequency to the screen. For example "600mhz".

Returns
0 on success or -1 on failure.
Examples:
rc_cpu.c.