'Minimum CPU requirements for embedded Linux application

I'm maintaining an embedded Linux system based on Yocto Project. It is currently running on quite beefy hardware and I'd like to lower the cost of the hardware. So for that I'm looking for a way to understand the minimum required hardware that is necessary to run our current application. This includes RAM, flash and CPU.

RAM/flash will most likely be easy as I can check the usage with free and df commands to get a good estimate.

But then for CPU I'm unsure how to measure or calculate this data. How do I know what CPU frequency is needed? How does changing to a different ARM core affect the CPU frequency? Etc.

What would be your solution for this?



Solution 1:[1]

You can experiment with CPU cores and frequency.

Disable/Enable CPU cores:

  1. Add 'maxcpus=n' (n is number of cores you wish to activate), to the kernel command line (the bootargs from U-Boot -> during booting).

=> setenv kernelargs maxcpus=2

  1. To disable/enable cores at kernel runtime:
  • Disable core X: echo 0 > /sys/devices/system/cpu/cpuX/online
  • Enable core X: echo 1 > /sys/devices/system/cpu/cpuX/online

X is core number you want to enable/disable, and can range from '1' to '(number of actual CPU cores)-1' (Core 0 is always enabled).

To see the active cores, run: cat /proc/cpuinfo

CPU frequencies

Governors: There are several frequency governors which determine the frequency policy. The default frequency governor is "ondemand", which sets the CPU frequency depending on the current system load. (Note: the default governor is selected in the kernel defconfig. You can choose a different default governor using menuconfig before building the kernel - to reach this setting, go to: CPU Power Management -> CPU Frequency scaling -> Default CPUFreq governor)

To list all available governors:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors

To set the current governor:

echo GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor (GOVERNOR being one of the available governors)

To see the available CPU frequencies: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies

To see the current CPU frequency: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

To see the current maximum allowed CPU frequency: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

To set the maximum allowed CPU frequency: echo FREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq (FREQ being one of the available CPU frequencies)

Use the "userspace" governor and set the CPU to a specific frequency using the following command: echo FREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed (FREQ being one of the available CPU frequencies)

Information source

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1