[Q] Toggle SOC C-States - Nexus 4 Q&A, Help & Troubleshooting

Anyone know how to toggle the C-States for C0,C1,C2,C3 without an kernel app, like in a init.d script ¨
Edit:
echo 1 > /sys/module/pm_8x60/modes/cpu0/wfi/idle_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu1/wfi/idle_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu2/wfi/idle_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu3/wfi/idle_enabled
echo 0 > /sys/module/pm_8x60/modes/cpu0/retention/idle_enabled
echo 0 > /sys/module/pm_8x60/modes/cpu1/retention/idle_enabled
echo 0 > /sys/module/pm_8x60/modes/cpu2/retention/idle_enabled
echo 0 > /sys/module/pm_8x60/modes/cpu3/retention/idle_enabled
echo 0 > /sys/module/pm_8x60/modes/cpu0/standalone_power_collapse/idle_enabled
echo 0 > /sys/module/pm_8x60/modes/cpu1/standalone_power_collapse/idle_enabled
echo 0 > /sys/module/pm_8x60/modes/cpu2/standalone_power_collapse/idle_enabled
echo 0 > /sys/module/pm_8x60/modes/cpu3/standalone_power_collapse/idle_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu0/power_collapse/idle_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu1/power_collapse/idle_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu2/power_collapse/idle_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu3/power_collapse/idle_enabled

Related

Universal Script for Android Phone

