I will show how to change CPU governor in UT phone. Only tested with my N5, so your experience may vary. Phone is using interactive governor by default. I changed it to conservative. Conservative governor handles frequency a bit different way comparing to interactive governor.
It helped to keep my phone more cool and it seems to be more battery friendly at least in my use case.
Connect to your UT phone with cable or ssh.
Check current governor
$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor interactive
You can check how your current governor handles CPU frequency (leave it running on computer terminal and start using your phone, you should see frequency is changing)
$ watch cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
Change governor like this.
$ sudo su $ echo conservative > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor $ exit
Check new setting.
$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor conservative
If you now run that "watch cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq" command again, you should see different cpu speed behavior.
Conservative- governor has few paraneters which you can adjust.
Kernel docs tells following story..
The CPUfreq governor "conservative", much like the "ondemand" governor, sets the CPU depending on the current usage. It differs in behaviour in that it gracefully increases and decreases the CPU speed rather than jumping to max speed the moment there is any load on the CPU. This behaviour more suitable in a battery powered environment.
The governor is tweaked in the same manner as the "ondemand" governor through sysfs with the addition of:
freq_step: this describes what percentage steps the cpu freq should be increased and decreased smoothly by. By default the cpu frequency will increase in 5% chunks of your maximum cpu frequency. You can change this value to anywhere between 0 and 100 where '0' will effectively lock your CPU at a speed regardless of its load whilst '100' will, in theory, make it behave identically to the "ondemand" governor.
down_threshold: same as the 'up_threshold' found for the "ondemand" governor but for the opposite direction. For example when set to its default value of '20' it means that if the CPU usage needs to be below 20% between samples to have the frequency decreased.
sampling_down_factor: similar functionality as in "ondemand" governor. But in "conservative", it controls the rate at which the kernel makes a decision on when to decrease the frequency while running in any speed. Load for frequency increase is still evaluated every sampling rate.
I only tweaked these two.. 20 and 80 are the default values.
$ cat /sys/devices/system/cpu/cpufreq/conservative/down_threshold 20 $ cat /sys/devices/system/cpu/cpufreq/conservative/down_threshold 80
How to change. I change values to 40 and 90. You can use your own values which suits better for you.
$ sudo su $ echo 40 > /sys/devices/system/cpu/cpufreq/conservative/down_threshold $ echo 90 > /sys/devices/system/cpu/cpufreq/conservative/up_threshold $ exit
If you check once again how governor handles cpu speed, it should be different now.
These settings aren't permanent, so after reboot all of these are defaults again. I made simple script which I run after every reboot so I don't have to write all commands again and again. I reboot my phone about once in a two weeks so I don't have to do it very often.
$ mkdir .scripts $ cd .scripts $ nano governor.sh
#!/bin/sh sudo su <<EOF echo conservative > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor echo 40 > /sys/devices/system/cpu/cpufreq/conservative/down_threshold echo 90 > /sys/devices/system/cpu/cpufreq/conservative/up_threshold EOF exit 0
Save and exit.
Set execution permission.
$ chmod 755 governor.sh
You can run it from phone by opening terminal and write ./.scripts/governor.sh
It would be cool if we could change these settings straight from setting menu. Of course different phones may need different settings..