[MOD] HBBTweaks v32 (11/23) - battery and performance - Galaxy S Advance I9070 Android Development

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;

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?

Doubts About DroidXGovernorsV2.2 and other little doubt

First I want to apologize for my strange English (Google translator)
Returning to Questions, I would like to Know how to Remove the vibration when the screen Unlock
I also like to know how to do DroidxGovernos work on my machine because the installation is completed via CMW put the Set CPU does not recognize them, any thoughts?
Brazil to Use Retail 2.3.6 Root, Boot menu, and CMW working
Thanks
Not sure on the lockscreen vibration.
DX govs work by adding in the modules into /system/lib/modules/ and loading them with an init script. So far, they've worked on Bravo, Defy, and Defy+. Did you enable overclocking in the bootmenu? Its necessary. Some users even have to enable "Load All Modules". I've never had to, but some have. I can tell you the Boostedass works wonders on ICS with battery time. Added 16 hours of battery life on Quarx 2012\05\12. Miui runs for 2 days with about 4-5 hours of mp3 playing a day, 1 hour of wifi browsing, and being a bit anal with disabling what I'm not using with the power widget (3g, wifi, gps, etc...)
There is that chance that they just don't work. InteractiveX, from the same rom I found these governors in, won't work at all on my Bravo. I know that on CM7\MIUI\CM9 on the Bravo all that I have to do is flash the zip and enable them in No Frills and they just work.
Boosted, as well as SIO, are now built into the latest bootmenus for the Defy and Bravo now because of how well they work.
The full init script I'm using, and included with DX Gov 2.2.
Code:
#!/system/bin/sh
#Load Modules for IO Scheduler and Governors
insmod /system/lib/modules/cpufreq_smartassv2.ko
insmod /system/lib/modules/cpufreq_BOOSTEDassV2.ko
insmod /system/lib/modules/sio-iosched.ko
#Set IO Scheduler, use "sio" "noop" or "cfs" (sio and noop recommended)
for i in /sys/block/mmc*/queue; do
echo "sio" > $i/scheduler
done
#Tweak IO Parameters
for i in /sys/block/*/queue; do
[ -f "$i/rotational" ] && [ "`cat $i/rotational`" -ne "0" ] && echo "0" > $i/rotational
[ -f "$i/read_ahead_kb" ] && echo "2048" > $i/read_ahead_kb
[ -f "$i/iosched/async_read_expire" ] && echo "4000" > $i/iosched/async_read_expire
[ -f "$i/iosched/async_write_expire" ] && echo "16000" > $i/iosched/async_write_expire
[ -f "$i/iosched/fifo_batch" ] && echo "1" > $i/iosched/fifo_batch;
[ -f "$i/iosched/sync_read_expire" ] && echo "500" > $i/iosched/sync_read_expire
[ -f "$i/iosched/sync_write_expire" ] && echo "2000" > $i/iosched/sync_write_expire
[ -f "$i/iosched/writes_starved" ] && echo "0" > $i/iosched/writes_starved
[ -f "$i/nr_requests" ] && echo "2048" > $i/nr_requests
[ -f "$i/iostats" ] && [ "`cat $i/iostats`" -ne "0" ] && echo "0" > $i/iostats
done
#Set SD Card read ahead cache
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
You can remove the smartassv2 insmod line (script above, 5th line) to save a tiny bit of ram; and the last line is the SD Speed Tweak (also script above, last 2 lines). It can be removed if you use other values or another mod with them included. I only included it so all the read ahead values were the same.
You can also use the following script to load and configure Boosted or SmartassV2. It doesn't work on the Bravo. Some reason echoing boostedass causes my phone to freeze on boot. Perhaps you'll have better luck than me.
Code:
#!/system/bin/sh
#Use either BOOSTEDassV2 or smartassV2. Comment out (# at beginning) all lines if using stock governors.
echo "BOOSTEDassV2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
#Only use one or the other, and only if you plan on using BOOSTEDassV2 or smartassv2
#Tweak BOOSTEDassV2
echo "600000" > /sys/devices/system/cpu/cpufreq/BOOSTEDass/awake_ideal_freq
echo "300000" > /sys/devices/system/cpu/cpufreq/BOOSTEDass/sleep_ideal_freq
echo "600000" > /sys/devices/system/cpu/cpufreq/BOOSTEDass/sleep_wakeup_freq
echo "70" > /sys/devices/system/cpu/cpufreq/BOOSTEDass/max_cpu_load
echo "40" > /sys/devices/system/cpu/cpufreq/BOOSTEDass/min_cpu_load
echo "300000" > /sys/devices/system/cpu/cpufreq/BOOSTEDass/ramp_up_step
echo "300000" > /sys/devices/system/cpu/cpufreq/BOOSTEDass/ramp_down_step
echo "49000" > /sys/devices/system/cpu/cpufreq/BOOSTEDass/up_rate_us
echo "97000" > /sys/devices/system/cpu/cpufreq/BOOSTEDass/down_rate_us
#Tweak smartassV2
#echo "600000" > /sys/devices/system/cpu/cpufreq/smartass/awake_ideal_freq
#echo "300000" > /sys/devices/system/cpu/cpufreq/smartass/sleep_ideal_freq
#echo "600000" > /sys/devices/system/cpu/cpufreq/smartass/sleep_wakeup_freq
#echo "85" > /sys/devices/system/cpu/cpufreq/smartass/max_cpu_load
#echo "45" > /sys/devices/system/cpu/cpufreq/smartass/min_cpu_load
#echo "300000" > /sys/devices/system/cpu/cpufreq/smartass/ramp_up_step
#echo "300000" > /sys/devices/system/cpu/cpufreq/smartass/ramp_down_step
#echo "50000" > /sys/devices/system/cpu/cpufreq/smartass/up_rate_us
#echo "65000" > /sys/devices/system/cpu/cpufreq/smartass/down_rate_us

[Q] Toggle SOC C-States

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

[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.

Franco dev tweaks, very old but very good

Hello I found this flashable tweak from franco dev team, 2013 , but they are working good just sharing then. Credits to the awesome franco and his dev team.
Just flash it in recovery, to remove them just dirty flash your current ROM, enjoy.
875mntsettings
Code:
#!/system/bin/sh
# chmod -R 755 /system/etc/init.d
# 12-May-2013 by Franco's Dev Team
# malaroth, osm0sis, joaquinf, The Gingerbread Man, pkgnex, Khrushy, shreddintyres
# sysfs+sdcard tweaks
busybox mount -o remount,nosuid,nodev,noatime,nodiratime -t auto /;
busybox mount -o remount,nosuid,nodev,noatime,nodiratime -t auto /proc;
busybox mount -o remount,nosuid,nodev,noatime,nodiratime -t auto /sys;
busybox mount -o remount,nosuid,nodev,noatime,nodiratime -t auto /sys/kernel/debug;
busybox mount -o remount,nosuid,nodev,noatime,nodiratime -t auto /mnt/shell/emulated;
for i in /storage/emulated/*; do
busybox mount -o remount,nosuid,nodev,noatime,nodiratime -t auto $i;
busybox mount -o remount,nosuid,nodev,noatime,nodiratime -t auto $i/Android/obb;
done;
# partition tweaks
busybox mount -o remount,nosuid,nodev,noatime,nodiratime,barrier=0,noauto_da_alloc,discard -t auto /data;
busybox mount -o remount,nosuid,nodev,noatime,nodiratime,barrier=0,noauto_da_alloc,discard -t auto /cache;
busybox mount -o remount,nodev,noatime,nodiratime,barrier=0,noauto_da_alloc,discard -t auto /system;
925vmsettings
Code:
#!/system/bin/sh
# chmod -R 755 /system/etc/init.d
# 26-Jun-2013 by Franco's Dev Team
# malaroth, osm0sis, joaquinf, The Gingerbread Man, pkgnex, Khrushy, shreddintyres
# disable sysctl.conf to prevent ROM interference
if [ -e /system/etc/sysctl.conf ]; then
mount -o remount,rw /system;
mv /system/etc/sysctl.conf /system/etc/sysctl.conf.fkbak;
mount -o remount,ro /system;
fi;
# vm tweaks
echo 5 > /proc/sys/vm/dirty_background_ratio;
echo 200 > /proc/sys/vm/dirty_expire_centisecs;
echo 20 > /proc/sys/vm/dirty_ratio;
echo 500 > /proc/sys/vm/dirty_writeback_centisecs;
echo 2884 > /proc/sys/vm/min_free_kbytes;
echo 4 > /proc/sys/vm/min_free_order_shift;
echo 3 > /proc/sys/vm/page-cluster;
echo 0 > /proc/sys/vm/swappiness;
echo 100 > /proc/sys/vm/vfs_cache_pressure;
# lmk tweaks
minfree=6144,8192,12288,16384,24576,40960;
lmk=/sys/module/lowmemorykiller/parameters/minfree;
minboot=`cat $lmk`;
while sleep 1; do
if [ `cat $lmk` != $minboot ]; then
[ `cat $lmk` != $minfree ] && echo $minfree > $lmk || exit;
fi;
done&
# fs tweaks
echo 10 > /proc/sys/fs/lease-break-time;
# entropy tweaks
echo 128 > /proc/sys/kernel/random/read_wakeup_threshold;
echo 256 > /proc/sys/kernel/random/write_wakeup_threshold;
# tcp tweaks
echo "westwood" > /proc/sys/net/ipv4/tcp_congestion_control;
950iosettings
Code:
#!/system/bin/sh
# chmod -R 755 /system/etc/init.d
# 11-Jun-2013 by Franco's Dev Team
# malaroth, osm0sis, joaquinf, The Gingerbread Man, pkgnex, Khrushy, shreddintyres
# disable sysctl.conf to prevent ROM interference
if [ -e /system/etc/sysctl.conf ]; then
mount -o remount,rw /system;
mv /system/etc/sysctl.conf /system/etc/sysctl.conf.fkbak;
mount -o remount,ro /system;
fi;
# general queue tweaks
for i in /sys/block/*/queue; do
echo 512 > $i/nr_requests;
echo 512 > $i/read_ahead_kb;
echo 2 > $i/rq_affinity;
echo 0 > $i/nomerges;
echo 0 > $i/add_random;
echo 0 > $i/rotational;
done;
# override scheduler defaults with tweaked values
scheduler=reset;
while sleep 1; do
current=`cut -d\[ -f2 /sys/block/mmcblk0/queue/scheduler | cut -d\] -f1`;
if [ $scheduler != $current ]; then
scheduler=$current;
if [ $scheduler == "deadline" ]; then
# deadline tweaks
echo 250 > /sys/block/mmcblk0/queue/iosched/read_expire;
echo 2500 > /sys/block/mmcblk0/queue/iosched/write_expire;
echo 1 > /sys/block/mmcblk0/queue/iosched/writes_starved;
echo 1 > /sys/block/mmcblk0/queue/iosched/front_merges;
echo 8 > /sys/block/mmcblk0/queue/iosched/fifo_batch;
elif [ $scheduler == "row" ]; then
# row tweaks
echo 100 > /sys/block/mmcblk0/queue/iosched/hp_read_quantum;
echo 75 > /sys/block/mmcblk0/queue/iosched/rp_read_quantum;
echo 5 > /sys/block/mmcblk0/queue/iosched/hp_swrite_quantum;
echo 4 > /sys/block/mmcblk0/queue/iosched/rp_swrite_quantum;
echo 4 > /sys/block/mmcblk0/queue/iosched/rp_write_quantum;
echo 3 > /sys/block/mmcblk0/queue/iosched/lp_read_quantum;
echo 12 > /sys/block/mmcblk0/queue/iosched/lp_swrite_quantum;
echo 10 > /sys/block/mmcblk0/queue/iosched/read_idle;
echo 25 > /sys/block/mmcblk0/queue/iosched/read_idle_freq;
## N4 and N10 row adds lsl and rsl, which were hardcoded previously
echo 10000 > /sys/block/mmcblk0/queue/iosched/low_starv_limit;
echo 5000 > /sys/block/mmcblk0/queue/iosched/reg_starv_limit;
## N4 and N10 have a new version of row with corrected entry for lsq and renamed ri and rif
[ `cat /sys/block/mmcblk0/queue/iosched/lp_swrite_quantum` != "2" ] && echo 2 > /sys/block/mmcblk0/queue/iosched/lp_swrite_quantum;
echo 10 > /sys/block/mmcblk0/queue/iosched/rd_idle_data;
echo 25 > /sys/block/mmcblk0/queue/iosched/rd_idle_data_freq;
elif [ $scheduler == "cfq" ]; then
# cfq tweaks
echo 4 > /sys/block/mmcblk0/queue/iosched/quantum;
echo 80 > /sys/block/mmcblk0/queue/iosched/fifo_expire_sync;
echo 330 > /sys/block/mmcblk0/queue/iosched/fifo_expire_async;
echo 12582912 > /sys/block/mmcblk0/queue/iosched/back_seek_max;
echo 1 > /sys/block/mmcblk0/queue/iosched/back_seek_penalty;
echo 60 > /sys/block/mmcblk0/queue/iosched/slice_sync;
echo 50 > /sys/block/mmcblk0/queue/iosched/slice_async;
echo 2 > /sys/block/mmcblk0/queue/iosched/slice_async_rq;
echo 0 > /sys/block/mmcblk0/queue/iosched/slice_idle;
echo 0 > /sys/block/mmcblk0/queue/iosched/group_idle;
echo 1 > /sys/block/mmcblk0/queue/iosched/low_latency;
## N4 and N10 cfq adds tl, which was hardcoded previously
echo 300 > /sys/block/mmcblk0/queue/iosched/target_latency;
fi;
fi;
# loop forever independently
done&
Flash an unidentified 3-year-old zip? Thank you, but I'll pass...
fedef12evo said:
Hello I found this flashable tweak from franco dev team, 2013 , but they are working good just sharing then. Credits to the awesome franco and his dev team.
Just flash it in recovery, to remove them just dirty flash your current ROM, enjoy.
Click to expand...
Click to collapse
Why should anyone flash this?
Can you also post a Ice Cream Sandwich rom to go with it
fedef12evo said:
Hello I found this flashable tweak from franco dev team, 2013 , but they are working good just sharing then. Credits to the awesome franco and his dev team.
Just flash it in recovery, to remove them just dirty flash your current ROM, enjoy.
Click to expand...
Click to collapse
Don't you think you should at least explain exactly what these tweaks do?!
download the zip with pc, then open it and read every of 3 tweak what do, im gonna post it for you
first off, what do these "tweaks" do do you know? as nd Franco isnt a dev team, its an individual person.
simms22 said:
first off, what do these "tweaks" do do you know? as nd Franco isnt a dev team, its an individual person.
Click to expand...
Click to collapse
Read them tweak, back in thr day franco had a team
fedef12evo said:
Read them tweak, back in thr day franco had a team
Click to expand...
Click to collapse
no, he doesnt. he has people test out his kernels, but he IS alone. i know, im friends with him. i dont need to read the tweaks, you posted them here and you have to post what they do. if not, your thread will kust get closed down.
Thread closed. No-one with any sense would try this considering absolutely no info on resultant effects has been given, and the sheer age of the "tweaks".
Anyone wishing to try does so bearing the above caveat in mind.

Categories

Resources