Create 00tweaks and put all the codes inside 00tweaks then put the file to system/etc/init.d
This universal script boost RAM performance.
This universal script mounts all partition as NOATIME
This universal script lessen lags on selected applications (MMS / Handcent / DialerOne)
This universal script enhances deadline scheduler
This universal script performs background process to check screen state
Click to expand...
Click to collapse
Code:
#!/system/bin/sh
#remounting the file systems with noatime and nodiratime flags to save battery and CPU cycles
for k in $(busybox mount | grep relatime | cut -d " " -f3)
do
sync
busybox mount -o remount,noatime,nodiratime $k
done
#if mounting is not successful then manual mounting will do the thing for you
mount -o remount,noatime,nodiratime auto /
mount -o remount,noatime,nodiratime auto /dev
mount -o remount,noatime,nodiratime auto /proc
mount -o remount,noatime,nodiratime auto /sys
mount -o remount,noatime,nodiratime auto /mnt/asec
mount -o remount,noatime,nodiratime auto /system
mount -o remount,noatime,nodiratime auto /data
mount -o remount,noatime,nodiratime auto /cache
mount -o remount,noatime,nodiratime auto /mnt/sdcard
mount -o remount,noatime,nodiratime auto /mnt/secure/asec
mount -o remount,noatime,nodiratime auto /mnt/sdcard/.android_secure
#flags every mounted partition as non rotational and increases it's cache size for more read speed
MTD=`ls -d /sys/block/mtd*`;
LOOP=`ls -d /sys/block/loop*`;
RAM=`ls -d /sys/block/ram*`;
MMC=`ls -d /sys/block/mmc*`;
for j in $MTD $LOOP $RAM
do
echo "0" > $j/queue/rotational;
echo "4096" > $j/queue/read_ahead_kb;
done
echo "4096" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
for a in $MTD $MMC
do
echo "512" > $a/queue/nr_requests;
done
#internet speed tweaks
echo 0 > /proc/sys/net/ipv4/tcp_timestamps;
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse;
echo 1 > /proc/sys/net/ipv4/tcp_sack;
echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle;
echo 1 > /proc/sys/net/ipv4/tcp_window_scaling;
echo 5 > /proc/sys/net/ipv4/tcp_keepalive_probes;
echo 30 > /proc/sys/net/ipv4/tcp_keepalive_intvl;
echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout;
echo 404480 > /proc/sys/net/core/wmem_max;
echo 404480 > /proc/sys/net/core/rmem_max;
echo 256960 > /proc/sys/net/core/rmem_default;
echo 256960 > /proc/sys/net/core/wmem_default;
echo 4096 16384 404480 > /proc/sys/net/ipv4/tcp_wmem;
echo 4096 87380 404480 > /proc/sys/net/ipv4/tcp_rmem;
#vm management tweaks
echo "0" > /proc/sys/vm/swappiness;
echo "95" > /proc/sys/vm/dirty_ratio;
echo "10" > /proc/sys/vm/vfs_cache_pressure;
echo "20480" > /proc/sys/vm/min_free_kbytes;
echo "1" > /proc/sys/vm/oom_kill_allocating_task;
echo "0" > /proc/sys/vm/laptop_mode;
echo "60000" > /proc/sys/vm/dirty_expire_centisecs;
echo "60" > /proc/sys/vm/dirty_background_ratio;
echo "6000" > /proc/sys/vm/dirty_writeback_centisecs;
echo "3" > /proc/sys/vm/drop_caches;
#kernel tweaks
echo "8" > /proc/sys/vm/page-cluster;
echo "64000" > /proc/sys/kernel/msgmni;
echo "64000" > /proc/sys/kernel/msgmax;
echo "10" > /proc/sys/fs/lease-break-time;
echo 500 512000 64 2048 > /proc/sys/kernel/sem;
# use deadline scheduler
echo deadline > /sys/class/block/mmcblk0/queue/scheduler;
echo deadline > /sys/class/block/stl14/queue/scheduler;
echo deadline > /sys/class/block/stl13/queue/scheduler;
echo deadline > /sys/class/block/stl12/queue/scheduler;
echo 8 > /sys/class/block/mmcblk0/queue/iosched/fifo_batch;
echo 8 > /sys/class/block/stl14/queue/iosched/fifo_batch;
echo 8 > /sys/class/block/stl13/queue/iosched/fifo_batch;
echo 8 > /sys/class/block/stl12/queue/iosched/fifo_batch;
echo 400 > /sys/class/block/mmcblk0/queue/iosched/read_expire;
echo 400 > /sys/class/block/stl14/queue/iosched/read_expire;
echo 400 > /sys/class/block/stl13/queue/iosched/read_expire;
echo 400 > /sys/class/block/stl12/queue/iosched/read_expire;
echo 4 > /sys/class/block/mmcblk0/queue/iosched/writes_starved;
echo 4 > /sys/class/block/stl14/queue/iosched/writes_starved;
echo 4 > /sys/class/block/stl13/queue/iosched/writes_starved;
echo 4 > /sys/class/block/stl12/queue/iosched/writes_starved;
#setprop
setprop wifi.supplicant_scan_interval 600;
setprop windowsmgr.max_events_per_sec 260;
setprop ro.lge.proximity.delay 25;
setprop mot.proximity.delay 75;
setprop net.tcp.buffersize.default 4096,87380,256960,4096,16384,256960;
setprop net.tcp.buffersize.wifi 4096,87380,256960,4096,16384,256960;
setprop net.tcp.buffersize.umts 4096,87380,256960,4096,16384,256960;
setprop ro.HOME_APP_ADJ 1;
setprop ro.mot.eri.losalert.delay 1000;
setprop video.accelerate.hw 1;
setprop ro.ril.disable.power.collapse 0;
setprop pm.sleep_mode 1;
setprop media.stagefright.enable-player true;
#lowmemory
FOREGROUND_APP_MEM="2560";
VISIBLE_APP_MEM="4096";
SECONDARY_SERVER_MEM="6144";
HIDDEN_APP_MEM="17408";
CONTENT_PROVIDER_MEM="19456";
EMPTY_APP_MEM="23552";
#governor scaling awake
GOVERNOR_SCALE="ondemand";
GOVERNOR_FREQENCY_MAX="800000";
GOVERNOR_FREQENCY_MIN="245760";
SAMPLING_RATE="50000";
FREQ_STEP="40";
UP_THRESHOLD="90";
DOWN_THRESHOLD="20";
#governor scaling sleep
SLEEP_SCALE="ondemand";
SLEEP_FREQENCY_MAX="480000";
SLEEP_FREQENCY_MIN="245760";
XSAMPLING_RATE="100000";
XFREQ_STEP="15";
XUP_THRESHOLD="90";
XDOWN_THRESHOLD="20";
#locking app
LOCK_APP_IN_MEMORY_ENABLED="0"
LOCK_APP_SU="1"
LOCK_APP_DIALER="0"
LOCK_APP_MMS="0"
LOCK_APP_HANDCENT="0"
# =========
# remove lag when answering phone calls
# =========
MAX_PHONE()
{
pidphone=`pidof com.android.phone`;
if [ $pidphone ];
then
/system/xbin/echo "-17" > /proc/$pidphone/oom_adj;
renice -20 $pidphone;
if [ $MAX_APP -eq "1" ];
then
exit;
else
MAX_APP_STARTER;
MAX_APP=1;
exit;
fi;
else
sleep 3;
MAX_PHONE;
fi;
}
# =========
# remove lag from su (root)
# =========
MAX_SU()
{
pidsu=`pidof com.noshufou.android.su`;
if [ $pidsu ];
then
/system/xbin/echo "-17" > /proc/$pidsu/oom_adj;
renice -20 $pidsu;
exit;
else
sleep 3;
MAX_SU;
fi;
}
# =========
# remove lag from Clock
# =========
MAX_DIALER()
{
piddialer=`pidof kz.mek.DialerOne`;
if [ $piddialer ];
then
/system/xbin/echo "-17" > /proc/$piddialer/oom_adj;
renice -10 $piddialer;
exit;
else
sleep 3;
MAX_DIALER;
fi;
}
# =========
# remove lag from MMS
# =========
MAX_MMS()
{
pidmms=`pidof com.android.mms`;
if [ $pidmms ];
then
/system/xbin/echo "-17" > /proc/$pidmms/oom_adj;
renice -10 $pidmms;
exit;
else
sleep 3;
MAX_MMS;
fi;
}
# =========
# remove lag from HANDCENT
# =========
MAX_HANDCENT()
{
pidhandcent=`pidof com.handcent.nextsms`;
if [ $pidhandcent ];
then
/system/xbin/echo "-17" > /proc/$pidhandcent/oom_adj;
renice -10 $pidhandcent;
exit;
else
sleep 3;
MAX_HANDCENT;
fi;
}
# =========
# Background process to optimize process
# =========
MAX_APP_STARTER()
{
if [ $LOCK_APP_IN_MEMORY_ENABLED -eq "1" ];
then
if [ $LOCK_APP_SU -eq "1" ];
then
(while [ 1 ];
do
sleep 5;
MAX_SU;
done &);
fi;
if [ $LOCK_APP_MMS -eq "1" ];
then
(while [ 1 ];
do
sleep 3;
MAX_MMS;
done &);
fi;
if [ $LOCK_APP_HANDCENT -eq "1" ];
then
(while [ 1 ];
do
sleep 3;
MAX_HANDCENT;
done &);
fi;
if [ $LOCK_APP_DIALER -eq "1" ];
then
(while [ 1 ];
do
sleep 3;
MAX_DIALER;
done &);
fi;
exit;
else
(while [ 1 ];
do
sleep 3;
MAX_APP_STARTER;
done &);
fi;
}
if [ $LOCK_APP_IN_MEMORY_ENABLED -eq "1" ];
then
(while [ 1 ];
do
sleep 3;
MAX_PHONE;
done &);
fi;
GOV_MODE()
{
echo "1" >/proc/sys/vm/overcommit_memory;
echo "4" > /proc/sys/vm/min_free_order_shift;
echo $FOREGROUND_APP_MEM,$VISIBLE_APP_MEM,$SECONDARY_SERVER_MEM,$HIDDEN_APP_MEM,$CONTENT_PROVIDER_MEM,$EMPTY_APP_MEM > /sys/module/lowmemorykiller/parameters/minfree;
echo $GOVERNOR_SCALE > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
echo $GOVERNOR_FREQENCY_MAX > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
echo $GOVERNOR_FREQENCY_MIN > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo $SAMPLING_RATE > /sys/devices/system/cpu/cpu0/cpufreq/$GOVERNOR_SCALE/sampling_rate;
echo $FREQ_STEP > /sys/devices/system/cpu/cpu0/cpufreq/$GOVERNOR_SCALE/freq_step;
echo $UP_THRESHOLD > /sys/devices/system/cpu/cpu0/cpufreq/$GOVERNOR_SCALE/up_threshold;
echo $DOWN_THRESHOLD > /sys/devices/system/cpu/cpu0/cpufreq/$GOVERNOR_SCALE/down_threshold;
}
SLEEP_MODE()
{
echo "1" >/proc/sys/vm/overcommit_memory;
echo "4" > /proc/sys/vm/min_free_order_shift;
echo $FOREGROUND_APP_MEM,$VISIBLE_APP_MEM,$SECONDARY_SERVER_MEM,$HIDDEN_APP_MEM,$CONTENT_PROVIDER_MEM,$EMPTY_APP_MEM > /sys/module/lowmemorykiller/parameters/minfree;
echo $SLEEP_SCALE > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
echo $SLEEP_FREQENCY_MAX > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
echo $SLEEP_FREQENCY_MIN > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo $XSAMPLING_RATE > /sys/devices/system/cpu/cpu0/cpufreq/$SLEEP_SCALE/sampling_rate;
echo $XFREQ_STEP > /sys/devices/system/cpu/cpu0/cpufreq/$SLEEP_SCALE/freq_step;
echo $XUP_THRESHOLD > /sys/devices/system/cpu/cpu0/cpufreq/$SLEEP_SCALE/up_threshold;
echo $XDOWN_THRESHOLD > /sys/devices/system/cpu/cpu0/cpufreq/$SLEEP_SCALE/down_threshold;
}
# =========
# Background process to check screen state
# =========
(while [ 1 ];
do
STATE=`cat /sys/power/wait_for_fb_wake`;
GOV_MODE;
sleep 3;
STATE=`cat /sys/power/wait_for_fb_sleep`;
SLEEP_MODE;
sleep 3;
done &);
Some brief explanation for the contents of the script
1. /proc/sys/vm/laptop_mode
How many seconds after a read should a writeout of changed files start (this is based on the assumption that a read will cause an otherwise spun down disk to spin up again).
2. /proc/sys/vm/dirty_writeba​ck_centisecs
How often the kernel should check if there is "dirty" (changed) data to write out to disk (in centiseconds).
3./proc/sys/vm/dirty_expir​e_centisecs
How old "dirty" data should be before the kernel considers it old enough to be written to disk. It is in general a good idea to set this to the same value as dirty_writeback_centisecs above.
4./proc/sys/vm/dirty_ratio​
The maximum amount of memory (in percent) to be used to store dirty data before the process that generates the data will be forced to write it out. Setting this to a high value should not be a problem as writeouts will also occur if the system is low on memory.
5./proc/sys/vm/dirty_backg​round_ratio
The lower amount of memory (in percent) where a writeout of dirty data to disk is allowed to stop. This should be quite a bit lower than the above dirty_ratio to allow the kernel to write out chunks of dirty data in one go.
I thought I should return the Tweak Manager's 00tweaks script back to initramfs
let me give it a try
what if i already have 00tweaks? should i had this script to the current file or substitute?
Hey, the values are similar to CF-Root Great then, gonna try it out
What should I do if I want to try your script, but I have already used CF-Root With Tweak Manager that also using another script in 00tweaks file
Wow I just ran this on GSB 3.8 workshed for the eris. And WOW the phone rings on 1 1/2 rings with a ringtone and the screen lights up. Very nice work. I hope you don't mind but i posted a link from the eris fourms to this file. I been looking for for so long on how to get rid of the rintone LAG and WOW i think you got it! Thank you
How to create the script?
Thnx
A lil question, this wont collide with the V6 Supercharger?
Hey guys,
can somebody please tell me how to make a script of this? I really want to know, but i'm new to this.
I can't find anything on the "search".
Cheers
QNBT said:
A lil question, this wont collide with the V6 Supercharger?
Click to expand...
Click to collapse
I think something does because I am getting complete homescreen redraws since I started using this a couple days ago. The phone seems to boot way faster and seems to run a little better but I think there is a conflict somewhere.
Sgace said:
Hey guys,
can somebody please tell me how to make a script of this? I really want to know, but i'm new to this.
I can't find anything on the "search".
Cheers
Click to expand...
Click to collapse
You don't have to make a script just copy it all to a text document on your desktop and after you save it delete the .txt at the end. Then put it on your SD card and use Root Explorer, or similar, to move it the proper location. I set the ownership and permissions the same as other files in the same location and rebooted. Just be sure to tap the "R/W" button at the top of the screen if you are using Root Explorer so you have read/write permission to work in the folder.
PieceKeepr said:
You don't have to make a script just copy it all to a text document on your desktop and after you save it delete the .txt at the end. Then put it on your SD card and use Root Explorer, or similar, to move it the proper location. I set the ownership and permissions the same as other files in the same location and rebooted. Just be sure to tap the "R/W" button at the top of the screen if you are using Root Explorer so you have read/write permission to work in the folder.
Click to expand...
Click to collapse
Hey,
thnx man. Found notepad++ and made a text file with that.
Tried the script for a couple of ours and for my personal feeling it made my phone slower at multiple points. Also Quadrant standard gave me a lower score (11-13) then when i'm using 00tweaks/v4 tt.
So this goes out the door.
Cheers
I hate bringing things back from the dead, so I apologize in advance.
If I want just the atime section of this script, do I just keep the first part? Where does it stop?
AUTO
what does the auto do in the mounting script?

