[Android Software/Hacking General [Developers Only]] pikachu01:
Script Details

WARNING:

Other scripts that tweaks the same VM,I/O,Readahead, etc settings with different values(check the scripts and compare) and what not should not be running together with these Thunderbolt!. It'll ruin the harmony of the settings causing decrease in performance/battery life.

The system_tweak file will tweak these:

VM settings (tweaked to offer more battery life and performance with the RAM, a faster memory being used more often than NAND writes)

Misc tweaks (you can look at the script itself, google will tell you what it does)

Readahead tweaks. Optimizes different memory devices readahead values. It's not 1024/2048 for all devices. It won't work well that way.

Disclaimer

This won't brick your phone or cause it to go haywire. If it does, I will not be responsible for it. Do some research before attempting to use it (as always).

remount Script

I created a post-boot script that you could remount your partitions to:

Disable barriers for /data

Noatime for every mount point (Using atime for mount points will decrease the life of the disk as writes are performed everytime a file is accessed for the access time)

Increased commit time to 60 seconds as opposed to 5 seconds. By default, journaling will commit to disk every 5 seconds. That means, if you changed something more than a time span of 5 seconds, your files are not likely to get corrupted on power loss. By adjusting this to 60seconds, the risk is slightly higher, but it's a risk I'm willing to take, and an informed decision that you should make if you choose to use this script. This increases performance by a lot! 59 seconds of the time, you will not face lags stemming from journaling. It's like having journaling only 1/12th of the time.

How-To

Wait till Android finishes loading everything.

Install Script Manager from Market

Point script manager to the script you placed in the sdcard.

Run as root.

Do this at every boot.

You can add a widget to your home screen for the script so that you can

activate it easily.

Disclaimer

I am not responsible for data corruption or data loss from using this remount script. You should know its risks after reading the information from this guide. If you haven't, you should read the whole guide and make an informed decision.

drop Script

Drop script perform a cache drop operation to provide more free memory to the user. Use it when you feel that memory is lacking.

Changelog:

5/15/2016 (3.4.0)

- Updated for Android 5/6. Removed a lot of junk code as they are not necessary to be tweaked in later Android versions (yes, Android finally coded them to be default values).

3/17/2014 (3.3.0)

- Added universal remount script. Use that script instead of device specific remounts

- Fixed the updater_script to be much more compatible

3/8/2014 (libsqlite addons 3.1.0, screenstate_scaling 3.1, clean uninstall 3.1.0)

- Revamped libsqlite addons to only install libsqlite.so (not libsqlite_jni.so)

- Revamped screenstate_scaling script to become much cleaner and automatically target correct paths

- Revamped clean uninstall to be compatible to current ThunderBolt! versions.

3/3/2014 (3.20)

- Added support to sqlite3 for JB 4.3 and KK 4.4

3/25/2013 (3.11)

- Added Xperia S and Xperia Arc S remounts

3/12/2013 (3.10)

- Added ROW scheduler tweaks. Take note that the ROW scheduler is buggy as one of it's sysfs interface is broken. Suggest using SIO instead.

- Added Nexus4 remount

- Enabled nomerges flag to "1". Let me know if you're facing any performance hits.

2/13/2013 (main CWM 3.05 and libsqlite 3.0.2)

-Added CM10/10.1 fullext4 remount.

- Added LG Mytouch4G remount.

- Added JB 4.1 libsqlite and added support for 4.2.2 for JB 4.2 libsqlite.

2/11/2013 (3.04)

- Added GNex YAFFS remount.

- Removed loop* from being tweaked by the I/O tweaks. It bootloops Galaxy S Gingerbread.

2/5/2013 (3.03)

- Fixed zipalign directory to xbin. Thanks to ggogolewski!

2/5/2013 (main CWM 3.02 and libsqlite 3.0)

- Added SQLITE_NO_SYNC compiled libsqlite libraries that disables sync (fdatasync/fsync) which increases sqlite transactions by 10-20%. You can use RL Benchmark to test for this.

- Added loop* and ram* block to be tweaked by ThunderBolt!'s I/O tweaks.

- Changed write_starved to 4.

2/3/2013 (3.01)

- Added Sony Xperia U remount.

