Check the CPU Frequency

[Last Update — March 2015] The BBB has various governors that can be used to profile the performance/power usage ratio. For example, if you were to build a battery powered BBB application that required low processing requirements, you could reduce the clock frequency to conserve power. You can find out information about the current state of the BBB by typing cpufreq-info:

You can see at the bottom that the current CPU frequency is 300MHz.

If these tools are not installed on your BBB, you can install the cpufrequtils package.

However, the profile is on-demand, so if the CPU frequency is currently 300MHz and the average CPU usage between governor samplings is above the threshold (called the ‘up_threshold’) then the CPU frequency will be automatically increased. The ‘up_threshold’ can actually be adjusted using sysfs as follows:

Here is an example OpenCV application running, where I am achieving 4.15 frames per second. During the execution of this program the CPU frequency will be automatically increased to cater for the increased processing demand.  We will shortly examine this against other profiles. The code that I am running is available at: https://github.com/derekmolloy/boneCV

Set the CPU Frequency

However, it may be the case that you would like to increase or reduce the CPU Frequency to process data more quickly or to conserve power — for example, if you were to use a battery to power the BeagleBone. You can change the CPU frequency dynamically at run time on the Beaglebone using the cpufreq-set tool (See http://linux.die.net/man/1/cpufreq-set for information).

The cpufreq-set command must be executed with root privileges.

You can see in the output above that different governors are available, with the profile names conservative, ondemand, userspace, powersave, and performance . To enable a specific CPU frequency, type the following:

So, the BeagleBone CPU frequency is now 600 MHz. Alternatively, you can use the governor to set the CPU frequency profile to have another setting. For example, to set the powersave profile:

And running the same program again:

We see that I am only achieving 1.6 frames per second @ 300 MHz, which is slightly faster (on a proportional basis 300×4.16/1000 = ~1.25 fps); however, there is time required for the ondemand governor to change the CPU frequency, and to capture the image, which is more I/O than CPU intensive. Even at 1 GHz the AM335x is only slightly warm to the touch after processing a heavy load.

Setting the BBB CPU Frequency at Boot

[Thanks Kiyoshi in the comments below for this information] If you decide that you would like to permanently change the default governor profile of the BeagleBone you can do so by editing the file /etc/init.d/cpufrequtils and changing the entry GOVERNOR="ondemand" to a different governor, such as conservative, userspace, powersave or performance. For example, you could set it to high-performance mode using the following steps (e.g., using nano to edit the file):