Can someone help me look at this code?

I put this inside of init.d can it won't excute. So I run it by scriptmanager and it gave me errors in line 3, 4, 5, 6 ...11 write error: bad file number.
Any idea? Thanks.
#!/system/xbin/bash
if [ -d "/sys/devices/system/cpu/cpufreq/smartass" ]; then
echo 768000 > /sys/devices/system/cpu/cpufreq/smartass/awake_ideal_freq;
echo 200000 > /sys/devices/system/cpu/cpufreq/smartass/sleep_ideal_freq;
echo 768000 > /sys/devices/system/cpu/cpufreq/smartass/sleep_wakeup_freq;
echo 85 > /sys/devices/system/cpu/cpufreq/smartass/max_cpu_load;
echo 60 > /sys/devices/system/cpu/cpufreq/smartass/min_cpu_load;
echo 150000 > /sys/devices/system/cpu/cpufreq/smartass/ramp_up_step;
echo 150000 > /sys/devices/system/cpu/cpufreq/smartass/ramp_down_step;
echo 48000 > /sys/devices/system/cpu/cpufreq/smartass/up_rate_us;
echo 49000 > /sys/devices/system/cpu/cpufreq/smartass/down_rate_us;
fi
pump. Should I post it here or somewhere else? Can mod please move this to "Android dev" or a proper forum?
You don't need the if and end if.
Also, i am pretty sure that the #!system/... is going to the right place, you can just flash my indian madness mod (thats what i basically is plus it adds virtuous OC) I'll get you a link
---------- Post added at 02:27 AM ---------- Previous post was at 02:26 AM ----------
http://forum.xda-developers.com/showthread.php?t=1634061
Make sure that your bash shell really reside under /system/xbin/bash
Since you get an error for every line in your script it mean that the interpreter can't read it correctly. So it might be that BASH is located somewhere else.
Ziv
ibuddler said:
I put this inside of init.d can it won't excute. So I run it by scriptmanager and it gave me errors in line 3, 4, 5, 6 ...11 write error: bad file number.
Any idea? Thanks.
#!/system/xbin/bash
if [ -d "/sys/devices/system/cpu/cpufreq/smartass" ]; then
echo 768000 > /sys/devices/system/cpu/cpufreq/smartass/awake_ideal_freq;
echo 200000 > /sys/devices/system/cpu/cpufreq/smartass/sleep_ideal_freq;
echo 768000 > /sys/devices/system/cpu/cpufreq/smartass/sleep_wakeup_freq;
echo 85 > /sys/devices/system/cpu/cpufreq/smartass/max_cpu_load;
echo 60 > /sys/devices/system/cpu/cpufreq/smartass/min_cpu_load;
echo 150000 > /sys/devices/system/cpu/cpufreq/smartass/ramp_up_step;
echo 150000 > /sys/devices/system/cpu/cpufreq/smartass/ramp_down_step;
echo 48000 > /sys/devices/system/cpu/cpufreq/smartass/up_rate_us;
echo 49000 > /sys/devices/system/cpu/cpufreq/smartass/down_rate_us;
fi
Click to expand...
Click to collapse
Also make sure that files in /sys/devices/system/cpu/cpufreq/smartass/ exist. Seeing as you don't get an error on line 1 or 2, I'd say it found bash, and that the directory exists, but the files do not. There is a small chance that this may also need to be run as root so that you have write permissions to those files. I would have expected "permission denied" in that case.
I think that's what the If condition is suppose to check. that the smartass directory do exist. Ot shouldn't even enter into that section if there's no smartass directory.
Can it be that your syntax for the if clause is wrong?
Ziv

Ram/Partitions bandwidth tweak

Here is a tweak that I use in my ROMs that adjusts the individual caches for the ram/disk partitions. I have adjusted it to work with the nexus 10. Depending on your minfree settings you may need to change the size because they work hand in hand. Right now they are set to 2048k, but values anywhere from 256k to 8192k can make a huge difference depending on your setup. 128k is default. Add it to an init.d file.
echo 2048 > /sys/devices/virtual/bdi/0:18/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/0:19/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:0/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:1/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:2/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:3/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:4/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:5/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:6/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:7/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:8/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:9/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:10/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:11/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:12/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:13/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:14/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:15/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:0/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:1/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:2/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:3/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:4/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:5/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:6/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:7/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:8/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:9/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:10/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:11/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:12/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:13/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:14/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:15/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:16/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:17/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:18/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:19/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:20/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:21/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:22/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:23/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:24/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:25/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:26/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:27/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:28/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:29/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:30/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:31/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:32/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:33/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:34/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:35/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:36/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:37/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:38/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/179:8/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/179:16/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/253:0/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:0/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:1/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:2/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:3/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:4/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:5/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:6/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:7/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:8/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:9/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:10/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:11/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:12/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:13/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:14/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:15/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:16/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:17/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:18/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:19/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:20/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:21/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:22/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:23/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:24/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:25/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:26/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:27/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:28/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:29/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:30/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:31/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:32/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:33/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:34/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:35/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:36/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:37/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:38/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/default/read_ahead_kb
I was hoping someone else would ask this so I dont look dumb, but do we really have that many partitions in our storage? Or are all those lines just there so that if a partition happens to be created at some point with the next un-used ID in our tablets list then it will still be taken care of by this script?
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
ROM Toolbox can set the SD Boost feature also (Pro can anyway, not 100% sure on Free version). 4096kb does appear to get the best results though, and default is indeed 128kb
espionage724 said:
ROM Toolbox can set the SD Boost feature also (Pro can anyway, not 100% sure on Free version). 4096kb does appear to get the best results though, and default is indeed 128kb
Click to expand...
Click to collapse
It only adjusts these lines:
echo 2048 > /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/179:8/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/179:16/read_ahead_kb
Which in other devices controls the SD card cache. My tweaks adjusts the cache for the entire system.
EniGmA1987 said:
I was hoping someone else would ask this so I dont look dumb, but do we really have that many partitions in our storage? Or are all those lines just there so that if a partition happens to be created at some point with the next un-used ID in our tablets list then it will still be taken care of by this script?
Click to expand...
Click to collapse
Go here and have a look for yourself : /sys/devices/virtual/bdi/

