Before I go messing up my boot files, etc, is there an easy way to do this:
# "echo 'interactive' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" and add this one-liner to any boot script if you want it to happen automatically on boot. [or]
# Unpack the boot.img and edit /init.qcom.post_boot.sh in the ramdisk to use 'interactive', then repack and flash_image the new boot.img. This is what I do, and what you'd do if you were building a ROM with this kernel.
Well, the first thing is just a one-line command:
Code:
echo 'interactive' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
You can do that at any time from an adb shell or any other console shell (like Terminal Emulator). Note that you can also get the current scaling_governor at any time by doing:
Code:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
To change the scaling_governor automatically on boot, you could add it to an .sh script that runs on boot. I put it into init.qcom.post_boot.sh, which requires unpacking/repacking the boot partition ... but you could probably put it someplace else that doesn't require modifying the boot image, such as in /system.
If you ROM has init.d support (and it works) you could make a small script to do this and put it into /system/etc/init.d. i.e. put this into a file:
Code:
#!/system/bin/sh
echo 'interactive' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
and save without any extension (i.e. as "interactivecpu"). Then save or adb push that file to /system/etc/init.d and chmod it executable (i.e. "chmod 755 /system/etc/init.d/interactivecpu").
I have not tested this, but it should get you far enough along to get it working.
If you do that, and it doesn't work on boot, you can also just run the script from the shell at any time:
Code:
/system/etc/init.d/interactivecpu
What you need to know is that /init.qcom.post_boot.sh is a script that runs on boot and changes the governor to ondemand (unless you modify it). So, depending on the order things are run, a script you add to run on boot, if it's run before init.qcom.post_boot.sh, won't do any good because init.qcom.post_boot.sh will just run and change the governor to ondemand. I haven't tested the init.d script, so it may just work. But if it doesn't, that may be the problem.
EDIT: Don't want to use SetCPU btw. I know your "easy" suggestion is to do that, but I would like to go for one of the other options you have listed. How does the interactive for you as opposed to the ondemand? Most say it's smoother and improves battery life...
Well, you are welcome to do whatever you like! I personally don't see any downside to using SetCPU to do this (it is just going to cat 'interactive' into /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor like any script). I called it the "easy" way but that does not mean the other ways are any better. And remember that if you do it the "hard" way you will have to remember to undo things if you later decide to flash a kernel without interactive support.
The main advantage to interactive is that, coming out of idle, it automatically ramps up to max CPU, so it's going to be more responsive. Ondemand takes longer to ramp up the cpu speed because it uses a weighted average of cpu demand over time. But, we're talking milliseconds here.
Personally I prefer to run interactive and have not had any problems. I would agree that it feels a little smoother. However, I would be skeptical and ask to see real data re: claims about battery life. I have tried to design clean benchmark conditions for my kernel and it is very difficult. You would have to connect a power meter between your phone and battery, boot into airplane mode, and conduct a very precise set of simulated usage of the phone and apps. It's very difficult to simulate real usage in repeatable way. Turn the radio on, and you'd also have to guarantee radio usage (polling for email, whatever the OS does) to be identical between tests.
Sorry if that sounds unhelpful and equivocating. Personally, given my observation of the cpu frequency as I do various things and knowledge of the code of the two governors, I would expect power usage to be similar. No great savings either way.