Related
Is there any app providing a nice gui to top and allowing you to kill apps?
All the task managers out there seem to show only some system apps, if any, and that's just not good enough.
Background: Today I had the gps process use 100% cpu and I had to start 'top -o cpu -m 3' to find the process, then kill -9 it. Quite cumbersome when your phone is hardly responding.
LATEST UPDATE: 02.02.2013
A question that I'm often asked is:
"Can I have your permission to use your script in my ROM etc...?"
That answer to that is:
"Yes it is ok to use the code. I don't really believe it's useful anymore, but if you can find a use, and possibly improve the code to make it work better, go for it."
Version 1.0.2
Download available for ClockworkMod: requires Root (Superuser/Busybox), and a kernel that supports "init.d" scripts (script files that are stored in /system/etc/init.d/).
Always have a backup before installing any modification. Even though this script is rather simple, I can't guarantee it will work on every ROM! It appears to freeze custom ROMs such as CM, I don't know why. Maybe someone else knows.
NOTE: This script appears to be less and less useful as newer ROMs and phones become more sophisticated in dealing with any sort of lag. Tested on I9000XWJW9 and it doesn't seem to help. This ROM is quite smooth anyway.
What this script hopes to achieve:
- Entering your PIN with minimal/no delay/lag
- Minimising delay with lock screen pattern/unlock (not the time it takes to wakeup, but the touchscreen response lag)
- Having smoother notifications on the status bar, and smoother pulldown menu response
- Minimising Launcher lag while Media Scanner is running (can scroll through screens without heavy pauses)
- Minimising lag when scrolling through the market while icons are still loading
- Installing/Uninstalling apps while continuing other tasks
- Minimising/eliminating intermittent lag spikes in gaming
- No delay in being able to answer phone calls
... you get the idea
#!/system/bin/sh
#
# Loopy Smoothness Tweak v1.0.2 - 02/02/2013 (http://forum.xda-developers.com/showthread.php?t=1137554).
#
# An attempt at keeping the UI running a little smoother.
# Optimised for Galaxy S1 stock ROM, but can be modded for other Android devices. Backup recommended before running scripts.
# Not recommended for custom ROMs, such as CM. The "sleep" command appears to halt the OS, rendering the script useless.
# Feel free to edit how you wish, but please leave at least the first comment above as is.
# Any editing must be saved in UNIX (LF) format. Google "text editor unix lf" to read more.
#
Click to expand...
Click to collapse
However, as phones get faster, this script will probably have less of an effect.
Even with 2.3.6 and ext4, RAM scripts, governor tweaks, other tweaks, etc. the occasional lag still appears to be there, especially noticable when installing/unistalling, gaming, or even just scrolling through the launcher screens and menus. I decided to investigate. Being a linux newbie, I had to also source the appropriate commands.
The following has been discussed a little here and there on other Android forums, but surprisingly I couldn't find anything about it in the I9000 section...
Thinking of how processes in Windows can be run with six different priorities (Low, Below Normal, Normal, Above Normal, High, Realtime), I investigated to see what the deal was with Linux/Android. Turns out there are forty settings, ranging from -20 (Highest) to 0 (Default) to 19 (Lowest).
The next step was to see which process was causing the CPU bottleneck as it was happening. The top command is handy for this. I used this in adb shell (these tests were performed quite some time after reboot when there was craploads of stuff in the memory - the impact is not very noticeable after a fresh boot, or with very few apps installed/running.
UPDATE: The reason behind the majority of the kswapd0 issue was due to modified code of a custom kernel I was once using. I do however still find the script of benefit to me, and maybe you will too. You can still read below if you wish, but it may be irreverent.
Code:
adb shell
top -n 1
At the top of the list was:
18 16% R 1 0K 0K fg root kswapd0
Click to expand...
Click to collapse
kswapd0 is a kernel thread responsible for managing the memory.
I know Angry Birds can show a little lag from time to time, so I performed a little testing while playing that.
To change the priority of a running process, I used the renice command as such:
Code:
su
renice -20 `pidof kswapd0`
where -20 equals highest priority and `pidof kswapd0` returns the PID of the process, which is required by renice. In this case, 18.
To confirm the change, the ps command will give you what you need to know. Interesting to note "krfcommd" with a value of -10, and "mediaserver", -8.
Code:
ps -p kswapd0
If you enter "ps -p" all processes in memory are shown, along with their "nice" value.
It shouldn't take long before the game becomes barely playable at times (for a split second), as kswapd0 completely takes over the CPU until it performs its task. Setting the priority to
Code:
renice 0 `pidof kswapd0`
returns kswapd0 back to its default, and Angry Birds with the seldom lag. Let's go the other way now with
Code:
renice 19 `pidof kswapd0`
setting kswapd0 to its lowest priority, it should now have barely any impact on the game, if at all. Will this have negative impact on Android, though? Not sure yet.
We can even go one better and give Angry Birds all the CPU it needs via
Code:
renice -20 `pidof com.rovio.angrybirds`
With these settings in place, you could virtually play this all day, and your battery would probably be flat way before any lag becomes noticeable.
One problem though, when you close and reopen the game - assuming it's left the memory - it will have a new PID and the priority is set back to 0 (default).
Now, with my very limited knowledge of Linux/Android/Busybox, I'm not sure if there's a way to tell an app to open with a priority other than 0. Well, there is the nice command, but I couldn't get that working.
A common problem is the phone dialer app taking too long to popup when someone calls. Luckily, processes such as this one enter the memory from boot and seem to remain there. Setting its priority to -20 will basically tell the CPU to hold everything with less priority and open the phone dialer ASAP so you can take that call. And it works. I was on Angry Birds when a call came in, and was able to answer it on the first ring. I tried then calling myself without the -20 phone or the 19 kswapd0 settings, and there was an extra 2-3 second delay before I was able to answer. A few other apps that usually never leave the memory are default launcher (in my case, ADW Launcher EX), SMS/MMS app, Swype, Status Bar, and some others.
Even with apps launching at the default priority, with kswapd0 at 19, it still allows them more CPU, and may just be enough to combat this lag that people have tried to rid of with RAM scripts, Overclocking, and what not.
The script shown below is not the current init.d download script.
And the result (still a work in progress):
Code:
#!/system/bin/sh
###### Loopy Smoothness Tweak for Galaxy S (Experimental) #######
sleep 3
renice 18 `pidof kswapd0` # please give credit and thanks to loopy for this line if it works
##### Set nice levels for smoothness loop BEGIN #####
### Let's loop this in the background for a bit
for i in {1..20}
do
sleep 5
### Phone dialer app ###
renice -20 `pidof com.android.phone`
### Launcher apps ###
renice -19 `pidof com.sec.android.app.twlauncher` # TouchWiz Launcher
renice -19 `pidof org.adwfreak.launcher` # ADW Launcher Ex
renice -19 `pidof org.zeam.core` # Zeam launcher
### System apps ###
renice -19 `pidof com.android.mms` # Text message app
renice -19 `pidof com.swype.android.inputmethod` # Swype keyboard
renice -15 `pidof com.sec.android.app.controlpanel` # Task manager
renice -15 `pidof com.android.systemui` # Status bar
renice -9 `pidof com.android.settings` # Settings menu
renice -9 `pidof com.android.browser` # Browser app
renice -9 `pidof com.android.vending` # Market app
renice -6 `pidof com.sec.android.app.camera` # Camera app
renice -6 `pidof com.sec.android.app.fm` # FM Radio app
renice -6 `pidof com.google.android.youtube` # YouTube app
renice -6 `pidof com.google.android.apps.maps` # Maps
renice -3 `pidof android.process.acore`
renice -3 `pidof android.process.media`
### Memory management kernel thread ###
renice 19 `pidof kswapd0` # please give credit and thanks to loopy for this line if it works
done
##### Set nice levels for smoothness loop END #####
What would be ideal is if programs such as launchers (TouchWiz Launcher etc..) had the ability to set its "nice" level upon launch, and have kswapd0 set real low, assuming it's safe to do so. If Android isn't doing this, why not? This isn't a good idea? Maybe it's only Samsung? If so, then... well, I won't ask why not...
NOTE: These commands/parameters vary depending on the su/busybox version installed.
Common SGS1 apk's:
com.android.phone # Phone
com.sec.android.app.dialertab # Dialer
com.sec.android.app.twlauncher # TouchWiz Launcher
com.android.mms # Messaging
com.swype.android.inputmethod # Swype keyboard
com.sec.android.app.controlpanel # Task manager
com.android.systemui # Status bar
com.android.settings # Settings menu
com.android.browser # Internet Browser
com.android.vending # Google Play
com.sec.android.app.camera # Camera
com.sec.android.app.fm # FM Radio
com.google.android.youtube # YouTube
com.google.android.apps.maps # Google Maps
com.android.phone # Phone
Common SGS3 apk's:
com.android.phone
com.android.contacts
com.sec.android.app.controlpanel
com.android.browser
com.android.mms
com.android.vending
com.android.settings
mediaserver
com.sec.android.app.camera
com.sec.android.app.videoplayer
com.sec.android.app.myfiles
com.android.browser
com.sec.android.app.camera
Click to expand...
Click to collapse
Quick FAQ:
I wanna see how it works without it again, how do I remove the script?
To remove, delete the file /system/etc/init.d/S00loopyst. If using Root Explorer, use Mount R/W before you attempt to delete. For adb, use the commands at the DOS prompt:
Code:
C:\>adb root
restarting adbd as root
C:\>adb remount
remount succeeded
Code:
[SIZE=2][SIZE=2]C:\>adb shell rm /system/etc/init.d/[/SIZE][/SIZE][SIZE=2]S00loopyst
[/SIZE][SIZE=2]
[/SIZE][SIZE=2]C:\>
[/SIZE]
For the Test versions (prior to v1.0.0):
Code:
[SIZE=2][SIZE=2]C:\>adb shell rm /system/etc/init.d/S_loopy_smoothness_tweak[/SIZE][/SIZE][SIZE=2]
[/SIZE][SIZE=2]
[/SIZE][SIZE=2]C:\>
[/SIZE]
How can I make this script run first/last?
Scripts in the init.d are run in alphabetical/numerical order, following the letter "S". For example, script "S_ramboost" would run AFTER "S00loopyst", because "r" is after "l". Renaming it to "S_1ramboost" will now run that script BEFORE "S00loopyst".
How do I edit the script and add apps I use?
Open the .zip file and extract the file S00loopyst from /system/etc/init.d/. Alternatively, if installed, you can edit the file directly from the phone's init.d folder. File must be saved in UNIX format.
So I can just edit the script and add apps I use?
You can, but there is no guarantee this will actually work. Very few processes remain in memory...there is a lot of chopping and changing going on in the background. You could alter the script's timing variables, but even then results are unpredictable with anything other than what I call the resident system processes. If you're able to improve the script in any way, let us know.
Will this work on a custom ROM such as CM/MIUI?
Probably not. The "sleep" command within the screen appears to run in the foreground as opposed to the background in a stock ROM, hence making the script useless. Not to mention it may prevent anything else loading.
Are the settings permanant?
Usually. Most apps remain in the memory, although some do come and go. If you use the Task Manager to clear apps from the memory, or use the "Clear memory" option, the apps will have lose their priority when removed from the memory.
Changelog:
v1.0.2a:
Added option for "low priority" tasks.
Early script finish if 2nd loop is complete before "number of checks" is complete.
More detailed log file.
v1.0.1:
Cleaned up some invalid code.
Tested OK on rooted Samsung GT-I9000 2.3.6 ROM.
Tested OK on rooted Samsung GT-I9305T 4.1.1 ROM.
Tested NOT OK on CM 9.1 GT-I9000 ROM. Phone freezes on boot until loop is complete.
v1.0.0:
User friendly - a lot easier to configure.
Total number of processes automatically calculated (used to shorten 1st loop if all apps are in memory).
Debug file created for troubleshooting (includes "renice" pass or fail test) - can be saved to /data partition or sdcard.
Simple "Aggressive" option to increase priority of resident and other apps.
In addition to kswapd0 checking before continuing, launcher app is also checked in a loop before continuing (usually no more than ~15 seconds after start-up).
oom_adj & oom_score settings for launcher to remain resident (doesn't seem to work too well... settings don't appear to "stick").
T2:
"Smarter" script.
Checks for kswapd0 every 3 seconds until found, and then 'nice' level is set.
1st loop: checks for apps 60 times, at an interval of 3 seconds. Once an app is found in memory, 'nice' level is set, and it is not checked again during the loop. (Some apps enter and then leave the memory, which ain't helpful.)
2nd loop: checks again 6 times at an interval of 5 seconds and sets 'nice' level.
Settings are a little more user-friendly.
Debug option (if kernel stores a log file).
T1:
Sets kswapd0 'nice' level after 3 seconds.
Pauses for 15 seconds, sets 'nice' levels for other apps (many of which don't remain in memory).
Download:
Download file and transfer to SD card
Enter ClockworkMod Recovery via Vol+Up/Menu/Power button combo
Select zip and install (remove any "Test" versions before using Version 1 or above)
I'm not a Linux/Android master myself, but this actually is food for thought. I'll try and do some reading, and i would really like to hear more experienced users's opinion about it.
Thanks for the explanatory post.
Very interesting idea
Sent from my GT-I9000 using XDA Premium App
Thanks for the feedback so far. I too would like to hear what more experienced users have to say, as I've only been using linux for a few days now and have quite a lot to learn.
The other good thing about this is, if it turns out to be a good idea, I'm guessing it can be used on basically any Android device.
this is something to be looked at
interesting
I'd personally like to see more discussion on this and input from more experienced people as well so...
BUMP
A good place to start from...
Will take a look more....i am very interested on this and if u need help in scripts i can help u....
Sent from my GT-I9000 using XDA Premium App
interesting approach lpy !
FYI:
looping should be fine since it is also done, e.g. on the Galaxy Spica and CM7
but with different parameters
I have some ideas back in the back of my mind that might help with this issue (kernel-patches and other stuff)
Thanks !
edit:
related:
On Saturday, May 07, 2011 09:35:48 PM Ali Ahsan wrote:
> Hi All
>
> I have xeon server with 16 Gb Ram and no Swap memory.I am running
> cassandra server on two node in cluster.When there is high load on
> server kswapd0 kicks inn and take 100% cpu and make machine very slow
> and we need to restart out cassandra server.I have latest kernel
> 2.6.18-238.9.1.el5.Please let me know how can i fix this issue .Its
> hurting us badly this our production server any quick help will be
> appreciated.
There is more than one bug that causes this behaviour. A few related memory
managent situations (possibly responsible) may actually be avoided if you add
some swap (even if it's not used). My suggestion would be to add some swap,
set swappiness to 0 and see what happens.
/Peter
_______________
Click to expand...
Click to collapse
http://www.linux-archive.org/centos/523508-kswapd-taking-100-cpu-no-swap-system.html
Tried the script with go contacts,go sms, go launcher (edited ofcourse)
it seems to make them open instantly even when they aren't running in the background..
if some1 could make an app which make the app you use as -20 or something and if you close it or move to another one make it back to 0..
It would be really interesting to see this being controlled at Kernel level (if possible.)
I know that it contains the govenors to control the CPU and UV settings (smartass, conservative, etc.), but wouldn't it be awesome if you could determine a priority level for apps installed on your phone so that it removed a load of junk from memory?
I mean I know app developers would all start setting their apps "attention level" to -20, but if there could be an intelligent manager for this, it would make things alot faster I would think.
lttldvl said:
It would be really interesting to see this being controlled at Kernel level (if possible.)
I know that it contains the govenors to control the CPU and UV settings (smartass, conservative, etc.), but wouldn't it be awesome if you could determine a priority level for apps installed on your phone so that it removed a load of junk from memory?
I mean I know app developers would all start setting their apps "attention level" to -20, but if there could be an intelligent manager for this, it would make things alot faster I would think.
Click to expand...
Click to collapse
that s the goal , ultimately all these task killers try to achieve problem as of today is it usually creates more problems then it solves ..
having a script in init.d folder or using gsript (market app ) to run script manually on a regular basis to ensure your apk have the proper level ..
@ OP : good thread
that's really interesting approach but it has also some drawbacks. With nice you give a process more CPU time and in case that the application is not written properly you could end up with frozen system.
looping this script will eat my battery? i see it like a permament recursive process running in background.
phone will sleep properly after? cpu usage?
Indeed there is a speedup if I use parts of your script. This is an interresting approach to gain your most important task faster. I often recognized a large latency if I opened phone or sms/mms. Is their a way to preload this apps and prevent its swapping out of ram?
Edit: recognized a reliable process when updating a lot of apps at once -> no update failed message any more
using scripts should be fine and the resource consumption should not be a problem, if it is used properly
while using nice/renice will gain some benefits in controlling the priorities (i use nice too in some cases), i doubt the effectiveness if all thoese processes are set to low priorities
also, on my phone, the kswapd0 only consumes very little resources and it's not even in the top 10 in the top results but somewhere near 20
All good responses so far, and definitely making a lot of sense.
@simone201 many thanks re the script offer. There is no doubt this script can be improved, for example, having an 'if ... then' condition where once an app enters the memory, the "`pidof" changes from 0 (false) to a PID (true), and then the nice value can be set.
matematic said:
that's really interesting approach but it has also some drawbacks. With nice you give a process more CPU time and in case that the application is not written properly you could end up with frozen system.
Click to expand...
Click to collapse
Very true. -20 can be quite a dangerous setting if an app decides to play up.
lttldvl said:
I mean I know app developers would all start setting their apps "attention level" to -20, but if there could be an intelligent manager for this, it would make things alot faster I would think.
Click to expand...
Click to collapse
haha. I can see "priority wars" happening between developers and apps.
If Android doesn't take advantage of nice, I don't see why we can't. It's possible that in 12 months from now when many phones are dual core (or more?), this may have little impact, but for now this should prove very handy.
ykk_five said:
using scripts should be fine and the resource consumption should not be a problem, if it is used properly
while using nice/renice will gain some benefits in controlling the priorities (i use nice too in some cases), i doubt the effectiveness if all thoese processes are set to low priorities
also, on my phone, the kswapd0 only consumes very little resources and it's not even in the top 10 in the top results but somewhere near 20
Click to expand...
Click to collapse
I agree with all that, however, I don't really see it as a matter of "how much" it uses in terms of resources, but rather "when". My example with Angry Birds and a stock ROM, you will notice little glitches here and there, due to the work kswapd0 does. Lowering its priority still enables it to complete its task/s, but without interfering with real-time action.
Here are examples of some improvements I've noticed:
- Entering your PIN minimal/no delay
- Minimising delay with lock screen pattern/unlock (not the time it takes to wakeup, but the touchscreen response lag)
- Having smoother notifications on the status bar, and smoother pulldown menu response
- Minimising Launcher lag while Media Scanner is running (can scroll through screens without heavy pauses)
- Minimising lag when scrolling through the market while icons are still loading
- Installing/Uninstalling apps while continuing other tasks
- Minimising/eliminating intermittent lagging in gaming
- you get the idea..
The way I see it, at the very least, lowering the priority of kswapd0 already helps with the way everything runs. Setting an app's nice/renice value (if managed in a practical way) will be a bonus.
Just a quick note (uncertain if this is even related):
A couple of kernels ago (yes, i switch a lot) i noticed a large battery consumption by "Android System". This was running JVP, and DarkCore 2.7.3 i think... But it wasn't until I read this thread that I remembered that the reason I switched kernels was because of a "laggy" system. After a while the phone seemed a lot slower, and I had to reboot to get the initial speed.
Now with Galaxian kernel I have an extremely snappy phone, and the "Android System" drain is gone aswell....
How do you get the process name of an application (to edit the script)?
Edit\\ open app in app manager (astro)
I think this is an important topic, but don't see much feedback from developers.
My question as a non developer is:
is there a way for me to use this? seems like the script is already there, so it could be possible to have a flashable zip or a tutorial because different apps/versions require a different script.
Cool thing. I remember something very similar to this when I was having HTC Dream. There was scheduling app which runs similar script like this Will try it and post my opinion
Hey guys,
Seems there's a lot of ways you can improve the speed of Android in general. Some seem to be snakeoil... others, work quite well and there's proof to back it up.
I'm only interested in discussing the latter .
A lot of people have helped me gather a better understanding of Android (hyc, stinebd to name a few) in addition to a lot of Google searching. I am going to compile a list of what I have done, I would like to hear what you guys have done! Most app killer apps / app control will already be addressed, so those tools need not apply... I'm looking for real, permanent fixes here without adding more apps!
I am also trying to have topics that are easy working up to advanced. Obviously the more advanced topics are going to be harder to do. You've been warned.
So here's the disclaimer.
****DISCLAIMER****
Speed is as always relative. That basically means I don't want arguments about which build is faster. I want to argue about how to make every build faster .
Also, these tips should apply to any build, any device... they are pretty generic tips, but are obviously specific to Android, with some idiosyncrasies that apply to our port that wouldn't apply to native Android devices. Some is common sense, others are real ways to tear into the system. Hope you enjoy it!
Topic 1
Difficulty Easy - Apps/Widgets
I've noticed the number of widgets i have on my screens, or the number of apps that I have installed/are running in the background to greatly effect performance, in an obviously negative way.
Once I removed all the widgets (I only have the basic analog clock widget & the Google search widget on one desktop...) this seemed to improve general speed. One minor thing to check is if apps are set to auto/background sync. Only enable the ones you really want syncing, others just check manually.
On this same topic, replacing the launcher (the stock launcher in Android, Launcher2 is quite slow) can help immensely. I like ADW, but I've used LauncherPro in the past and it is good. Zeam also seems like a good launcher. I haven't used Go Launcher EX, I've heard good and bad things about it. Use what works best for you, try 'em all!
The last thing on this topic I would like to mention is animations. Settings -> Display -> Animation -> No animations can make the phone feel quite a bit snappier, obviously at the expense of the look/feel of the OS.
Topic 2
Difficulty Easy - Controlling app 'net Access
This leads me into the next topic, DroidWall. I've noticed that blocking apps from accessing the internet has been a very good thing - it's not so much a performance booster (although it probably does provide a little bump) it's mostly about battery life. Just be warned, if you block an app that is set to background sync, it will probably have very negative effects. Only disable an app's access to the internet with DroidWall after you've checked that app's background sync feature is disabled. I have a few apps allowed in DroidWall, and the rest are blocked. You can "whitelist" everything and check apps you want to block, or "blacklist" everything and check the apps you want to allow. It's a little annoying to remember to enable/disable DroidWall (I use the DroidWall widget to enable/disable it globally) but if you do, it is much better - you have complete control over how apps access the 'net on your device. It is available on the Market.
Topic 3
Difficulty Moderate - SD cache/readahead tweaking
The only reason I'm calling this one 'moderate' is the number of choices you have for settings for this... It's basically telling the SD card how much to hold on to or... read "ahead" if you will . This was turned way up in FRX07, (from 256kb to 2048kb or 2mb...) and I think this might be the source of a lot of the complaints of 'mini-resets' if you will where the boot animation is suddenly seen after a long system hang...
So some cards will work better with a larger setting - I've heard some with spankin new C6 cards that said 3072kb or 3mb was a good setting. Others have found a sweet spot at 256kb or 1024kb (1mb).
There are two ways of doing this - you can hack the init in the rootfs and adjust the setting manually, or be lazy like me and use SD Booster (from the Market). Adjusts the same settings, and they are applied immediately!
I would like to find a "sweet spot" - a good default if you will. Can folks test out 512kb and 1024kb, see if you have any more mini-resets within Android or any other slowness, etc... Obviously this isn't a cure-all for the slowness or the mini-resets, what we're looking to do is mitigate the effects. So let's focus on that, thanks!
Topic 4
Difficulty Moderate - Overclocking
Overclocking is obviously one relatively easy way to improve the speed of Android. In your startup.txt, add a line
Code:
acpuclock.oc_freq_khz=710400
for example to overclock to 710.4mhz. How did I find this value? I actually put in 714000, but if you look at dmesg near the beginning you'll see "ACPU running at ..." - that's what clock is the actual maximum. It goes in 19.2khz increments.
Feel free to experiment with how high your phone can go, just be warned that the higher you go the potential for failure goes up as well . Phone shouldn't blow up, but it might not work correctly or at all. Rebooting and scaling it back will fix it.
Here's the full *example* startup.txt:
Code:
set ramsize 0x10000000
set ramaddr 0x10000000
set mtype 2292
set KERNEL zImage
set initrd initrd.gz
set cmdline "lcd.density=240 msmvkeyb_toggle=off gsensor_axis=2,1,3 pm.sleep_mode=1 physkeyboard=rhod400 acpuclock.oc_freq_khz=710400"
boot
You can put the command anywhere in the cmdline section, just make sure it's between the quotes and at least one space between each command.
Topic 5
Difficulty Advanced - How Android Manages Memory/apps
Ok, I'm going to take two approaches to this. The first, is the full explanation on how Android manages memory.
Please feel free to read the post I originally read that inspired me to start looking at this stuff - How to configure Android's *internal* taskkiller. It was very helpful for me to grasp how Android manages applications. This is the reason why application killers are not a good thing...
If you want to do it manually, Starfox suggests:
Code:
echo "1536,3072,8192,10240,12288,20480" > /sys/module/lowmemorykiller/parameters/minfree
To try to do these commands, adb is very useful. Once you get adb shell working, then you just need to "su" (provides 'super user' privileges (root)) and put in the echo command above ^^.
I had another user (thanks icevapor) suggest this script -
[Script] V6 SuperCharger! HTK & BulletProof Launchers! The ONLY Android MEMORY FIXER!
I tried it myself, and it works very well. This thread is a little overwhelming, but the jist of it is this:
Install Script Manager (on the Market)
Run the V6 SuperCharger script. I use "Aggressive 1 Settings" (#2) and then I use the OOM Grouping Fixes & "Hard to Kill" launcher (#17)
Point Script Manager to run /data/99SuperCharger.sh to run as root & on boot. This will ensure the tweaks are reapplied after a reboot.
Topic 6
Difficulty Advanced - Managing Apps that auto-start on boot
This is one of the most annoying things in Android. When you have no apps installed, it seems very fast. Then you install apps, and you never seem to get that original speed back... Now you can!
This is kind of difficult to do, I am still getting the hang of it... but here goes. All credit goes to hyc, his original post.
The basic idea here is you run a logcat (adb logcat is easiest here, or you can use GetLogs to pull logcat...) Look in this log for "for broadcast" and find apps that start on boot. For example,
Code:
Line 41: I/ActivityManager( 1394): Start proc nextapp.systempanel for broadcast nextapp.systempanel/.monitorservice.BootReceiver: pid=1752 uid=10060 gids={3003, 1015}
Notice there are two sides of the "for broadcast". The name of the package (nextapp.systempanel) and the name of the service, "nextapp.systempanel/.monitorservice.BootReceive". I made the mistake of disabling the app (the left side). Do not do this, you want to disable the right side!
So in the shell,
Code:
pm disable nextapp.systempanel/.monitorservice.BootReceive
This will be persistent across boots, it will go with your data.img.
Obviously this was just one example of an app to disable. So long as you disable the right side (after the 'for broadcast') you shouldn't disable anything that will cause a serious problem. The apps should still work, but for example if you disable Google Voice you won't get messages until you open the app. So think about that... You disable Titanium Backup schedules.BootReceiver, the schedules for Titanium Backup (if you have any) won't run. Stuff like that. Disable calendar, you won't get calendar events... Disable clock no alarms. Get it? Good. I have been rebooting several times, and I keep checking what is set to start on boot. I'm not quite happy with it yet, but there's some things I'm leery of disabling. Just be wary, if you do disable something and don't like it - just pm enable <whatever you disabled>.
Now experiment away! The one caveat is if you do break something with pm disable (and it's serious) you might get a failure to boot. It really depends on how bad you mess up. If you make a copy of your data.img before you start making these changes, you can revert to that data.img and start back there.
Alright guys. Going to use this thread as a way to brainstorm about ways to improve the speed. Read up what I've posted, let me know if I did anything wrong... Also let me know what you guys do to improve speed!
Don't care about what build you're running, this thread isn't about what build is fastest - this is a how do I make every build faster thread.
I also realize I posted this in the Rhodium section - I want to see if there's any RAPH-specific tweaks that others should be made aware of!
Slightly off topic post
I do realize all of us are looking for ways to improve over all performance but what about a means to restore these settings or even possibly a means to run a script to apply the setting(s)? Perhaps something like XDA_UC for winomo but for Android. Or should there be something like this available already and I'm just the last person getting to the party (or not)?
R^7Z said:
I do realize all of us are looking for ways to improve over all performance but what about a means to restore these settings or even possibly a means to run a script to apply the setting(s)? Perhaps something like XDA_UC for winomo but for Android. Or should there be something like this available already and I'm just the last person getting to the party (or not)?
Click to expand...
Click to collapse
I guess you didn't read the first post... I wanted to do all this without apps.
You can find an app to tweak almost all of these things. If you read the article, there's an app to adjust the values for minfree. As for the pm disable stuff, there's an app out there but hyc said the one he found was a paid-for only app. One of those task killer apps that with the paid version has a startup manager - he didn't mention which one, but I agree with him... I'd rather just do it myself.
So the two 'advanced' topics can easily be handled with an app. I don't want to do it with apps, if you do more power to you.
Not really looking for an app but I guess my post mentioned XDA_UC. Either case, I am just looking for a way to add commands without having to redo the command for each re-run start over of XDAndroid; like the froyo.user.conf file?
I usually remove the androidapps and media folders for the initial start. Seems to really boot much faster for both of my RAPHs (100 and 110)
R^7Z said:
Not really looking for an app but I guess my post mentioned XDA_UC. Either case, I am just looking for a way to add commands without having to redo the command for each re-run start over of XDAndroid; like the froyo.user.conf file?
I usually remove the androidapps and media folders for the initial start. Seems to really boot much faster for both of my RAPHs (100 and 110)
Click to expand...
Click to collapse
...Do you put the folders back in afterwards?
The pm disable stuff is persistent, as I said. The minfree stuff, in lieu of an app I would think either putting the echo command in froyo.user.conf, or I think you would be able to make the change directly to the init.rc (or init.cfg/init.froyo.rc for our port/FRX builds). Definitely easier to just put the echo command in the user.conf file.
Correct! Either that or I compress/zip the folders (again only for the initial start/boot) and uncompress after the boot. Quite obviously, the latter would require more space but you wouldn't require a reboot, less you wanted use of the androidapps folder(drag-n-drop app/XDAndroid supported method).
That PM stuff makes my head swirl; bad enough I stare at numbers each day for about 8 hours
R^7Z said:
That PM stuff makes my head swirl; bad enough I stare at numbers each day for about 8 hours
Click to expand...
Click to collapse
Yea, it took me a while to sort it out. I'm definitely doing it correctly now, but it took a few 'oh crap' issues before I got it right. I also think I can trim it more, but I want to dedicate more time to testing it. The first batch I romped thru, I knew I didn't want things like Pandora starting at boot. You might want to take a look at it, and just look for the stuff that sticks out at first. Don't mess with it if you don't know what it does, and you'll be safe.
The issue that the pm stuff solves is having a lot of apps - a lot of these apps are designed to start on boot, whether you want them to or not. This gives power users true control over the startup of apps... It definitely helped my phone out. All of the 'tweaks' combined have helped tremendously in fact. I have been on a mission the last few days, and I've definitely narrowed down some things that really seem to make a difference on my device. There is a lot of fluff & BS around how to make a phone faster/run better, I wanted to have a thread where all the facts were laid out, without any fluff (hopefully).
cpu freq of 710400 is working well on my raph800 so far, havent noticed too much change in setting minfree but i usually keep as much programs killed as possible.
About to issue the following pm disable commands
Code:
pm disable com.android.voicedialer/.VoiceDialerReceiver
pm disable com.pandora.android/.api.bluetooth.AutoStartReceiver
pm disable com.paxmodept.palringo.android.main/com.palringo.android.integration.AndroidTaskScheduler$Receiver
pm disable com.rechild.advancedtaskkiller/.AutoStartReceiver
pm disable com.google.android.apps.maps/com.google.googlenav.friend.android.ServiceReceiver
runs fine as hell yo.
We should test out: http://forum.xda-developers.com/showthread.php?t=991276
I use it on my epic4g... I'll have to stick it on my wifes tp2.
icevapor said:
We should test out: http://forum.xda-developers.com/showthread.php?t=991276
I use it on my epic4g... I'll have to stick it on my wifes tp2.
Click to expand...
Click to collapse
Hrm. There's some interesting topics there that I haven't addressed.
Not sure that script as-is should be applied to our phones, but most of it sounds pretty good.
Wow. I am impressed with that script. Kinda wish I had found that earlier to be honest... I can pretty much remove all the minfree discussion from my post in lieu of this script .
I ran it, and everything seems fine. I already had values that were pretty similar to what he had, so I haven't really noticed a huge difference in the other things the script did, but time will tell. I'm also curious if it gets reapplied correctly on boot.
Thanks for the link tho, assuming I can get it to work well (which so far it seems to work just fine) I will integrate it into the first post and probably remove all the blather on minfree. I'll keep the links up in case people want to read it, but having this script definitely circumvents any need to understand it yourself .
Well, it seemed to work... but I need to sort out how to get it persistent across reboots.
Alrighty, got it all sorted using Script Manager.
I've updated the first post with the details on how to use this script. Thanks again icevapor!
not sure if its placebo effect (haven't been testing it long yet) but i set the following settings and it felt even faster on RAPH800 (note: only deviations from defaults are listed)
froyo.user.conf -> compcache -> cc_disksize=86
froyo.user.conf -> compcache -> cc_memlimit=58
froyo.user.conf -> custom_shells -> echo "1536,3072,8192,12288,16384,24576" > /sys/module/lowmemorykiller/parameters/minfree
startup.txt -> acpuclock.oc_freq_khz=710400
Hi,
sorry for the noob question but...how can I check if an application is set to auto/background sync? And how I can enable/disable it for a single application?
Thanks
automatic_jack said:
Hi,
sorry for the noob question but...how can I check if an application is set to auto/background sync? And how I can enable/disable it for a single application?
Thanks
Click to expand...
Click to collapse
It's all app-specific. In Google Voice for example, you hit menu, more, settings, sync & notifications - this app has two options, "background data" and "synchronize inbox". To properly sync the inbox, bg data must be enabled.
Every app is different, and not all apps have these options - or even similar options. Just poke around the apps you have in question and see what settings are available.
arrrghhh said:
It's all app-specific. In Google Voice for example, you hit menu, more, settings, sync & notifications - this app has two options, "background data" and "synchronize inbox". To properly sync the inbox, bg data must be enabled.
Every app is different, and not all apps have these options - or even similar options. Just poke around the apps you have in question and see what settings are available.
Click to expand...
Click to collapse
ah, ok...thanks for the reply
Squirrels said:
froyo.user.conf -> custom_shells -> echo "1536,3072,8192,12288,16384,24576" > /sys/module/lowmemorykiller/parameters/minfree
Click to expand...
Click to collapse
Do you have compcache enabled or disabled?
This may seem slightly askew from the current conversation but hear me out.
So far, with what builds I've made for myself, I have been able to "strip" the entire build down to just bare essentials just by removing apps from the /system/app or /data folder BEFORE installing a build.
Non-essentials for me would be:
Car Home
Google Search (same as built in search anyway)
Music (I tend to use a different player for this)
Talk
Voice Dialer
and any pre-installed apps that may come with the build.
LauncherPro plus is my launcher of choice, with eye candy enabled.
Of course this is a slightly different platform (HTC Kaiser), but should work the same way for HaReT or XAndroid builds as well. Also, some of the commands entered could be done with Terminal Emulator, giving you a POSIX terminal with "su" already enabled.
Just my $.02
Hi all,
Launcher2 and ADW are both open source so I can use them...but, who is faster?
Thanks
automatic_jack said:
Hi all,
Launcher2 and ADW are both open source so I can use them...but, who is faster?
Thanks
Click to expand...
Click to collapse
I like ADW myself. Launcher2 doesn't seem so great...
I especially like a launcher that can rotate with the phone. Plus the other options ADW provides are very nice IMHO.
Try both, use what works best for you .
Hey guys,
Seems there's a lot of ways you can improve the speed of Android in general. Some seem to be snakeoil... others, work quite well and there's proof to back it up.
I'm only interested in discussing the latter .
A lot of people have helped me gather a better understanding of Android (hyc, stinebd to name a few) in addition to a lot of Google searching. I am going to compile a list of what I have done, I would like to hear what you guys have done! Most app killer apps / app control will already be addressed, so those tools need not apply... I'm looking for real, permanent fixes here without adding more apps!
I am also trying to have topics that are easy working up to advanced. Obviously the more advanced topics are going to be harder to do. You've been warned.
So here's the disclaimer.
****DISCLAIMER****
Speed is as always relative. That basically means I don't want arguments about which build is faster. I want to argue about how to make every build faster .
Also, these tips should apply to any build, any device... they are pretty generic tips, but are obviously specific to Android, with some idiosyncrasies that apply to our port that wouldn't apply to native Android devices. Some is common sense, others are real ways to tear into the system. Hope you enjoy it!
Topic 1
Difficulty Easy - Apps/Widgets
I've noticed the number of widgets i have on my screens, or the number of apps that I have installed/are running in the background to greatly effect performance, in an obviously negative way.
Once I removed all the widgets (I only have the basic analog clock widget & the Google search widget on one desktop...) this seemed to improve general speed. One minor thing to check is if apps are set to auto/background sync. Only enable the ones you really want syncing, others just check manually.
On this same topic, replacing the launcher (the stock launcher in Android, Launcher2 is quite slow) can help immensely. I like ADW, but I've used LauncherPro in the past and it is good. Zeam also seems like a good launcher. I haven't used Go Launcher EX, I've heard good and bad things about it. Use what works best for you, try 'em all!
The last thing on this topic I would like to mention is animations. Settings -> Display -> Animation -> No animations can make the phone feel quite a bit snappier, obviously at the expense of the look/feel of the OS.
Topic 2
Difficulty Easy - Controlling app 'net Access
This leads me into the next topic, DroidWall. I've noticed that blocking apps from accessing the internet has been a very good thing - it's not so much a performance booster (although it probably does provide a little bump) it's mostly about battery life. Just be warned, if you block an app that is set to background sync, it will probably have very negative effects. Only disable an app's access to the internet with DroidWall after you've checked that app's background sync feature is disabled. I have a few apps allowed in DroidWall, and the rest are blocked. You can "whitelist" everything and check apps you want to block, or "blacklist" everything and check the apps you want to allow. It's a little annoying to remember to enable/disable DroidWall (I use the DroidWall widget to enable/disable it globally) but if you do, it is much better - you have complete control over how apps access the 'net on your device. It is available on the Market.
Topic 3
Difficulty Moderate - SD cache/readahead tweaking
The only reason I'm calling this one 'moderate' is the number of choices you have for settings for this... It's basically telling the SD card how much to hold on to or... read "ahead" if you will . This was turned way up in FRX07, (from 256kb to 2048kb or 2mb...) and I think this might be the source of a lot of the complaints of 'mini-resets' if you will where the boot animation is suddenly seen after a long system hang...
So some cards will work better with a larger setting - I've heard some with spankin new C6 cards that said 3072kb or 3mb was a good setting. Others have found a sweet spot at 256kb or 1024kb (1mb).
There are two ways of doing this - you can hack the init in the rootfs and adjust the setting manually, or be lazy like me and use SD Booster (from the Market). Adjusts the same settings, and they are applied immediately!
I would like to find a "sweet spot" - a good default if you will. Can folks test out 512kb and 1024kb, see if you have any more mini-resets within Android or any other slowness, etc... Obviously this isn't a cure-all for the slowness or the mini-resets, what we're looking to do is mitigate the effects. So let's focus on that, thanks!
Topic 4
Difficulty Moderate - Overclocking
Overclocking is obviously one relatively easy way to improve the speed of Android. In your startup.txt, add a line
Code:
acpuclock.oc_freq_khz=710400
for example to overclock to 710.4mhz. How did I find this value? I actually put in 714000, but if you look at dmesg near the beginning you'll see "ACPU running at ..." - that's what clock is the actual maximum. It goes in 19.2khz increments.
Feel free to experiment with how high your phone can go, just be warned that the higher you go the potential for failure goes up as well . Phone shouldn't blow up, but it might not work correctly or at all. Rebooting and scaling it back will fix it.
Here's the full *example* startup.txt:
Code:
set ramsize 0x10000000
set ramaddr 0x10000000
set mtype 2292
set KERNEL zImage
set initrd initrd.gz
set cmdline "lcd.density=240 msmvkeyb_toggle=off gsensor_axis=2,1,3 pm.sleep_mode=1 physkeyboard=rhod400 acpuclock.oc_freq_khz=710400"
boot
You can put the command anywhere in the cmdline section, just make sure it's between the quotes and at least one space between each command.
Topic 5
Difficulty Advanced - How Android Manages Memory/apps
Ok, I'm going to take two approaches to this. The first, is the full explanation on how Android manages memory.
Please feel free to read the post I originally read that inspired me to start looking at this stuff - How to configure Android's *internal* taskkiller. It was very helpful for me to grasp how Android manages applications. This is the reason why application killers are not a good thing...
If you want to do it manually, Starfox suggests:
Code:
echo "1536,3072,8192,10240,12288,20480" > /sys/module/lowmemorykiller/parameters/minfree
To try to do these commands, adb is very useful. Once you get adb shell working, then you just need to "su" (provides 'super user' privileges (root)) and put in the echo command above ^^.
I had another user (thanks icevapor) suggest this script -
[Script] V6 SuperCharger! HTK & BulletProof Launchers! The ONLY Android MEMORY FIXER!
I tried it myself, and it works very well. This thread is a little overwhelming, but the jist of it is this:
Install Script Manager (on the Market)
Run the V6 SuperCharger script. I use "Aggressive 1 Settings" (#2) and then I use the OOM Grouping Fixes & "Hard to Kill" launcher (#17)
Point Script Manager to run /data/99SuperCharger.sh to run as root & on boot. This will ensure the tweaks are reapplied after a reboot.
Topic 6
Difficulty Advanced - Managing Apps that auto-start on boot
This is one of the most annoying things in Android. When you have no apps installed, it seems very fast. Then you install apps, and you never seem to get that original speed back... Now you can!
This is kind of difficult to do, I am still getting the hang of it... but here goes. All credit goes to hyc, his original post.
The basic idea here is you run a logcat (adb logcat is easiest here, or you can use GetLogs to pull logcat...) Look in this log for "for broadcast" and find apps that start on boot. For example,
Code:
Line 41: I/ActivityManager( 1394): Start proc nextapp.systempanel for broadcast nextapp.systempanel/.monitorservice.BootReceiver: pid=1752 uid=10060 gids={3003, 1015}
Notice there are two sides of the "for broadcast". The name of the package (nextapp.systempanel) and the name of the service, "nextapp.systempanel/.monitorservice.BootReceive". I made the mistake of disabling the app (the left side). Do not do this, you want to disable the right side!
So in the shell,
Code:
pm disable nextapp.systempanel/.monitorservice.BootReceive
This will be persistent across boots, it will go with your data.img.
Obviously this was just one example of an app to disable. So long as you disable the right side (after the 'for broadcast') you shouldn't disable anything that will cause a serious problem. The apps should still work, but for example if you disable Google Voice you won't get messages until you open the app. So think about that... You disable Titanium Backup schedules.BootReceiver, the schedules for Titanium Backup (if you have any) won't run. Stuff like that. Disable calendar, you won't get calendar events... Disable clock no alarms. Get it? Good. I have been rebooting several times, and I keep checking what is set to start on boot. I'm not quite happy with it yet, but there's some things I'm leery of disabling. Just be wary, if you do disable something and don't like it - just pm enable <whatever you disabled>.
Now experiment away! The one caveat is if you do break something with pm disable (and it's serious) you might get a failure to boot. It really depends on how bad you mess up. If you make a copy of your data.img before you start making these changes, you can revert to that data.img and start back there.
Alright guys. Going to use this thread as a way to brainstorm about ways to improve the speed. Read up what I've posted, let me know if I did anything wrong... Also let me know what you guys do to improve speed!
Don't care about what build you're running, this thread isn't about what build is fastest - this is a how do I make every build faster thread.
I also realize I posted this in the Rhodium section - I want to see if there's any BLAC-specific tweaks that others should be made aware of!
Thanks. Great posting. Will try some of the topics I never used (because I didn't know about them).
ThaiDai said:
Thanks. Great posting. Will try some of the topics I never used (because I didn't know about them).
Click to expand...
Click to collapse
I'm sure there are more as well... These are just the ones that I found made the most difference on my device.
I'm also curious about the minfree setting. I've only tried a few settings, they seem good. I haven't done any drastic number changing, it seems like changing these values should be done with a lot of caution and testing. There are definitely some values that should not be touched and others that can take some more fudging with numbers .
Added Topic 3 and Topic 4 to startup.txt and rootfs.img.
Just booting. Let's see if this is stable.
Software options I do not test now because I only test the new versions now. So specific app optimization only necessary when ThaiDai Android Loader and installation procedure reaches v2
Ok, boot ok, started Android (NeoFROYO build(, will tell tomorrow if stable.
If so I will use this options as standard for Blacky and I will add software like Droid firewall.
Thanks and good night
Update - I redid topic 4, feel free to re-read it.
Thanks
Enviado desde mi FROYO BLUE CWM1.9 usando Tapatalk
Hi Arrrghhh!
Can a squashfsed and odexed apk boost speed inside Android OS?
john_matrix said:
Hi Arrrghhh!
Can a squashfsed and odexed apk boost speed inside Android OS?
Click to expand...
Click to collapse
No clue. What does that have to do with the Speed Improvements thread?
I'm guessing you tried and it didn't work? What APK!?!
I guess I don't really follow your train of thought. Does sqshfs'ing and odexing an APK make it run faster...? I'm pretty new to Android in general. Never even used a native Android device .
http://www.addictivetips.com/mobile/what-is-odex-and-deodex-in-android-complete-guide/
http://forum.xda-developers.com/showthread.php?t=709630
farukb said:
http://www.addictivetips.com/mobile/what-is-odex-and-deodex-in-android-complete-guide/
http://forum.xda-developers.com/showthread.php?t=709630
Click to expand...
Click to collapse
I still don't get what that has to do with our builds. ODEX and DEODEX have nothing to do with our builds... That stuff only applies to native devices, or builds that are ported from native devices (I would think).
Perhaps I'm missing something here... please tell me if I am .
Maybe they mean something else like: oxidized or deoxidized (reduced) apps. With these modified apps you can speed up the transfer of electrons, resulting in more performance without overclocking your cpu. And more: it will not reduce your battery capacity measurable. I used it in some of the builds I tried. You will get a nice small benefit also: because of the electron transfers you will get a small induced massage in your fingers for free.
ThaiDai said:
Maybe they mean something else like: oxidized or deoxidized (reduced) apps. With these modified apps you can speed up the transfer of electrons, resulting in more performance without overclocking your cpu. And more: it will not reduce your battery capacity measurable. I used it in some of the builds I tried. You will get a nice small benefit also: because of the electron transfers you will get a small induced massage in your fingers for free.
Click to expand...
Click to collapse
LOL!
Epic.
OK. I cant get V6 SuperCharger script to work! I downloaded the script and run it but I cant find /data/99SuperCharger.sh after I run it
x12CHRIS18x said:
OK. I cant get V6 SuperCharger script to work! I downloaded the script and run it but I cant find /data/99SuperCharger.sh after I run it
Click to expand...
Click to collapse
Did you make the choices in the script, or did you just exit the script?
You have to make sure ScriptManager is running as root too. There's a setting for it. "Browse as root" - make sure that is enabled. You won't be able to see /data without browsing as root.
...You have a TouchHD? I always thought you had a RHOD, lol.
Hello! Can you help me write a code for changing the media priority trough terminal(or maybe another way)? Sometimes when the phone wants, the music starts to lag(when i lock the screen or there is high cpu usage because of foreground programs). It is really irritating... With Auto Memory Manager i can set -17 priority to android.process.media, but the stupid Android reverts the priority later back again to 2!
I think the solution will be something connected to this:
renice -p ***** -n -19
*****: old priority 2, new priority -19
Still i do not know how to find the process ID.
If it matters i'm running Walkman v7.5 on .587 with changed services.jar(supercharger V8), arcknight v4.0 kernel(122-1612Mhz ondemand, noop) and JB adreno drivers.
Since a long time ago i'm looking for in the web how to make the music higher priority. The thing i want most from my phone is awesome music! With the Walkman installed i have it, but the performance of the Secondary Server settings of the mediaserver irritates me.
Thanks in advance!