[MOD] HBBTweaks v32 (11/23) - battery and performance

HBBTweaks is a package of Kernel and build.prop tweaks I've done (read, tested, benchmarked, saw the sources, etc) and shared on a Facebook group since version 1 (long time ago huh?)
Lots of users tested and most of them noticed improvements in battery life *and* performance, so I decided to publish here as you may find it helpful too..
It is just a .zip file you can install with CWM or TWRP the same way as you install a ROM. It should work on ALL ROMs but *I* have only tested it with CM10.x and CM11 ones. Don't worry, if anything goes wrong you can easily uninstall it and everything will be reverted.
WARNING: it will activate some overclocking (cpu: 1050mhz, gpu: 700mhz) and undervolting *if* your Kernel is able to, so your phone may get unstable if it's not as GOOD as mine, LOL.
If you get some reboots after installing it, try the alternate versions.. First try a1, then try a2. They won't save as MUCH battery as the original one but you'll definitively notice improvements as this isn't just a "switch-on-the-OC script" !!
Download link: http://d-h.st/iuT (Multi-installer, with two "alternate" versions and uninstaller included)
See if your phone gets a bit more responsive and if your battery life is better then post your thoughts here
CHANGELOG
31 -> 32
abyssplug or pegasusqplus as default
faster gpu clock reaction
sqlite3 and zipalign updated
touchboost to 800mhz with 200ms duration (default was 500ms)
higher intervals for the kernel scheduler
won't save any modified data to mmc/sd for up to 5m
tweaked abyssplug and pegasusq
won't disable zram, instead will use it more if it's already enabled
30 -> 31
sqlite3 included to optimize some databases
other minor tweaks
don't forget to reinstall it after any rom update!
29 -> 30
it tries to disable zram giving better performance and battery
ext4 and sioplus tweaks!
abyssplug by default, tweaked also
28 -> 29
kernel's sched_* back to default. better performance
testing some ext4 tweaks
27 -> 28
Aroma installer providing 2 alternate installation options and an uninstaller.
10.1 (and MIUI) compatible
Different swappiness and page-cluster values for zRam swapping or "normal" swapping
ddr_opp set to 100%, don't know if it will stick. it's faster here.
tweaked the way minfree is set and also the mounting options
26 -> 27
A typo (while I was translating) was preventing undervolting.. that's why nobody complained about reboots with the full version.. lol
XDA:DevDB Information
HBBTweaks, Tool/Utility for the Samsung Galaxy S Advance I9070
Contributors
fbs
Version Information
Status: Testing
Created 2014-06-16
Last Updated 2014-11-25
Works on JB roms too ?
Normally I can't overclock, it causes the known freezes and reboot issues.
So which verison should I pick? Alternate 1 or Alternate 2?
danielbulan97 said:
Works on JB roms too ?
Click to expand...
Click to collapse
It should..
coffeecore said:
Normally I can't overclock, it causes the known freezes and reboot issues.
So which verison should I pick? Alternate 1 or Alternate 2?
Click to expand...
Click to collapse
It's not a big overclock to the cpu(it's limited to 1050mhz), it's mostly to the gpu.. so, I think you could try the original one and then a1.. come on, the files are so small..
fbs said:
It's not a big overclock to the cpu(it's limited to 1050mhz), it's mostly to the gpu.. so, I think you could try the original one and then a1.. come on, the files are so small..
Click to expand...
Click to collapse
Haha I know, sorry for my lazyness :cyclops:
Edit: You should/can mention in the OP that OC is limited to 1050mhz.
I will download and try!
I am using Resurection Remix. The rom is awesome but i am having some battery drains..
I will try this tweaks for some days and test if the battery goes better
thanks!
@fbs Thanks man, tried original one and everything is fine. Waiting a couple of days for making a correct review. One question, I set CPU to 1000 (max.) and after that I flashed your script. When looking for which states my processor has been on there is 1000 Mhz the highest (I've set this before flashing script) but is my CPU actually running on 1050mhz? Would like to know more about this script
Thanks anyway, it's nice :thumbup:
PS; On what ROM are you now?
sent with my S Advance.
coffeecore said:
@fbs Thanks man, tried original one and everything is fine. Waiting a couple of days for making a correct review. One question, I set CPU to 1000 (max.) and after that I flashed your script. When looking for which states my processor has been on there is 1000 Mhz the highest (I've set this before flashing script) but is my CPU actually running on 1050mhz? Would like to know more about this script
PS; On what ROM are you now?
Click to expand...
Click to collapse
Well it sets max frequency to 1050 right after booting, but if your ROM or any app (like No-Frills) set it back to 1000, it will keep on 1000.
Right now I'm using Paranoid 4.4 build by t4n017 available here.. it's faster than vanilla cm11 and Vanir, to me..
v26 changelog?
moscka said:
v26 changelog?
Click to expand...
Click to collapse
Did you use V25 ?
Is KitKat based custom ROM supported?
Is KitKat based custom ROM supported? TQ.
xbean said:
Is KitKat based custom ROM supported? TQ.
Click to expand...
Click to collapse
Yes
I'll give it a try tomorrow.
coffeecore said:
Yes
Click to expand...
Click to collapse
Thanks. I'll give it a try tomorrow. Cheers.
King ov Hell said:
Did you use V25 ?
Click to expand...
Click to collapse
Yes, I was on v25.
The system is a little snappier, but the most noticeable change is the battery save (undervolting).
I got 4h and 30m of screen on and my battery is not good. I have it for 18 months.
I'm on PA 4.4.3.
Essential
II'm using this tweak since version 23. Currently use version 26 alt1 with Vanir 4.4.3 ROM and everything is running perfectly. Really feel improvements in battery performance and the performance of the device. :good::good::good::good::good:
Thank U Bro.
and what about the battery life
mhmod222 said:
and what about the battery life
Click to expand...
Click to collapse
Try it out, it is worth it man :good:
---------- Post added at 11:57 PM ---------- Previous post was at 11:21 PM ----------
@fbs
It is not recommended to flash this script right after flashing ROM and Gapps, right?
Booting is a requirement.
coffeecore said:
Try it out, it is worth it man :good:
---------- Post added at 11:57 PM ---------- Previous post was at 11:21 PM ----------
@fbs
It is not recommended to flash this script right after flashing ROM and Gapps, right?
Booting is a requirement.
Click to expand...
Click to collapse
You can flash it any time. Don't need to boot after initial ROM/GApps flash.. :good:
It just won't work if you install it BEFORE the ROM itself as the ROM's installer will format /system and everything will be lost
If anyone's interested, here are the two main "scripts" my tweak uses. Anyone could read it inside the .zip or /system/etc/init.d folder, but I know some are lazy then I'll copy/paste here
#!/system/bin/sh
#hbbtweaksv27
echo z1hbbkern START
#activate KSM, but less pages in a bunch to prevent lagging
echo 51 > /sys/kernel/mm/ksm/sleep_millisecs;
echo 29 > /sys/kernel/mm/ksm/pages_to_scan;
echo 1 > /sys/kernel/mm/ksm/run;
#and activate uksm if it has it
echo 1 > /sys/kernel/mm/uksm/run;
echo medium > /sys/kernel/mm/uksm/cpu_governor;
echo 439 > /sys/kernel/mm/uksm/sleep_millisecs;
#I read somewhere 5ms should be the maximum for a dual-core, our default was 10ms
echo "3999971" > /proc/sys/kernel/sched_latency_ns;
echo "1000003" > /proc/sys/kernel/sched_shares_window;
#higher avg time, maybe lessen the overhead
echo "2003" > /proc/sys/kernel/sched_time_avg;
#1.5ms was the minimum time a thread could be on cpu.
#I think it's too much time, lowered to 0,1ms. Same for threads that are waking up
echo "100003" > /proc/sys/kernel/sched_wakeup_granularity_ns;
echo "100003" > /proc/sys/kernel/sched_min_granularity_ns;
echo "150000" > /proc/sys/kernel/sched_migration_cost;
#a forked thread should run right after
echo 1 > /proc/sys/kernel/sched_child_runs_first;
echo 0 > /proc/sys/kernel/sched_tunable_scaling;
#won't enforce a time for real-time tasks.. maybe lessen the overhead?
echo -1 > /proc/sys/kernel/sched_rt_runtime_us;
echo 2000000 > /proc/sys/kernel/sched_rt_period_us;
#updated file-data that's cached in ram will stay on it 63s before being written
echo "6317" > /proc/sys/vm/dirty_writeback_centisecs;
echo "6317" > /proc/sys/vm/dirty_expire_centisecs;
#but if we have dynamic writebacks, it will stay only 3s when display is active and 123s when not
echo "317" > /proc/sys/vm/dirty_writeback_active_centisecs;
echo "12301" > /proc/sys/vm/dirty_writeback_suspend_centisecs;
#let's almost deactivate swapping, our "disc" is ultra-super-slow!
echo "1" > /proc/sys/vm/swappiness;
#let's fix the amount of memory that could be dirty before it start writing to mmc
echo "8000000" > /proc/sys/vm/dirty_background_bytes;
#let's fix the maximum amount of memory an app can defile before it get blocked
echo "14000000" > /proc/sys/vm/dirty_bytes;
#4mb really "free", not even used for caching
echo 4096 > /proc/sys/vm/min_free_kbytes;
#1=same amount for every zone.. (?)
echo 1 > /proc/sys/vm/min_free_order_shift;
#3s frequency for stats. idk if there's any drawbacks
echo 3 > /proc/sys/vm/stat_interval;
echo 0 > /proc/sys/vm/highmem_is_dirtyable;
echo "30" > /proc/sys/kernel/panic;
echo "0" > /proc/sys/kernel/panic_on_oops;
echo "0" > /proc/sys/vm/oom_kill_allocating_task;
#swap as little as possible in a bunch
echo "1" > /proc/sys/vm/page-cluster;
#less wait time, less complexity.. less memory, less packet size
echo 5 > /proc/sys/net/ipv4/tcp_fin_timeout;
echo 1 > /proc/sys/net/ipv4/tcp_timestamps;
echo 5 > /proc/sys/net/ipv4/tcp_challenge_ack_limit;
echo 1 > /proc/sys/net/ipv4/tcp_sack;
echo 0 > /proc/sys/net/ipv4/tcp_dsack;
echo 64 > /proc/sys/net/ipv4/tcp_base_mss;
echo 0 > /proc/sys/net/ipv4/tcp_retrans_collapse;
echo 0 > /proc/sys/net/ipv4/tcp_abc;
echo 0 > /proc/sys/net/ipv4/tcp_mtu_probing;
echo 0 > /proc/sys/net/ipv4/tcp_ecn;
echo 21 > /proc/sys/net/ipv4/tcp_reordering;
echo 262144 > /proc/sys/net/core/wmem_default;
echo 262144 > /proc/sys/net/core/rmem_default;
echo 1 > /proc/sys/net/ipv4/tcp_no_metrics_save;
echo 512 1024 4096 > /proc/sys/net/ipv4/tcp_mem;
echo illinois > /proc/sys/net/ipv4/tcp_congestion_control;
#max of 4mb for net reads and writes, should be enough
echo 4194304 > /proc/sys/net/core/rmem_max;
echo 4194304 > /proc/sys/net/core/wmem_max;
#abb-codec audio: higher gains and low power mode activated
echo on > /sys/kernel/abb-codec/anagain3;
echo gain=0 > /sys/kernel/abb-codec/anagain3;
echo on > /sys/kernel/abb-codec/hsldiggain;
echo gain=0 > /sys/kernel/abb-codec/hsldiggain;
echo on > /sys/kernel/abb-codec/hsrdiggain;
echo gain=0 > /sys/kernel/abb-codec/hsrdiggain;
echo on > /sys/kernel/abb-codec/hslowpow;
echo mode=1 > /sys/kernel/abb-codec/hslowpow;
echo on > /sys/kernel/abb-codec/hsdaclowpow;
echo mode=1 > /sys/kernel/abb-codec/hsdaclowpow;
echo on > /sys/kernel/abb-codec/hshpen;
echo mode=1 > /sys/kernel/abb-codec/hshpen;
echo on > /sys/kernel/abb-codec/classdhpg;
echo gain=10 > /sys/kernel/abb-codec/classdhpg;
echo on > /sys/kernel/abb-codec/classdwg;
echo gain=10 > /sys/kernel/abb-codec/classdwg;
echo on > /sys/kernel/abb-codec/addiggain2;
echo gain=4 > /sys/kernel/abb-codec/addiggain2;
echo on > /sys/kernel/abb-codec/eardiggain;
echo gain=0 > /sys/kernel/abb-codec/eardiggain;
echo 1 > /sys/kernel/abb-codec/chargepump;
#ramp to 800mhz when you touch the screen
echo on > /sys/kernel/mxt224e/touchboost;
echo 800000 > /sys/kernel/mxt224e/touchboost_freq;
#no fsync.
echo 1 > /sys/kernel/fsync/mode;
#mali (gpu) stuff
echo 0 > /sys/module/mali/parameters/mali_debug_level;
echo 6 > /sys/module/mali/parameters/mali_oskmem_allocorder;
#439ms instead of 1s to verify mali(gpu)'s usage
echo 439 > /sys/module/mali/parameters/mali_utilization_sampling_rate;
echo 439 > /sys/module/mali/parameters/mali_pm_sampling_rate;
echo 50331648 > /sys/module/mali/parameters/pre_allocated_memory_size_max;
echo 48 > /sys/module/mali/parameters/mali_l2_max_reads;
echo 0 > /sys/module/mali/parameters/mali_pp_scheduler_balance_jobs;
#our cpu's own powersaving is buggy and we have pegasusq
echo 0 > /sys/devices/system/cpu/sched_mc_power_savings;
echo 0 > /sys/module/dhd/parameters/dhdpm_fast;
echo 4 > /d/cpuidle/deepest_state;
#don't try to squeeze too much or too frequently (?) lessen overhead (?)
echo 64 > /sys/module/lowmemorykiller/parameters/cost;
#order of death! starting from right to left in number of pages
#first it will kill empty apps when we have less than 30720x4096 (120MB) of free ram
minfree=16384,18432,20480,24576,26624,30720;
lmk=/sys/module/lowmemorykiller/parameters/minfree;
minboot=`cat $lmk`;
while sleep 10; do
if [ `cat $lmk` != $minboot ]; then
[ `cat $lmk` != $minfree ] && echo $minfree > $lmk || exit;
fi;
done&
#I really don't know if these will help to lessen overhead or lessen lags, but....
sysctl -w vm.extfrag_threshold=800;
sysctl -w kernel.randomize_va_space=0;
echo 128 > /proc/sys/kernel/random/read_wakeup_threshold;
echo 256 > /proc/sys/kernel/random/write_wakeup_threshold;
#let's use pegasusq as governor as it's multi-core AWARE and it shut downs our second cpu
echo pegasusq > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
governor=reset;
while true; do
current=`cut -d\[ -f2 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor | cut -d\] -f1`;
if [ $governor != $current ]; then
governor=$current;
if [ $governor == "pegasusq" ]; then
echo 40000 > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_rate;
echo 400000 > /sys/devices/system/cpu/cpufreq/pegasusq/freq_for_responsiveness;
echo 70 > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold_at_min_freq;
echo 99 > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold;
echo 20 > /sys/devices/system/cpu/cpufreq/pegasusq/down_differential;
echo 20 > /sys/devices/system/cpu/cpufreq/pegasusq/freq_step;
echo 800000 > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_freq_1_1;
echo 400000 > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_freq_2_0;
echo 300 > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_rq_1_1;
echo 110 > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_rq_2_0;
echo 3 > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_up_rate;
echo 2 > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_down_rate;
echo 2 > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_down_factor;
fi;
if [ $governor == "lulzactiveq" ]; then
echo 3 > /sys/devices/system/cpu/cpufreq/lulzactiveq/screen_off_min_step;
echo 90 > /sys/devices/system/cpu/cpufreq/lulzactiveq/inc_cpu_load;
echo 40 > /sys/devices/system/cpu/cpufreq/lulzactiveq/dec_cpu_load;
echo 80000 > /sys/devices/system/cpu/cpufreq/lulzactiveq/up_sample_time;
echo 80000 > /sys/devices/system/cpu/cpufreq/lulzactiveq/down_sample_time;
echo 120000 > /sys/devices/system/cpu/cpufreq/lulzactiveq/hotplug_sampling_rate;
echo 2 > /sys/devices/system/cpu/cpufreq/lulzactiveq/cpu_up_rate;
echo 2 > /sys/devices/system/cpu/cpufreq/lulzactiveq/cpu_down_rate;
echo 1 > /sys/devices/system/cpu/cpufreq/lulzactiveq/pump_up_step;
echo 1 > /sys/devices/system/cpu/cpufreq/lulzactiveq/pump_down_step;
echo 800000 > /sys/devices/system/cpu/cpufreq/lulzactiveq/hotplug_freq_1_1;
echo 400000 > /sys/devices/system/cpu/cpufreq/lulzactiveq/hotplug_freq_2_0;
echo 300 > /sys/devices/system/cpu/cpufreq/lulzactiveq/hotplug_rq_1_1;
echo 110 > /sys/devices/system/cpu/cpufreq/lulzactiveq/hotplug_rq_2_0;
fi;
fi;
sleep 809;
done&
#no sleepers seems to help. others are experimental
mount -t debugfs none /sys/kernel/debug;
echo "ARCH_POWER" > /sys/kernel/debug/sched_features;
echo "NO_GENTLE_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features;
echo "NO_NORMALIZED_SLEEPERS" > /sys/kernel/debug/sched_features;
echo "NO_NEW_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features;
echo "NO_START_DEBIT" > /sys/kernel/debug/sched_features;
echo "NO_NEXT_BUDDY" > /sys/kernel/debug/sched_features;
echo "NONTASK_POWER" > /sys/kernel/debug/sched_features;
echo "AFFINE_WAKEUPS" > /sys/kernel/debug/sched_features;
#let's force the system user interface to have higher priority
while sleep 1; do
if [ `pidof com.android.systemui` ]; then
systemui=`pidof com.android.systemui`;
busybox renice -18 $systemui;
echo -17 > /proc/$systemui/oom_adj;
chmod 100 /proc/$systemui/oom_adj;
exit;
fi;
done&
#and some launchers too
list="com.android.launcher org.adw.launcher org.adwfreak.launcher com.anddoes.launcher com.android.lmt com.chrislacy.actionlauncher.pro com.cyanogenmod.trebuchet com.gau.go.launcherex com.mobint.hololauncher com.mobint.hololauncher.hd com.teslacoilsw.launcher com.tsf.shell org.zeam";
while sleep 60; do
for class in $list; do
if [ `pgrep $class` ]; then
launcher=`pgrep $class`;
echo -17 > /proc/$launcher/oom_adj;
chmod 100 /proc/$launcher/oom_adj;
busybox renice -18 $launcher;
fi;
done;
exit;
done&
echo hbbkern: adjusting frequencies and voltages/undervolt
########################## OVERCLOCK & UNDERVOLT. The alternate versions changes these!
#and you can change it too. higher VARM = higher voltage. in hexadecimal
#This is ULTRA-STABLE on my phone but yours are not like mine..
#################
#overclock gpu if needed
echo 1 > /sys/kernel/mali/mali_auto_boost;
#720mhz while "boosted" (idx 22)
echo idx=22 > /sys/kernel/mali/mali_boost_high;
#300mhz while not (idx 2)
echo idx=2 > /sys/kernel/mali/mali_boost_low;
#let's scale from 200mhz to 1050mhz
echo 200000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo 1050000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
#200mhz
echo varm=0x10 > /sys/kernel/liveopp/arm_step0;
echo set_volt=1 > /sys/kernel/liveopp/arm_step0;
#400mhz
echo varm=0x10 > /sys/kernel/liveopp/arm_step1;
echo set_volt=1 > /sys/kernel/liveopp/arm_step1;
#600mhz
echo varm=0x19 > /sys/kernel/liveopp/arm_step2;
echo set_volt=1 > /sys/kernel/liveopp/arm_step2;
#800mhz
echo varm=0x22 > /sys/kernel/liveopp/arm_step3;
echo set_volt=1 > /sys/kernel/liveopp/arm_step3;
#1000mhz
echo varm=0x2C > /sys/kernel/liveopp/arm_step4;
echo set_volt=1 > /sys/kernel/liveopp/arm_step4;
#1050mhz
echo varm=0x2E > /sys/kernel/liveopp/arm_step5;
echo set_volt=1 > /sys/kernel/liveopp/arm_step5;
echo z1hbbkern END
#!/system/bin/sh
#hbbtweaksv27
echo z2hbbmounts START
tune2fs -o journal_data_writeback /dev/block/mmcblk0p4
tune2fs -o journal_data_writeback /dev/block/mmcblk0p5
tune2fs -O ^has_journal /dev/block/mmcblk0p4
tune2fs -O ^has_journal /dev/block/mmcblk0p5
sleep 31;
#let's not update access time for each file/folder accessed (noatime, nodiratime)
#let's write only after 61 secs instead of 5
#"writeback" is the fastest metadata writing mode and "discard" will clean erased zones providing better writting performance after
busybox mount -o remount,noatime,nodiratime,rw,barrier=1,noauto_da_alloc,discard,delalloc,nobh,nodev,nosuid,commit=61 /data /data;
busybox mount -o remount,noatime,nodiratime,rw,barrier=0,noauto_da_alloc,discard,delalloc,nobh,nodev,nosuid,commit=67 /cache /cache;
#quem sabe tenha writeback?
busybox mount -o remount,noatime,nodiratime,data=writeback,rw,barrier=0,noauto_da_alloc,discard,delalloc,nobh,nodev,nosuid,commit=61 /cache /cache;
busybox mount -o remount,noatime,nodiratime,data=writeback,rw,barrier=1,noauto_da_alloc,discard,delalloc,nobh,nodev,nosuid,commit=67 /data /data;
for k in $(busybox mount | grep relatime | cut -d " " -f3); do busybox mount -o remount,noatime,nodiratime $k $k; done;
echo 15 > /proc/sys/fs/lease-break-time;
sleep 31;
#let's cache 2000 writes/reads requests
#no merging and no scheduler if not writing to a real mmc (less overhead?)
#NO read_ahead seems controversial.. but we shouldn't waste our time trying to read
# and fillin our ram with unrequested data
for i in $(busybox find /sys/devices -name queue);
do
echo 2000 > $i/nr_requests;
echo 2 > $i/rq_affinity;
echo 2 > $i/nomerges;
echo 0 > $i/rotational;
echo 0 > $i/add_random;
echo 0 > $i/iostats;
echo noop > $i/scheduler;
echo 0 > $i/read_ahead_kb;
done;
#for mmcs it will merge and try to use sioplus as scheduler..
for i in $(busybox find /sys/devices -name queue |grep mmc);
do
echo 0 > $i/nomerges;
echo row > $i/scheduler;
echo sio > $i/scheduler;
echo sioplus > $i/scheduler;
echo 0 > $i/read_ahead_kb;
done;
#in doubt about it for the external one
echo "128" > /sys/devices/virtual/bdi/179:96/read_ahead_kb;
CI() {
echo $1 > /sys/block/mmcblk0/queue/iosched/$2
echo $1 > /sys/block/mmcblk1/queue/iosched/$2
}
#scheduler tweaks
scheduler=reset;
while sleep 461; do
current=`cut -d\[ -f2 /sys/block/mmcblk0/queue/scheduler | cut -d\] -f1`;
if [ $scheduler != $current ]; then
scheduler=$current;
if [ $scheduler == "deadline" ]; then
CI 200 read_expire;
CI 500 write_expire;
CI 4 writes_starved;
CI 0 front_merges;
CI 8 fifo_batch;
elif [ $scheduler == "row" ]; then
CI 100 hp_read_quantum;
CI 75 rp_read_quantum;
CI 3 lp_read_quantum;
CI 6 hp_swrite_quantum;
CI 5 rp_swrite_quantum;
CI 4 rp_write_quantum;
CI 12 lp_swrite_quantum;
CI 10 read_idle;
CI 15 read_idle_freq;
elif [ $scheduler == "cfq" ]; then
CI 4 quantum;
CI 80 fifo_expire_sync;
CI 330 fifo_expire_async;
CI 12582912 back_seek_max;
CI 1 back_seek_penalty;
CI 60 slice_sync;
CI 50 slice_async;
CI 2 slice_async_rq;
CI 0 slice_idle;
CI 0 group_idle;
CI 1 low_latency;
fi;
fi;
done&
#nada de gastar memoria com internet, nossas conexoes sao ultra-lentas
setprop net.tcp.buffersize.evdo ""
setprop net.tcp.buffersize.evdo_b ""
setprop net.tcp.buffersize.gprs ""
setprop net.tcp.buffersize.hsdpa ""
setprop net.tcp.buffersize.hspa ""
setprop net.tcp.buffersize.hspap ""
setprop net.tcp.buffersize.hsupa ""
setprop net.tcp.buffersize.edge ""
setprop net.tcp.buffersize.umts ""
setprop net.tcp.buffersize.dchspap ""
setprop net.tcp.buffersize.lte ""
setprop net.tcp.buffersize.default 1024,32768,1048576,1024,4096,65536
setprop net.tcp.buffersize.wifi 4096,524288,1048576,4096,1048576,4194304
echo z2hbbmounts END
sleep 2;
#DROP all cached stuff till now. We won't need again all stuff that have been read while booting
sync;
sysctl -w vm.drop_caches=3;

[Script]Kernel Auditor

Hello, i'm using the Sabermod Rom from @beeeto, how ever the settings and script that i would like to share will work for all ROMs/Kernels with the latest Intelliplug and Settings (such as the Spirit Kernel).
The goal is to have a snap on performance when the screen is on.... and a very deep sleep when it is off.
I did the setup with Kernel Adiutor, how ever i did not find it to always apply on boot. So in the end i made a script to be sure that it always run on boot.
Programs that you will need:
Kernel Adiutor: https://play.google.com/store/apps/details?id=com.grarak.kerneladiutor
SManager: https://play.google.com/store/apps/details?id=os.tools.scriptmanager
With the free edition of SManager, make a new script on it (it say new program) then set it to gain SU permisions and to apply on every boot on the script edit window at the program.
Then click to edit the script and put the follow code:
Code:
#!/system/bin/sh
chmod "644" /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "192000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
chmod "444" /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
chmod "644" /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo "192000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
chmod "444" /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
chmod "644" /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
echo "192000" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
chmod "444" /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
chmod "644" /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
echo "192000" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
chmod "444" /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
echo "msm-adreno-tz" > /sys/devices/fdb00000.qcom,kgsl-3d0/kgsl/kgsl-3d0/devfreq/governor
sysctl -w net.ipv4.tcp_congestion_control=reno
stop mpdecision
stop mpdecision
stop mpdecision
echo "1" > /sys/module/intelli_plug/parameters/intelli_plug_active
echo "3" > /sys/module/intelli_plug/parameters/nr_run_profile_sel
echo "3" > /sys/module/intelli_plug/parameters/nr_run_profile_sel
echo "4" > /sys/module/intelli_plug/parameters/nr_run_hysteresis
echo "4" > /sys/module/intelli_plug/parameters/nr_run_hysteresis
echo "550000000" > /sys/devices/fdb00000.qcom,kgsl-3d0/kgsl/kgsl-3d0/max_gpuclk
echo "192" > sys/module/intelli_plug/parameters/cpu_nr_run_threshold
echo "192" > sys/module/intelli_plug/parameters/cpu_nr_run_threshold
chmod "644" /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "1190400" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod "444" /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod "644" /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo "1190400" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
chmod "444" /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
chmod "644" /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
echo "1190400" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
chmod "444" /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
chmod "644" /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
echo "1190400" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
chmod "444" /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
echo "192000" > /sys/module/cpu_boost/parameters/sync_threshold
echo "192000" > /sys/module/cpu_boost/parameters/sync_threshold
echo "1190400" > /sys/module/cpu_boost/parameters/input_boost_freq
echo "1190400" > /sys/module/cpu_boost/parameters/input_boost_freq
echo "10" > /sys/module/cpu_boost/parameters/input_boost_ms
echo "10" > /sys/module/cpu_boost/parameters/input_boost_ms
echo "10" > /sys/module/cpu_boost/parameters/boost_ms
echo "10" > /sys/module/cpu_boost/parameters/boost_ms
echo "1" > /sys/devices/system/cpu/sched_mc_power_savings
echo "msm-adreno-tz" > /sys/devices/fdb00000.qcom,kgsl-3d0/kgsl/kgsl-3d0/kgsl/kgsl-3d0/devfreq/governor
echo "550000000" > /sys/devices/fdb00000.qcom,kgsl-3d0/kgsl/kgsl-3d0/max_gpuclk
echo "1" > /sys/module/simple_gpu_algorithm/parameters/simple_gpu_active
echo "8000" > /sys/module/simple_gpu_algorithm/parameters/simple_ramp_threshold
echo "2" > /sys/module/simple_gpu_algorithm/parameters/simple_laziness
echo "9472,13824,19968,44544,58368,65536" > /sys/module/lowmemorykiller/parameters/minfree
echo "512" > /sys/block/mmcblk0/queue/read_ahead_kb
echo "256" > /sys/block/mmcblk1/queue/read_ahead_kb
sysctl "-w" net.ipv4.tcp_congestion_control=reno
echo "1" > /sys/kernel/mm/ksm/run
echo "0" > /sys/kernel/mm/ksm/deferred_timer
echo "35" > /sys/kernel/mm/ksm/sleep_millisecs
swapoff "/dev/block/zram0/" > dev/null 2>&1
echo "1" /sys/block/zram0/reset
echo "178257920" > sys/block/zram0/disksize
mkswap "/dev/block/zram0/" > dev/null 2>&1
swapon "/dev/block/zram0/" > dev/null 2>&1
echo "0" > sys/kernel/power_suspend/power_suspend_mode
echo "2" > /sys/module/simple_gpu_algorithm/parameters/simple_laziness
echo "1" > /sys/module/simple_gpu_algorithm/parameters/simple_gpu_active
echo "300000" > /sys/module/cpu_boost/parameters/sync_threshold
echo "300000" > /sys/module/cpu_boost/parameters/sync_threshold
echo "300000" > /sys/module/intelli_plug/parameters/screen_off_max
echo "300000" > /sys/module/intelli_plug/parameters/screen_off_max
echo "2" > /sys/module/simple_gpu_algorithm/parameters/simple_laziness
echo "1" > /sys/module/simple_gpu_algorithm/parameters/simple_gpu_active
echo "300000" > /sys/module/cpu_boost/parameters/sync_threshold
echo "300000" > /sys/module/cpu_boost/parameters/sync_threshold
echo "300000" > /sys/module/intelli_plug/parameters/screen_off_max
echo "300000" > /sys/module/intelli_plug/parameters/screen_off_max
echo "1190400" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo "67" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo "550000" > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
echo "60 787000:70 998000:75 1094000:80 1190400:55" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
echo "20000 1094000:40000 1190400:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
echo "1000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo "1" > /sys/devices/system/cpu/cpufreq/interactive/boostpulse
echo "550000" > /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
echo "-1" > /sys/devices/system/cpu/cpufreq/interactive/timer_slack
echo "45000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
echo "0" > /sys/devices/system/cpu/cpufreq/interactive/boost
echo "1036800" > /sys/devices/system/cpu/cpufreq/interactive/sync_freq
echo "50" > /sys/devices/system/cpu/cpufreq/interactive/up_threshold_any_cpu_load
echo "787000" > /sys/devices/system/cpu/cpufreq/interactive/up_threshold_any_cpu_freq
On Kernel Auditor the settings should be the following after run the script:
CPU:
Code:
CPU Maximum Frequency: 1190MHz
CPU Governor: Interactive
CPU Minimum Frequency: 300MHz
Multcore Power Saving: Enable
CPUBOOST=
Interval: 10ms
Input Interval: 10ms
Sync Threshold: 300MHz
Input Boost Frequency 1190MHz
CPU Hotplug:
Code:
MP Decision: OFF
IntelliPlug=
IntelliPLug: ON
Touch Boost: ON
Threshold Value: 192
Profile: Eco Performance
Hysteresis Value: 4
CPU Maximum Screen Off Frequency: 300MHz.
GPU:
Code:
GPU Maximum Frequency: 550MHz
GPU Governor: msm-adreno-tz
Simple GPU Algorithm=
Simple GPU Algorithm: On
Ramp Threshold: 8
Laziness: 2
I/O Scheduler:
Code:
Internal Storage=
Scheduler: row
Read-adead: 512kb
External Storage=
Scheduler: rol
Read-Ahead: 256kb
Kernel Samepage Merging
Code:
Enable KSM: On
Deferred timer: Off
Sleep between scans: 35ms
Pages to Scan: 100
Low Memory Killer:
Code:
Foreground Applications: 37MB
Visible Applications: 54MB
Secondary Server: 78MB
Hidden Applications: 174MB
Contend Providers: 228MB
Empty Applications: 256MB
Virtual Memory:
Code:
Disksize: 130MB
Misc Controls:
Code:
TCP Congestion Algorithm: reno
Vibration Strenght: 32%
Power Suspend Mode: AutoSleep
UPDATE:
Some settings to tune the Interactive governor:
Code:
Already on main script:
echo "1190400" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo "67" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo "550000" > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
echo "60 787000:70 998000:75 1094000:80 1190400:55" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
echo "20000 1094000:40000 1190400:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
echo "1000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo "1" > /sys/devices/system/cpu/cpufreq/interactive/boostpulse
echo "550000" > /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
echo "-1" > /sys/devices/system/cpu/cpufreq/interactive/timer_slack
echo "45000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
echo "0" > /sys/devices/system/cpu/cpufreq/interactive/boost
echo "1036800" > /sys/devices/system/cpu/cpufreq/interactive/sync_freq
echo "50" > /sys/devices/system/cpu/cpufreq/interactive/up_threshold_any_cpu_load
echo "787000" > /sys/devices/system/cpu/cpufreq/interactive/up_threshold_any_cpu_freq
Code:
CPU -> CPU Overnor Tunables:
above_highspeed_delay: 20000 1094000:40000 1190400:20000
boost: 0
boostpulse: 1
boostpulse_duration: 550000
go_hispeed_load: 67
hispeed_freq: 1190400
io_is_busy: 1
min_sample_time: 100
sampling_down_factor: 550000
sync_freq: 1036800
target_loads: 60 787000:70 998000:75 1094000:80 1190400:55
timer_rate: 45000
timer_slack: -1
up_threshold_any_cpu_load: 50
up_threshold_any_cpu_freq: 787000
That's it, i would like a feedback on how this settings work for you guys and what would you guys change.
Just a small note, the app's name is actually Kernel Adiutor, not Auditor.
hmm which part of code is for deep sleep? im interested only with this can make separated part of only deepsleep part?
leoetlino said:
Just a small note, the app's name is actually Kernel Adiutor, not Auditor.
Click to expand...
Click to collapse
Nice catch, fixing
plantator said:
hmm which part of code is for deep sleep? im interested only with this can make separated part of only deepsleep part?
Click to expand...
Click to collapse
Well it is hard to pinpoint what part exact will help (only) on deep sleep but i'll try
echo "1" > /sys/devices/system/cpu/sched_mc_power_savings
echo "0" > sys/kernel/power_suspend/power_suspend_mode
echo "192000" > /sys/module/cpu_boost/parameters/sync_threshold (if kernel support)
echo "192000" > /sys/module/cpu_boost/parameters/sync_threshold (if kernel support)
echo "300000" > /sys/module/cpu_boost/parameters/sync_threshold (only use if kernel don't support 192000 frequency)
echo "300000" > /sys/module/cpu_boost/parameters/sync_threshold (only use if kernel don't support 192000 frequency)
echo "300000" > /sys/module/intelli_plug/parameters/screen_off_max
echo "300000" > /sys/module/intelli_plug/parameters/screen_off_max
cpu_nr_run_threshold
Hi,
Could you explain to me a little bit this parameter?: echo "192" > sys/module/intelli_plug/parameters/cpu_nr_run_threshold
What does the 192 mean?, What happens if I tweak that number higher-lower?
Thanks
I'm having some issues with your script, I hope I'm not doing it wrong : I'm getting "file not found" exceptions on pretty much every line of the script, which is weird... Any idea ?
From what I know if ksm is on, camera is not working
demolatorul said:
From what I know if ksm is on, camera is not working
Click to expand...
Click to collapse
Same issue here. To get it working again I had to turn off KSM then reboot.

Categories

Resources