[MAGISK][MOD]--Pixel4a-CpuTweak--V2 - Google Pixel 4a Themes, Apps, and Mods

Pixel4a-CpuTweak--V2​
Short story : I do from time to time some monitoring on my phones(Using Francokernel app). Watching cpu freq, battery amp, etc. Since Android12 on my Pixel4a i noticed the cpu was almost always high for no serious reason compared to Android11. So i made a little script that use magisk to run as root and on boot to change some kernel parameters to make cpu way more batery friendly. It just let the little cores goes as low as they can and use the big cores for heavy task.
If you noticed a bad Screen On Time since Android12 then this module is for you.
This magisk module will make your cpu consume less power.
-Little cores can now go down to their lowest frequency
-Big cores are used for heavy task
Download attached below​
Spoiler: CHANGELOG
Code:
--V2
-Fix some tunable being reset by system
-set them after boot complete
-fix some typo
Spoiler: CODE
Code:
[/CENTER]
#!/system/bin/sh
MODDIR=${0%/*}
# # # WAIT TILL BOOT IS COMPLETE # # #
while true; do BOOT=$(getprop sys.boot_completed); if [ "$BOOT" -eq "1" ]; then sleep 3; break; else sleep 9; fi; done
# # # KERNEL SCHED # # #
echo '0' > /proc/sys/kernel/sched_schedstats; chmod 0444 /proc/sys/kernel/sched_schedstats
echo '1' > /proc/sys/kernel/sched_tunable_scaling; chmod 0444 /proc/sys/kernel/sched_tunable_scaling
# # # SCHEDUTIL FREQ # # #
echo '1248000' > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq; chmod 0444 /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
echo '1555200' > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq; chmod 0444 /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq
# # # SCHEDTUNE # # #
#general
echo '0' > /dev/stune/schedtune.boost; chmod 0444 /dev/stune/schedtune.boost
echo '0' > /dev/stune/schedtune.prefer_high_cap; chmod 0444 /dev/stune/schedtune.prefer_high_cap
echo '1' > /dev/stune/schedtune.prefer_idle; chmod 0444 /dev/stune/schedtune.prefer_idle
echo '0-7' > /dev/cpuset/cpus; chmod 0444 /dev/cpuset/cpus
#background
echo '0' > /dev/stune/background/schedtune.boost; chmod 0444 /dev/stune/background/schedtune.boost
echo '0' > /dev/stune/background/schedtune.prefer_high_cap; chmod 0444 /dev/stune/background/schedtune.prefer_high_cap
echo '1' > /dev/stune/background/schedtune.prefer_idle; chmod 0444 /dev/stune/background/schedtune.prefer_idle
echo '0-5,7' > /dev/cpuset/background/cpus; chmod 0444 /dev/cpuset/background/cpus
#foreground
echo '0' > /dev/stune/foreground/schedtune.boost; chmod 0444 /dev/stune/foreground/schedtune.boost
echo '0' > /dev/stune/foreground/schedtune.prefer_high_cap; chmod 0444 /dev/stune/foreground/schedtune.prefer_high_cap
echo '1' > /dev/stune/foreground/schedtune.prefer_idle; chmod 0444 /dev/stune/foreground/schedtune.prefer_idle
echo '0-5,7' > /dev/cpuset/foreground/cpus; chmod 0444 /dev/cpuset/foreground/cpus
#top-app
echo '0' > /dev/stune/top-app/schedtune.boost; chmod 0444 /dev/stune/top-app/schedtune.boost
echo '0' > /dev/stune/top-app/schedtune.prefer_high_cap; chmod 0444 /dev/stune/top-app/schedtune.prefer_high_cap
echo '1' > /dev/stune/top-app/schedtune.prefer_idle; chmod 0444 /dev/stune/top-app/schedtune.prefer_idle
echo '0-5,7' > /dev/cpuset/top-app/cpus; chmod 0444 /dev/cpuset/top-app/cpus
#camera-daemon
echo '0' > /dev/stune/camera-daemon/schedtune.boost; chmod 0444 /dev/stune/camera-daemon/schedtune.boost
echo '0' > /dev/stune/camera-daemon/schedtune.prefer_high_cap; chmod 0444 /dev/stune/camera-daemon/schedtune.prefer_high_cap
echo '1' > /dev/stune/camera-daemon/schedtune.prefer_idle; chmod 0444 /dev/stune/camera-daemon/schedtune.prefer_idle
echo '0-5,7' > /dev/cpuset/camera-daemon/cpus; chmod 0444 /dev/cpuset/camera-daemon/cpus
#nnapi-hal
echo '0' > /dev/stune/nnapi-hal/schedtune.boost; chmod 0444 /dev/stune/nnapi-hal/schedtune.boost
echo '0' > /dev/stune/nnapi-hal/schedtune.prefer_high_cap; chmod 0444 /dev/stune/nnapi-hal/schedtune.prefer_high_cap
echo '1' > /dev/stune/nnapi-hal/schedtune.prefer_idle; chmod 0444 /dev/stune/nnapi-hal/schedtune.prefer_idle
#rt
echo '0' > /dev/stune/rt/schedtune.boost; chmod 0444 /dev/stune/rt/schedtune.boost
echo '0' > /dev/stune/rt/schedtune.prefer_high_cap; chmod 0444 /dev/stune/rt/schedtune.prefer_high_cap
echo '1' > /dev/stune/rt/schedtune.prefer_idle; chmod 0444 /dev/stune/rt/schedtune.prefer_idle
#restricted
echo '0-2,5' > /dev/cpuset/restricted/cpus; chmod 0444 /dev/cpuset/restricted/cpus
#system background
echo '0-2,5' > /dev/cpuset/system-background/cpus; chmod 0444 /dev/cpuset/system-background/cpus

I cannot speak for battery life but my phone feels significantly less responsive after installing the mod. Otherwise great idea, just doesn't work for my workflow.

Tom 23 said:
I cannot speak for battery life but my phone feels significantly less responsive after installing the mod. Otherwise great idea, just doesn't work for my workflow.
Click to expand...
Click to collapse
Thanks for the feedback. I've updated the module if you wanna try again. There was some typo that could make the phone less responsive. Now it will work as intended.

Dead-neM said:
Short story : I do from time to time some monitoring on my phones(Using Francokernel app). Watching cpu freq, battery amp, etc. Since Android12 on my Pixel4a i noticed the cpu was almost always high for no serious reason compared to Android11. So i made a little script that use magisk to run as root and on boot to change some kernel parameters to make cpu way more batery friendly. It just let the little cores goes as low as they can and use the big cores for heavy task.[/SIZE]
...snip...
Click to expand...
Click to collapse
COuld it be thyat by checking your phones current CPU useage, you are actually using ypour phone, and so the governor is ramping up your CPU clock to ensure the phone is reacting or ready to react? Have you compared your changes to switching to the conservative governor? (I am guessing this gov is available on the phone).

DiamondJohn said:
COuld it be thyat by checking your phones current CPU useage, you are actually using ypour phone, and so the governor is ramping up your CPU clock to ensure the phone is reacting or ready to react? Have you compared your changes to switching to the conservative governor? (I am guessing this gov is available on the phone).
Click to expand...
Click to collapse
There's no conservative governor in stock kernel. Schedutil is good and many little component rely on it (at least on stock rom)
Yes checking your cpu usage use cpu but you see how much and its so little that it doesn't ramp up cpu.
Android like Linux have the "top" terminal cmd which display the current process in use. More or less like task manager windows have.

Dead-neM said:
There's no conservative governor in stock kernel. Schedutil is good and many little component rely on it (at least on stock rom)
Yes checking your cpu usage use cpu but you see how much and its so little that it doesn't ramp up cpu.
Android like Linux have the "top" terminal cmd which display the current process in use. More or less like task manager windows have.
Click to expand...
Click to collapse
You are right, there is no "Conservative" gov. its not called "Conservative" but there is one called "Powersave"; which is the conservative gov, just named differently to what has been on my previous devices.
I took a moment to have a play, and set all the CPU's to the powersave gov, and found (surprisingly) if I set the smaller govs to powersave, then I notice big lags. Especially in the "tripple-tap-to-zoom" and then dragging about was completely unuseable. Leaving the small CPU's on schedutil and the big ones on powersave, I cant really say I noticed the lag. .But, since I dont have battery problems (i use an aggressive doze profile, and keep running apps under control, ie out of top -n 1;), I switched back to the standard gov.
One other little surprise is that I switched my IO scheduler to "noop" and although it *may* of possibly felt a tiny bit little more responsive, testing long running scripts, heavy in IO, actually ran slower.
Long story short, the powersave gov on the smaller cpu's induces lag. I did not check if the gov on the bugger CPU's saves much power.

Related

RAMDISK.TAR a few issue's to resolve.

I have noticed that developers here like to shove VM and Cpu setting into the init.delta.sh file.
The problem with this is compatibility.. for example using the smart ass govender with these settings...
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
echo 30 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/down_differential
echo 500000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
echo 122880 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 614400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
Click to expand...
Click to collapse
Will most definitely cause issue's where the frequency will get stuck.
Why not make it possible to rather edit these value's externally.
as these can also be called from hw_config.sh there by causing less problems when users try to make 3'rd party changes.

I'd like to tally your CPU freqs + volt settings

I've always found undervolting does wonders for phone battery life.
I'd like to record everyone's settings at
192mhz
384
540
702
810
918
1025
1188
If you could post your lowest stable voltages for some or all of these frequencies we should be able to figure out a recommended underclock profile.
I like your idea!
P.A.C.man rom
butterred toast 14
384mhz min
1566 mhz max
ondeman
192-750
310-812
384-812
432-825
486-850
540-862
594-875
648-887
702-912
765-937
810-950
864-975
918-1000
972-1025
1026-1062
1080-1075
1134-1100
1188-1125
1242-1125
1296-1125
1350-1125
1404-1137
1458-1137
1512-1187
1536-1187
1566-1187
im using Kernel tuner also
any settings you want me to try ?
I'll wait for a consensus before suggesting anything but you lower to mid freqs seem a bit high I think.
rchyted pages
rancur3p1c said:
I'll wait for a consensus before suggesting anything but you lower to mid freqs seem a bit high I think.
Click to expand...
Click to collapse
I experienced an infinite boot yesterday, i had to put a new rom+kernel , may the undervolting have caused this? i just put everything back and im going to try the same settings and see what happens, could you point out which freqs i could lower the voltage on?
ink-red-ible said:
I experienced an infinite boot yesterday, i had to put a new rom+kernel , may the undervolting have caused this? i just put everything back and im going to try the same settings and see what happens, could you point out which freqs i could lower the voltage on?
Click to expand...
Click to collapse
Takes lots of trial and error.
Use CPU Tweaks to adjust. Set it to re apply on boot completed. Not with init.d script. It won't reapply next boot if it detected a lockup last boot. I was thinking the 700-972 range was a bit high.
rancur3p1c said:
Takes lots of trial and error.
Use CPU Tweaks to adjust. Set it to re apply on boot completed. Not with init.d script. It won't reapply next boot if it detected a lockup last boot. I was thinking the 700-972 range was a bit high.
Click to expand...
Click to collapse
I think 810-972 could be 50mV lower across the board.
#! 750000 775000 775000 800000 800000 825000 825000 850000 850000 875000 875000 900000 900000 900000 925000 950000 950000 975000 1000000 1025000 1050000 1050000 1050000 1075000
echo "192000 750000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "310500 775000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "384000 775000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "432000 800000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "486000 800000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "540000 825000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "594000 825000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "648000 850000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "702000 850000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "756000 875000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "810000 875000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "864000 900000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "918000 900000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "972000 900000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1026000 925000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1080000 950000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1134000 950000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1188000 975000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1242000 1000000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1296000 1025000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1350000 1050000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1404000 1050000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1458000 1050000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1512000 1075000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
Code:
.
Odesláno z mého Evo 3D GSM pomocí Tapatalk 2
Question bout voltage: why do some frequencies have the same voltage?
Wouldnt it be better to lower some of them? Thats at least what i did here:
192 725
310 737
384 750
432 775
486 787
540 800
594 812
648 825
702 850
756 862
810 875
864 900
918 912
972 925
1026 937
1080 975
1134 987
1188 1000
1242 1012
1296 1025
1350 1037
1404 1050
1458 1075
1512 1100
Still not the lowest possible voltages, but completely stable....
Edit : reworked voltages, still stable
Might be possible to lower voltage for a few single freq, but the next -12,5 @ all makes it crashing ( on my phone)
Edit 2: Had a few reboots, could be too low (@ ~1000 MHz ?) , +12,5 lets See how it works
Sent from my HTC EVO 3D X515m using xda app-developers app
anryl said:
#! 750000 775000 775000 800000 800000 825000 825000 850000 850000 875000 875000 900000 900000 900000 925000 950000 950000 975000 1000000 1025000 1050000 1050000 1050000 1075000
echo "192000 750000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "310500 775000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "384000 775000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "432000 800000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "486000 800000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "540000 825000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "594000 825000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "648000 850000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "702000 850000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "756000 875000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "810000 875000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "864000 900000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "918000 900000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "972000 900000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1026000 925000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1080000 950000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1134000 950000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1188000 975000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1242000 1000000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1296000 1025000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1350000 1050000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1404000 1050000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1458000 1050000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1512000 1075000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
Code:
.
Odesláno z mého Evo 3D GSM pomocí Tapatalk 2
Click to expand...
Click to collapse
I tried these settings and it was extremely unstable :/ coulnt open a single app... im on the pacman rom with buttered toast 14.1...
i get a reboot every time i apply the settings. could it be that the kernel doesnt support undervolting? any other settings ?
---------- Post added at 11:06 AM ---------- Previous post was at 10:57 AM ----------
Quantenhall said:
Question bout voltage: why do some frequencies have the same voltage?
Wouldnt it be better to lower some of them? Thats at least what i did here:
192 740
310 744
384 760
432 770
486 785
540 796
594 810
648 820
702 845
756 870
810 880
864 905
918 928
972 940
1026 977
1080 1010
1134 1035
1188 1050
1242 1060
1296 1070
1350 1090
1404 1110
1458 1122
1512 1152
Still not the lowest possible voltages, but completely stable....
Sent from my HTC EVO 3D X515m using xda app-developers app
Click to expand...
Click to collapse
Just tried these and completely stable until now, i will report any problems, i went a little lower tho and everything good
Bump
rancur3p1c said:
Bump
Click to expand...
Click to collapse
Edited mine, a lot lower on the high freq now^^
Quantenhall said:
Edited mine, a lot lower on the high freq now^^
Click to expand...
Click to collapse
Due to how chips work what with error correction and all it's probably best to go +25mV or +37mV from the crash frequency. If you notice lags during rendering of the sense fly in after unlock, that's the error correction engaging, back off the undervolt a bit. The problem is there are easy too many frequencies. We need someone to produce a kernel build with 7 slots not the stock 20 or however many there are.
ink-red-ible said:
I tried these settings and it was extremely unstable :/ coulnt open a single app... im on the pacman rom with buttered toast 14.1...
i get a reboot every time i apply the settings. could it be that the kernel doesnt support undervolting? any other settings ?
---------- Post added at 11:06 AM ---------- Previous post was at 10:57 AM ----------
Just tried these and completely stable until now, i will report any problems, i went a little lower tho and everything good
Click to expand...
Click to collapse
Your setting is pretty good for me
Can you test higher freqs volt?
:good:
I am using stabilitytest to test it
1536 - 1112
1566 - 1137
1620 - 1150
1674 - 1175
1728 - 1187
test1 pass
1536 - 1112
1566 - 1125
1620 - 1137
1674 - 1175
1728 -1187
final test for me
192 725
310 737
384 750
432 775
486 787
540 800
594 812
648 825
702 850
856 862
810 875
864 900
918 900
972 900
1026 925
1080 950
1134 950
1188 975
1242 1000
1296 1025
1350 1037
1404 1050
1458 1050
1512 1075
1536 1112
1620 1137(if u unstable +12.5)
1674 1162
1728 1187
final stable for me
more low
192 700
310 712
384 725
432 737
486 750
540 762
594 775
648 787
702 800
756 825
810 837
864 850
918 862
972 875
1026 900
1080 912
1134 937
1188 950
1242 975
1296 1000
1350 1025
1404 1050
1458 1050
1512 1075
1536 1087
1566 1125
1620 1137
1674 1162
1728 1187
192-972mhz may be can more low but hard to try for me

How to get better performance in games (root required)

I just wanted to share a few tricks i learned to get graphics-intensive games to run much more smoothly. These commands should be run in android terminal emulator as root, in adb shell as root, or ran as a script with any script-running app with root privileges
All of the following is only temporary and will be reset to normal after a reboot
Code:
stop mpdecision
stops the hotplugging binary used to turn on/off extra cpus we want this gone because we want to specify which cpus are online ourselves
Code:
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu3/online
turns on the other cpu cores (you probably don't need all 3 extra cores on, just turning cpu1 online makes a big difference)
Code:
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
sets all online cpus to maximum frequency
Code:
echo performance > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
sets the gpu to stay at maximum frequency
as a script:
Code:
#!/system/bin/sh
stop mpdecision
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu3/online
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
would this help improve general smoothness across the ui and other apps? Does it reduce the choppiness in the maps app????
It would, but i'm not sure how long the battery would last.
Faux kernel with Faux Clock you can do all this! It is great!
Jeepers. Seems the device gets hot enough without doing this, but what makes the user happy.
rushless said:
Jeepers. Seems the device gets hot enough without doing this, but what makes the user happy.
Click to expand...
Click to collapse
havent noticed mine get that hot at all?
Perhaps subjective to the user. Playing 3d games gets the device hot and OC ing will get it hotter. If the user does not mind, that is what matters.
may add this to the roms/ guides / etc list
bsimpson1 said:
as a script:
Code:
#!/system/bin/sh
stop mpdecision
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu3/online
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
Click to expand...
Click to collapse
You might also want a script for when you're done with gaming. Probably something like:
Code:
#!/system/bin/sh
start mpdecision
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
This way once you're done with gaming/whatever, the phone can go back to scaling down CPU speeds and hotplugging cores to save battery. It's not very useful for an idle phone to have all 4 cores active and running at full speed.
What if I just reboot the phone, would that stop the script(s)? Anyone try the S4 with PSP emulator (PPSSPP)?
IamPro said:
What if I just reboot the phone, would that stop the script(s)? Anyone try the S4 with PSP emulator (PPSSPP)?
Click to expand...
Click to collapse
Rebooting would restart mpdecision, and therefore let your hotplugging go back to working order. I'm not certain it would reset your governor, though. So your phone may still be running at full speed 24/7, even after a reboot.
Cilraaz said:
You might also want a script for when you're done with gaming. Probably something like:
Code:
#!/system/bin/sh
start mpdecision
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
This way once you're done with gaming/whatever, the phone can go back to scaling down CPU speeds and hotplugging cores to save battery. It's not very useful for an idle phone to have all 4 cores active and running at full speed.
Click to expand...
Click to collapse
I don't think start mpdecision will do what you're intending but according to cat "/proc/`pgrep mpdecision`/cmdline" it was started by "mpdecision --nosleep --avg_comp"

Persistently Setting CPU Frequency

Persistently setting cpu frequency
I can't seem to set the cpu frequency. I've tried a number of utilities (e.g. cpufreqd / cpufrequtils), as well as just manually editing the cpu frequency using commands like:
Code:
echo performance | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
Doing this works for a short time, but as soon as I do any cpu-intensive work, the file /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq seems to be overwritten.
This doesn't happen if I boot into android, and use an app like SetCPU, and then do the same amount of cpu work.

Keeping oom_adj value of specific apps low permantly

Hi there,
My Messaging APP can hardly stay running in background, and this cause me receive those important messages late. After digging in some information, I found that changing the three oom values of the process can make LMK see this process as high priority and won't kill it easily. By the way, I also changed niceness. However, it seems that Android system will change those oom values itself after a particular duration, so my tweak can only take effect in a short time. Is there any way to lock oom values or reach the same result?
My script of changing oom values and niceness:
Code:
#!/system/bin/sh
X=$(pidof jp.naver.line.android)
echo "-17" > /proc/$X/oom_adj
echo "0" > /proc/$X/oom_score
echo "-1000" > /proc/$X/oom_score_adj
renice -n -20 $X

Categories

Resources