CPU frequency modulation strategy

1. CPU frequency regulation strategy The

operating system will adjust the frequency of the CPU according to the current CPU load to reduce power consumption while meeting the current usage. The main deployment modes are as follows:




Ondemand: Ondemand mode Adjusts the CPU frequency on

demand , controls the lowest frequency when not operating the phone, quickly increases to the highest frequency when sliding the screen or enters an application, and quickly decreases the frequency when idle , The performance is relatively stable, but due to the excessive frequency change, the power saving is only at a general level. It is a default mode that tends to balance between battery and performance, but for smartphones, ondemand is slightly lacking in performance.




Interactive: Interactive

mode is similar to ondemand mode, the rule is "fast rise and slow fall", pay attention to response speed and performance, quickly jump to high frequency when there is high demand, and gradually reduce the frequency when there is low demand. Slightly better.




Conservative:

Conservative mode Similar to ondemand mode, the rule is "slow rise and fast fall", focusing on power saving, gradually increasing the frequency when there is high demand, and quickly jumping to low frequency when there is low demand.




Hotplug: Hotplug mode:

Similar to the ondemand mode, when there is a high demand, it directly jumps to the highest frequency, and when the demand decreases, the frequency is gradually reduced, but when the screen is off, the single-core low-frequency operation saves power.




Performance: High performance

mode runs at the highest frequency of the set range, even if the system load is very low, the CPU runs at the highest frequency. Good performance and high power consumption.




Powersave: Power saving mode Runs at the lowest frequency

in the set range, and has no daily use value. Unless it cooperates with the setcpu profile mode, this mode is used when the screen is turned off to sleep, which saves power but the system response speed is slow.




Userspace: User mode:

In any case, the CPU will be controlled to run within the configured frequency range, and the power saving settings added by the user in the configuration. In this scenario mode, reducing the maximum operating frequency of the CPU can delay the standby time, but at the same time, it will reduce the wake-up speed of the machine. This option is not recommended.




2. CPU-related properties View

CPU-related information can be viewed on the nodes in the /sys/devices/system/cpu/ directory, such as the highest frequency, the lowest frequency, the current frequency, the available frequency, the supported frequency regulation strategy, and the current frequency regulation strategy.

In the case of multi-core, there will be cpu0, cpu1, cpu2... in the directory. Take cpu0 as an example to introduce how to view related information:

cd /sys/devices/system/cpu/cpu0/cpufreq

cat affected_cpus Change the configuration affected CPU list

cat cpuinfo_cur_freq current frequency

cat cpuinfo_max_freq maximum frequency

cat cpuinfo_min_freq minimum frequency

cat scaling_available_frequencies available frequency points, the CPU will increase or decrease frequency between these frequency points

cat scaling_available_governors available frequency regulation strategy, the currently set frequency regulation strategy must be one of them

cat scaling_governor Current frequency regulation strategy




3. CPU frequency regulation strategy adjustment

a. Get CPU supported frequency regulation strategy

cat scaling_available_governors #such as interactive conservative ondemand powersave performance




b. Set strategy

echo scaling_governor performance

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326260699&siteId=291194637