- Changed windowsmgr.max_events_per_sec to 90.

2/3/2013 (3.0 and LMK addon 3.0)

- Added an intelligent backup/restore updater_script on every CWM zip ThunderBolt! has. Thanks to Tungstwenty for his post here.

- Added a restore CWM zip that restores the backup and deletes Thunderbolt!.

- libsqlite addon won't install in ICS/JB. It will warn you if you're installing on the wrong OS.

- LMK addon now backs up the build.prop (or restores the build.prop before modifying it). Hence now you can change LMK settings without doing any build.prop modification/moving/copying. The CWM takes care of it for you.

- Main CWM is smart enough not to replace zipalign and sqlite3 if it's already in your ROM. My policy is "try not to mess around too much as I will tweak only in the right places".

- Added LMK 80MB Alt that follows AOSP ICS LMK for 512MB devices and above.

1/6/2013 (2.9.3)

- Added HTC One S/XL/Sensation 4G remount script. Use remountHTC_Alt.

1/2/2013 (2.9.2)

- Added HTC One X remount script.

12/30/2012 (main CWM 2.9.1 and screenstate_scaling 2.4.0)

- Fixed screenstate_scaling to be AOSP ROM compatible

- Fixed zipalign script to determine whether there are any errors on zipalign before committing.

- Fixed sqlite3 extraction to certain JB ROMs (like 4.2)

12/24/2012 (LMK addons 2.1)

- Revamped how LMK works. Added 120MB LMK.

- The LMK now incorporates knowledge from reading the ActivityManagerServices source code. It should correctly make your apps handle its own memory more efficiently based on how memory is evaluated in the Android OOM. Apologies for this as the previous implementation actually broke some degree of how LRUs/Memory trimmings for apps are calculated.

12/3/2012 (2.9.0 and screenstate_scaling 2.3.0)

- Fixes to screenstate_scaling script. Minor typo that prevents some busybox versions from running it.

- Added kernel.shm* tweaks that is calculated based on your available memory.

- Upped vfs_cache_pressure to 50 on screen on, and 100 on screen off so that free memory is still kept fair, but performance on caches vs disk is still balanced.

- Disable /system/app/*.apk zipalign as this causes some Cyanogenmod devices's Google Apps to disappear.

- Lowered dirty_ratio/dirty_background_ratio for < 512MB a bit based on more recent benchmarks.

11/13/2012 (2.8.0 and screenstate_scaling 2.1.1)

- Added VM dirty* values according to the amount of RAM that you have (< 512MB, < 1GB and more than 1 GB). I've tested write speed for the disks on /data on a few phones and come to a conclusion that VM scaling is most optimized depending on total amount of RAM. This is because the I/O can only write that much dirty data up to an amount at an interval so that I/O doesn't become the bottleneck.

- Commented out some shm* tweaks. Will need to make this scale with amount of RAM also, but need floating point arithmetic support for bash in Android phones. No "bc" command!

- Fixed zipalign script that corrupts Google* APKs by removing already aligned APKs in /data/local. Might still be a problem with some APKs like BetterBatteryStats (what I found to be problematic so far).

- Fixed sqlite3 binary for Jelly Bean. The updater_script will check your build.prop and extract the appropriate sqlite3 binary for you :)

- Minor pegasusq updates in screenstate_scaling and main CWM.

- Some general fixes on the script (settings applying more than once)

- Might not affect >90% of people but I signed the zip files ;)

8/1/2012 (100MB LMK)

- Added 100MB LMK. Increases performance and a bit more multitasking at the expense of background inactive tasks/apps getting killed.

6/17/2012 (2.7.7, screenstate_scaling 2.02)

- Added I9300 Samsung Galaxy SIII remount script

- Moved noatime remount procedure to the remount scripts

- Fixed a minor typo in screenstate_scaling script (Thanks Tungstwenty).

6/13/2012(LMK 2.0.0 and restore packs 1.2.0)

- Updated LMK to use build.prop method. Older build.prop will be backed up in /system/build.prop.thunderbolt.

- To apply the LMK changes, you'll need to restart twice. Once to modify the build.prop, another to load the modified build.prop

- To restore the build.prop, just copy over build.prop.thunderbolt to build.prop

- Updated restore packs with automounter by iXNyNe.

5/30/2012(2.7.6, screenstate_scaling 2.0.1)

- Updated script asserts on mounts. Detects whether partitions are mounted before installing. Credits to iXNyNe.

- Updated governor parameters to have a lower up_threshold (higher performance) because of visible lags due to the change in the previous version,

5/24/2012(2.7.5, screenstate_scaling 2.0.0)

- Updated all governors to skew towards more battery life.

- Updated pegasusq to correct typo in some of the settings as well as scale better.

5/18/2012 (2.7.4, Screenstate_scaling 1.9.0)

- Updated both main script and screenstate_scaling script to support tweaking abyssplug and pegasusq governors for better performance + battery life when screen is off.

- Removed CFS from executed by default. Use Script Manager to navigate to /etc/bolt_scripts/CFS to manually run it. s98CFS is the default one.

- Removed lulzactive tuning on the pump_up_step as Siyah introduced 18steps of frequency. This needs to be manually set.

- Removed io_is_busy from being set. You can edit the script to set it if you feel performance is lagging.

5/5/2012 (2.7.3)

- Changed write starvation for MTD to be 2:1. Added Hydrogenics I9100 restore pack.

4/25/2012 (2.7.2)

- Changed NAND memory to have 2:1 writes starved as read speed is higher than write speed. SD memory still has 1:1 writes starved. Removed TCP buffers from S98system_tweak. Moved it to /etc/bolt_scripts/S98TCPbuffers as it causes hang at boot for CM7/9 ROMS.

4/20/2012 (2.7.1)

- Changed CFQ I/O scheduler slice_idle for better latency vs throughput.

- Enabled TCP buffer tweaks to improve network throughput (credits to gokhanmoral for the values).

- Changed sched_mc to 0 in bolt_siyah script and commented out some lines. Uncomment them to enable its usage.

4/19/2012 (2.7.0, LMK 1.10)

- Added an autoremount option, no need to mount /system or whatever partitions again before installing.

- Tweaked the I/O scheduler a bit to be a bit more balanced between latency and throughput.

- Moved touchscreen tweaks back to bolt_scripts. Move to init.d if you're using I9000 or use Script Manager to launch the script at boot.

- Reverted the LMK to /data/local.prop. Seems to be the most reliable way for Gingerbread phones.

3/5/2012 (LMK 1.0.7)

- Fixed the positioning of default.prop (there was a mess in placement of the default.prop inside /etc in some of the LMK zip files. I forgot which, hence I'm refreshing all the LMKs up a version with the placement fixed for those that are broken. Please redownload.

3/5/2012 (2.6.1)

- Fixed updater script for main CWM. Just removing obsolete lines (no feature impact)

- Moved S98bolt_siyah to /etc/bolt_scripts as Siyah currently has a tweak app called ExtTweak by xan In order for it not to be override it. you can move this file to the init.d or run it with Script Manager if you want ThunderBolt!'s settings to override it.

3/4/2012 (2.6.0, screenstate_scaling 1.6.0, LMK 1.0.6, Restore 1.1.0)

- Less aggressive RAM tuned at screen on. Same aggressiveness when screen is off.

- More battery centric governors at sleep (with 99 up_threshold on most of the governors at screen off).

- Ondemand is at 95 up_threshold if io_is_busy is set.

- Removed kernel panic settings. Leave it at kernel defaults (whatever that is)

- Updated LMK to not use /data/local.prop. Instead it uses /system/default.prop

- Updated main CWM to not use /sdcard. bolt_scripts is now located at /system/etc/bolt_scripts. Be sure to point your Script Manager settings there now.

- Moved the zipalign script to bolt_scripts to ensure first time boot is faster. First time boot for some people might be slow as they might have a lot of unzipaligned APKs. You can move the script to init.d and give it rwx-rwx-rwx permissions if you want to.

2/13/2012 (2.5.1)

- A small fix to cpugputune by commenting out the if/fi between the UV_MV_Table tweak so that people can run the script fine even without any edits.

2/9/2012 (2.5.0 and screenstate_scaling 1.5.2)

- Added a CPU/GPU tune file (/etc/bolt_scripts/cpugputune) that contains:

* Siyah GPU frequency/voltage tuning (with my own settings for a balanced performance/battery saving proflie).

* CPU undervolting (similar to Voltage Control, but doesn't have the limitation of Voltage Control's limits. You can set it however you want till it hits the limits that is set in your kernel itself. (Note: You will require a kernel that supports undervolting for this to work)

- To run this script, follow the same instructions as the remount script.

- I've commented out the voltage settings for CPU/GPU because each phone will have its own threshold for each (too low and it hangs). Before uncommenting, be sure to change the UV_mV_table to your own stable settings.

- To know how to undervolt, play a MKV file in software decoding using MX Video Player for 10minutes while limiting the frequency's voltage that you want to tune. Slowly decrease it (by editing it and then running the file on Script Manager) until it hangs. Then add +50mV to get a stable voltage.

- To limit a frequency, add these lines to the script:

echo "200000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
echo "200000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;

This limits it to 200MHz (example).

- To undervolt the GPU frequency, use Nenamark as a benchmark. To limit a frequency for GPU, set all 3 frequencies to be the same. E.g.:

echo "100 100 100" > /sys/class/misc/gpu_clock_control/gpu_control;

This will limit it to 100. Then run the script in Script Manager and run Nenamark. If Nenamark cuts to black and phone fails to respond, calm down first. Press the home key and wait for it to get to your homescreen, then reboot from there.

- NOTE: Be sure to disable the remount script (untick the wheel icon in Script Manager and then reboot) before proceeding to undervolt your phone as the remount script will increase the likelihood of corruption after a phone hang.

- Also tuned the conservative and smartassV2 governor to have a threshold difference of 10 instead of 5.

2/3/2012 (2.4.1 and screenstate_scaling 1.5.1)

- Mostly comment cleaning

- Changed TCP Syncookis to false. Most kernels won't even support it. Hence its a useless change, but change it in case some kernels do support it and nope TalonDev and Siyah doesn't support it. Can't enable/disable it.

1/26/2012 (2.4 and screenstate_scaling 1.5)

- Changed zipalign script to reroute to /data/local dir instead of sdcard.

- Updated screenstate_scaling sample rates to 100k for sleep and 20k for awake.

1/23/2012 (2.3.131)

- Bugfix update by removing one line before s98system_tweak.

1/21/2012 (2.3.13, screenstate_scaling 1.4.14)

- Disabled down_differential. Too battery draining for some people.

- Tweaked smartassV2 and conservative to be more battery friendly.

1/19/2012 (2.3.12, screenstate_scaling 1.4.13)

- Fixed max_events_per_sec not tuned correctly.

- Added down_differential (only for kernels that supports this) tuning to ondemand governors that will reduce lags by a little bit.

1/15/2012 (2.3.11, screenstate_Scaling 1.4.12)

- Fixed a bug on ondemand sleep scaling. Thanks ::Crack::

- Enabled MTD block tweaking. Thanks ::Crack::

- Made all sleeping governors have 90k sample rate. Good for battery life.

1/13/2012 (2.3.10, screenstate_scaling 1.4.11)

- Tuned sampling_down_factor of ondemand, ondemandX, conservative. This should resolve the issue of getting stuck 500MHz and above (I think). Siyah tweaked the sampling_down_factor to 4 and sampling rate of 120k. Since I tuned the sampling_rate to 10k, I'll need to tuned sampling_down_factor as well.

- Tuned interactive based governors (lulzactive, smartassV2) to have a more aggressive sleep.

1/12/2012 (2.3.9, screenstate_scaling 1.4.10)

- Tuned the ondemand, ondemandX and lulzactive to have up_threshold of 85.

- Tuned hotplugging in SGSII to be performance oriented a little bit.

- Tuned smooth_* to be performance oriented a bit.

1/12/2012 (2.3.8, screenstate_scaling 1.4.9)

- Fixed SOD/deadsleeping for SGSII kernels by disabling deepsleeplevel tweaking. Some phones can't handle it.

- Tuned ondemand,ondemandX, smartassV2, lulzactive governors again. Tuned hotplug settings again also (based on the governor tweaks). Added conservative governor tweaking.

1/10/2012 (2.3.7, screenstate_scaling 1.4.8, LMK 1.0.3, 3G 1.0.5, bin files 1.1.2)

- Updated main CWM to 2.3.7 with some cosmetic cleanup of the script and also enabled a default sampling_rate of 10,000 for ondemand/ondemandX.

- Updated screenstate_scaling to 1.4.8 fixing a typo bug in lulzactive. Also updated screenstate_scaling to 1.4.9 with cosmetic cleanup.

- Updated LMK, 3G, bin files with newer updater_binary.

1/7/2012 (2.3.6, screenstate_scaling 1.4.6, restore pack 1.0.3)

- Updated restore pack to remove bolt_siyah script and update updater binary.

- Fixed Siyah v2.6.5 lockup due to Siyah having hung tasks. ThunderBolt! enabled the lockup detection. I disabled this pending fix from gokhanmoral.

- Fixed some typo errors in system_tweak (kernel.sem, dirty_writeback_centisecs)

- Made windowmgr events to have a minimum of 60.

- Increased screenstate_scaling ondemand threshold to 95 if io_is_busy is enabled.

1/4/2012 (2.3.5, screenstate_scaling 1.4.5)

- Decreased the up_threshold for lulzactive, ondemand, ondemandx, smartassV2 for faster scaling.

- Disabled smooth_target/smooth_step/smooth_offset. Brings stutters to ondemand/ondemandX.

- Fixed iostats bug - Thanks PedroMRP.

1/2/2012 (2.3.4, screenstate_scaling 1.4.4, graphics 1.0.3)

- Fixed OndemandX, lulzactive, ondemand governor suspend_freq, pump_up_step respectively and sampling_rate (for all governors).

- Commented out graphic voltage settings

- Set deepsleep levels 1 level higher, prevents SOD.

- Fixed S98graphics, save as unix file.

1/1/2012 (2.3.3, screenstate_scaling 1.4.3)

- Updated lulzactive governor to check for minimum/maximum frequency so that it can scale properly

- Updated ondemandX governor to check for minimum frequency so that it can be the suspend frequency, in which previously it was set to 200MHz by default.

12/31/2011 (2.3.2, screenstate_scaling 1.4.2)

- Fixed ondemand tweaking for certain kernels(some kernels have the path to be /cpufreq/cpu0/* rather than /cpufreq/*)

- Added OndemandX tweaking as well in screenstate_scaling.

- Added sample rate tweaking in screenstate_scaling. This will make all tweaked governors (ondemand/ondemandX/lulzactive/smartass perform faster and sleep better using screenstate_scaling.

- Tweaked lulzactive/smartass/ondemand/ondemandX to have 20,000 sample rate when screen is on. 10,000 seems a bit too much.

- Tweaked all governors to have a sample rate of 100,000 when sleeping. Battery friendly.

12/31/2011 (2.3.1, screenstate_scaling 1.4.1)

- Moved SGSII tweaks onto another file (S98bolt_siyah)

- Made heap_size tweak to be 64MB by default or 80MB if greater than 64MB (in build.prop). 48MB or 64MB doesn't really make a difference. Haven't seen an app consume more than 32MB of heap yet.

- Commented out max window events. Each phone is different. Defaulting this to 60 seems wrong.

- Used an if/else on the idle_sleeping_frequency for smartassV2.

- Commented out sampling_down_factor. Some phones can't take it.

- Finally figured out why touchscreen tweaks aren't working :S I saved it using the wrong format! It should be UTF-8 [unix] instead of UTF-8[windows]. Facepalm!

12/30/2011 (2.3.0, screenstate_scaling 1.4.0)

- Updated 2.3.0 with minor editiing of sdcard tweak arrangement, smartassV2 and lulzactive governor tweaking, and SGSII tunables (hotplugging, bus frequencies etc).

- Added i9100 restore pack

- Used newest updater_binary. All the older CWM zips are not using the newer binary. Just update it with the file I've uploaded in the 2nd post.

- Forgot to add this: Enabled sampling_down_factor of 2 while screen is on. Might cause reboots/hangs if you've undervolted your top frequency (e.g. 1GHz) extensively. Recommend to add 25mV if you're facing issues.

12/17/2011 (2.2.0, screenstate_scaling 1.3.1)

- Updated 2.2.0 with CFSK as the default CFS. CFSK is still the fastest based on some feedback.

- Updated 1.3.1 for screenstate_scaling. Disabled sampling_down_factor as it makes the phone unstable when sampling rate is too low. If you're still getting reboots, please add 25mV to 1GHz.

12/13/2011 (2.1.9, screenstate_scaling 1.30, restore packs 1.0.2, all others)

- Updated main CWM to v2.1.9 with CFS 1.9.4 as the default due to popular demand.

- Renamed all the CFS scripts that have extensions. init.d can't load CFS's that have extensions (I tried using 1.9.4 and it didn't work when it had the .9.4 extension)

- Added io_is_busy and sampling_down_factor to ondemand. Will increase the performance while awake as sampling rate will be faster, and frequencies will stay very flexible when near 1GHz. io_is_busy will ensure that I/O operations utilizes high frequencies ~400-1GHz rather than being 100Hz when CPU is mostly idle. Will prevent microlags.

- Changed the screenstate_scaling ondemand up_threshold to 95 while awake and 98 while asleep to increase battery savings since microlags are eliminated almost completely from the above setting.

- Updated all addons' updater_script to ensure installation of consecutive CWM zips are correct.

12/10/2011 (graphics 1.0.1)

- Used the wrong updater_script for the graphics addon. Corrected this mistake.

12/10/2011 (2.1.7)

- Removed sleep_mode setting. Could be the culprit of sleep-deaths and/or reboots/instabilities.

- Separated the graphics acceleration tweaks to an addon. Might not work with some phones or it can cause instabilities. Please test it out for me.

- Discontinued the L version as CFS might not be the culprit for sleep-deaths/instabilities.

12/7/2011 (2.1.6L)

- Tuned down the CFS aggressiveness in the v2.1.6L after a few complaints about devices that can't wake up received.

12/5/2011 (2.1.6)

- Updated updater_script to remove bolt_scripts. I moved the directory hierarchy a bit in the last version (forgot to add that). Hence, removing it so that people will realize the scripts are in a different position already.

- Users have to manually readd remount scripts in Script Manager because of the above change.

- Added remountCM7MIUI-fullext4. A variation of CM7/MIUI that doesn't use yaffs2. Renamed the original remountCM7MIUI to remountCM7MIUI-yaffs.

- I just noticed that CFSK is actually the wrong CFS I wanted to use. Edited CFSK with the correct values. Should feel much smoother.

- Revamped most of the echo tweaks to use sysctl instead. Might make it compatible with ICS.

- Increased Dalvik heapsize to 48MB (another 16MB won't hurt much).

12/3/2011 (2.1.5)

- Added N7000 remounts.

12/2/2011 (2.1.4)

- Integrated some MintBolt! tweaks, notably the noda_auto_alloc and build.prop. The build.prop shouldn't change anything much but the noda_auto_alloc should make I/O transaction a little faster at the expense of corruption risk, which is small by the way.

- Fixed the sqlite_optimize by using busybox find instead. If you can't do busybox find, it means your busybox symlinks are broken. Contact your kernel/ROM developer for a fix.

11/27/2011 (2.1.3/Screenstate_scaling 1.2.3/80MB + 60MB 1.0.3/3G 1.0.3)

- Fix for 3G CM7/MIUI (I think) by removing some settings that doesn't do anything.

- 80MB/60MB LMK modified to be better at performance but sacrifices a bit of multitasking.

- ChainFire's touchscreen tweak integrated. Touchscreen more sensitive.

- Screenstate_scaling edited to be a bit more battery saving.

- CFS moved to another file (CFS experiments moved to bolt_scripts. If you would like to use another CFS, delete the one in init.d and copy the one you like back to init.d)

- sqlite_optimize and darky_zipalign improved to support Script Manager that doesn't symlink xbin/sbin automatically.

- Added SGSII remount

- Reduced readahead for phone mounts (non-sdcard mounts) to 256. This would reduce Quadrant I/O score by a significant value, as higher readahead boosts Quadrant scores.

Quadrant is USELESS!!!!!1111 Link

. Sdcard readhead is still 1024.

11/25/2011 (LMK 1.0.2)

- Fixed the Talon swappiness/ZRAM size typo

- Fixed the 80MB LMK typo