03-10-2010 10:47 AM
36 12
tools
  1. Jerry Hildenbrand's Avatar
    As requested here, This is a short tutorial about setting and tweaking the cpu throttle and the memory settings in the gumbo.sh file.
    Here's a copy of the file to help ask and answer questions:
    Code:
    #
    # gumbo.sh tweaker edition
    # Lines marked with "#" are commented out and will not be read by the system
    # Read through this entire file before you make any edits
    
    # After editing, push this file to /system/init.d/ and reboot your phone
    
    # Do not edit this file in any standard Windows text editor.
    # Use Notepad++ if you don't understand why.  It will automatically edit
    # the file correctly and it is free.
    # http://notepad-plus.sourceforge.net/uk/site.htm
    # ---------------------------------------------------------------------------------
    
    # This section will determine which CPU governor to use at boot
    # Make sure only one line is active
    #
    # performance = whenever cpu is awake and active, it will be ramped up
    #   to the highest possible speed (528 Mhz in our case)  This will give a great
    #   performance boost, but at the cost of battery life
    #
    # ondemand = when cpu is awake AND in use, it will ramp up to max.  While not in use,
    #   the cpu is able to throttle down to save battery.  While the screen is on,
    #   the cpu will be running 528 Mhz, while off and in use, it will run at 480 Mhz
    #
    # msm7k = when screen is on, the device will run at 480 Mhz normally.  Under load, 
    #   it will ramp to 528 Mhz.  While the screen is off, it will run at 245 Mhz always.
    #   This is the default setting that the Hero shipped with, the custom kernel included with 
    #   the ROM unlocks the other two governors
    
    #echo "msm7k" >  /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    echo "ondemand" >  /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    #echo "performance" >  /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    
    #-----------------------------------------------------------------------------------------
    # The following lines pass values to configure the internal memory manager in 
    #   your Android device.  There are many different ways this can be configured.
    #   The first three entries are suggested settings, and should work well for most.
    #   The final line can be used for testing and tweaking.  Once again, make sure only
    #   one line is uncommented
    
    #Stock settings
    #echo "1536,2048,4096,5120,5632,6144" > /sys/module/lowmemorykiller/parameters/minfree
    
    #Semi-agressive settings
    #echo "1536,2048,4096,5120,15360,23040" > /sys/module/lowmemorykiller/parameters/minfree
    
    #Maximum free RAM settings.  Not for use with SenseUI ROMS
    #echo "1536,3072,4096,21000,23000,25000" > /sys/module/lowmemorykiller/parameters/minfree
    # ----------------------------------------------------------------------------------------
    
    # Tweaker time.
    #   The first three values inside the quotes (1536, 2048, and 4096 should stay as they are
    #   You will see trouble keeping vital processes awake if you increase these values.
    #   The last three numbers are much more configurable.
    #
    #   The fourth number in the list (10240) controls how much RAM "Hidden" processes are
    #   allowed to use.  Hidden processes are called by the system at boot time, and are
    #   things that will not show up in a task manager app. In my testing, I have found
    #   that I can safely set the value to 10240.  You may be able to go higher or lower, 
    #   depending on how YOU are using your phone.  Increase or decrease the number in 
    #   multiples of FOUR.  Example - DO NOT decrease the number by 1025.  Decrease it by
    #   1024 instead.  256 x 4 = 1024 
    #
    #   The fifth number (15360) controls RAM used by empty content providers.  Empty 
    #   is the key word.  If you only use the Gmail app, the Android mail application is 
    #   an empty content provider.  The issue here is apps like Twitter and Facebook.
    #   If the app was coded correctly and sleeps properly when idle, it's associated 
    #   content provider may be killed off.  When the app needs that content, it will 
    #   probably force close while waiting for it.  If things like HTC's social network
    #   start force closing, decrease this number.  Like above, use multiples of 4 when
    #   changing.
    #
    #   The final number is "ghosts".  Apps that were closed by the user remain in memory
    #   until the memory is needed elsewhere.  This makes loading an app you've closed
    #   much quicker, at the cost of a little performance when opening new apps.  
    #   Crank this one up to 25000 to increase the "snap" factor.  Things like 
    #   pulling down your notifications or opening a menu will stay very quick like they
    #   are right after a reboot.  The offset is that when you close an app and need 
    #   to jump back to it quickly, you have to load it again instead of it just redrawing
    #   Unless you're looking for it, you'll not notice it much.  If you have to lower this, 
    #   use multiples of 4 once again
    #
    # DO NOT UNCOMMENT THE FOLLOWING LINE.  This is your baseline, in case you get things
    #   so screwed up you forget where you started.  Trust me.
    #
    #echo "1536,2048,4096,10240,15360,25000" > /sys/module/lowmemorykiller/parameters/minfree
    #
    # EDIT THIS ONE INSTEAD.    
    echo "1536,2048,4096,10240,15360,25000" > /sys/module/lowmemorykiller/parameters/minfree
    
    # This file is open source.  It has absolutely no license whatsoever. 
    # As always, I am not responsible for anything, anywhere, at any time.
    # Doing stuff like this is a good way to break your phone.
    # You have been warned.
    A copy is attached to this post. READ THROUGH IT HERE SO YOU KNOW HOW TO OPEN IT. Simply pushing this file as is will set your Hero exactly like mine. That may work for you, but it may not. I recommend trying as is, then make small (1024 or so) adjustments.

    The file is pretty well commented, but any questions just ask.
    02-27-2010 01:23 AM
  2. Jerry Hildenbrand's Avatar
    For anyone interested in this, here's my latest kernel to play with

    4shared.com - online file sharing and storage - download signed-GKTweaker-03-03-10.zip
    Latest version as of 03/02/2010 20:26

    README file attached, here is link if you're on WAP - README

    Changes -
    ext4 support
    Modifications to memory killer kernel space driver.
    IP tunneling
    USB host/gadget support (you'll have to compile device drivers as a module then copy to /system/lib/modules/. Then symlink to /system/lib/modulesGK-1.5c/)
    Extra cpu governors stripped
    All kernel debugging stripped

    Be sure to backup before applying. The kernel package is an update.zip file and includes the above user script file. Stable here, but not tested anywhere else.

    Tested only on Gumbo 1.5c. YMMV
    I'm not responsible if your phone goes tits up, or you miss important notifications/calls, or if your dog dies. Android Central certainly isn't responsible for anything I do.
    You have been warned.
    02-27-2010 06:10 PM
  3. Spork1673's Avatar
    link is busted :/
    02-28-2010 06:37 AM
  4. Jerry Hildenbrand's Avatar
    Will look into it this evening. Out with the family for the day. I'll say in advance - stupid 4shared.
    02-28-2010 02:19 PM
  5. Robchaos_'s Avatar
    i'm interested as well. Will download and test as soon as link is back up. Keepup the good work!
    02-28-2010 08:15 PM
  6. Jerry Hildenbrand's Avatar
    Fixed I hope
    02-28-2010 10:36 PM
  7. Andrew Ruffolo's Avatar
    With the tweaker addition, do I just flash that on top of my gumbo rom already installed? And when you say flash on top of things in other posts, I just boot in recovery and flash something, when this is already on the device? I'm backed up already, so I'm not too worried experimenting. My phone killed the battery early today, but I think it was google chat that did it in. I left it on since someone added me on there.
    02-28-2010 11:28 PM
  8. Jerry Hildenbrand's Avatar
    Yes. Flash this with no wipe over Gumbo 1.5c. I still recommend a backup though
    02-28-2010 11:33 PM
  9. Robchaos_'s Avatar
    I just flashed this onto my phone. As of now no problems to report. I'm still learning about kernels, roms, and the android OS, so if you don't mind me asking a question or two at the risk of seeming stupid...

    Did the changes you made to the kernel space driver allow us to run more aggresive memory killer settings and still retain multitasking data and services? I assume these changes were made within the boot.img since I don't see much different in the gumbo.sh script.

    Stripping out kernel debugging and the extra CPU governors just got rid of some bloat in the rom, right?

    The USB host/gadget support
    I understand the part about having to compile device drivers (the phone can't do anything with a usb device if it has no instructions for using it).
    For instance, if I wanted to hook up a USB keyboard to my hero,
    In addition to compiling the device drivers and adding them to the system library, I'd have to add in a set of instructions within the rom to allow such a device to be used whenever I call upa text input box.
    Is my understanding of that correct?


    Thank you for your time and work!
    Once the phone has been up for a few hours I'll report back.
    03-01-2010 08:54 PM
  10. funcrusher's Avatar
    Is that the same kernel included in 1.5c?
    03-01-2010 10:26 PM
  11. funcrusher's Avatar
    I'm assuming not. I may give it a try even though I don't quite understand the differences.

    I appreciate your work, gbhil.
    03-01-2010 10:28 PM
  12. Robchaos_'s Avatar
    This is not the same kernel as in 1.5c. It can be flashed over 1.5c without a wipe and should not affect any data. Post #2 outlines the changes gbhil made.
    03-01-2010 11:11 PM
  13. Jerry Hildenbrand's Avatar
    I just flashed this onto my phone. As of now no problems to report. I'm still learning about kernels, roms, and the android OS, so if you don't mind me asking a question or two at the risk of seeming stupid...

    Did the changes you made to the kernel space driver allow us to run more aggresive memory killer settings and still retain multitasking data and services? I assume these changes were made within the boot.img since I don't see much different in the gumbo.sh script.

    That (in theory...jury is still out) and change the polling times/priorities. I run EVERYTHING (even stocks and footprints lol) with the settings in the "new" sh script, and have zero problems. Before the changes, stocks widget would FC and HTC facebook sync would die off and only update if it was called manually.

    Stripping out kernel debugging and the extra CPU governors just got rid of some bloat in the rom, right?

    Got rid of bloat in the kernel. You'll get less useful error messages, but the kernel itself can run much smoother.

    The USB host/gadget support
    I understand the part about having to compile device drivers (the phone can't do anything with a usb device if it has no instructions for using it).
    For instance, if I wanted to hook up a USB keyboard to my hero,
    In addition to compiling the device drivers and adding them to the system library, I'd have to add in a set of instructions within the rom to allow such a device to be used whenever I call upa text input box.
    Is my understanding of that correct?

    Very close. You will need to grab my sources, build your modules against it, place them where the kernel knows to load them, then tell the system to load the modules. You'll also need to hack up your own hardware as the USB controller does not send out 5v on the bus. I'm toying around here using SCSI drivers and some cable splicing to be able to plug USB flash drives to the phone. You can bet if I ever get it working I'll let everyone know exactly how.

    Thank you for your time and work!
    Once the phone has been up for a few hours I'll report back.
    You're welcome. Looking forward to your results.

    Is that the same kernel included in 1.5c?
    I'm assuming not. I may give it a try even though I don't quite understand the differences.

    I appreciate your work, gbhil.
    This is not the same kernel as in 1.5c. It can be flashed over 1.5c without a wipe and should not affect any data. Post #2 outlines the changes gbhil made.
    Correct. This is slightly different than "Stock" Gumbo.

    thanks for the vote of confidence funcrusher. Hope you like.
    03-01-2010 11:24 PM
  14. Robchaos_'s Avatar
    quick update before I go to sleep.
    Phone still seems snappy. RAM numbers are reading lower then when I was running 1.5c with the custom user config update (25-30 after 2 hours of uptime), but I am trying to keep myself from clicking that task manager icon and checking RAM numbers as much because it really doesn't seem to be slower then before when it was reading 40 or 50. Benchmarks seem to perform similar to before (pi and linpack).
    No force closes or processes hanging up yet.
    03-01-2010 11:47 PM
  15. Jerry Hildenbrand's Avatar
    quick update before I go to sleep.
    Phone still seems snappy. RAM numbers are reading lower then when I was running 1.5c with the custom user config update (25-30 after 2 hours of uptime), but I am trying to keep myself from clicking that task manager icon and checking RAM numbers as much because it really doesn't seem to be slower then before when it was reading 40 or 50. Benchmarks seem to perform similar to before (pi and linpack).
    No force closes or processes hanging up yet.
    I'm not going to say anything to influence your results.

    Please if you could - give it a run just as you are for a couple of days. I know you're tempted to up that RAM level but if you could i would appreciate it.

    RE - benchmarks.
    Should be about the same. The kernel probably can't run the system much faster, but still more that can be done to stabilize it. Which means no more of those "hiccups" like before it was rooted.
    03-02-2010 12:58 AM
  16. Drybonz's Avatar
    gbhil... I'm running your 1.5c rom and am going to flash your new kernel over it tonight. I'll let you know how it works out for me. Thanks.
    03-02-2010 01:13 AM
  17. Robchaos_'s Avatar
    I'm not going to say anything to influence your results.

    Please if you could - give it a run just as you are for a couple of days. I know you're tempted to up that RAM level but if you could i would appreciate it.

    RE - benchmarks.
    Should be about the same. The kernel probably can't run the system much faster, but still more that can be done to stabilize it. Which means no more of those "hiccups" like before it was rooted.
    I'm training myself not to worry about the ram number. I more or less know how linux works with allocation of memory, and I've been trying to get myself away from the windows way of thinking. I'm setting up a VM so I can give Ubuntu a try when I get home from work tonight. It just seems like poking around in the boot.img and some other android related development things would just be much simpler in a linux environment and I'd learn more overall.
    As for the benchmark, I should have added that when I sat there and a few in a row, results were much closer. Before it could have went 11800 12300 11900, now they seemed more consistent.
    03-02-2010 05:41 AM
  18. Drybonz's Avatar
    RE - benchmarks.
    Should be about the same. The kernel probably can't run the system much faster, but still more that can be done to stabilize it. Which means no more of those "hiccups" like before it was rooted.
    I have spent some hands-on time with the new kernel and, while I have not done any benchmarking tests I'm happy to report that I am seeing less of the "hiccups" you referred to, especially in scrolling and typing. While there are still some hiccups in the system (most noticeable to me in the dialer and contacts), I am finding it to be an improvement over the 1.5c kernel IMO.

    Thanks for giving us a chance to test the new kernel.
    03-02-2010 08:29 AM
  19. funcrusher's Avatar
    Just flashed it over your 0.31 kernel on Fresh 1.1

    Everything's still snappy. Not nearly as much free ram, but I guess that was expected.

    I used wifi tether for about 20 mins and that worked fine.

    I'll report back later after I've spent more time with it.

    Thanks again.
    03-02-2010 10:33 AM
  20. Robchaos_'s Avatar
    only thing I'm noticing so far is every once in a while when the phone has been asleep for a bit, when unlocking if you go to swipe down the taskbar, it has a few seconds of delay. This happened with stock, fresh and gumbo 1.5c so its nothing new, and it doesn't seem to happen too often. Most of the times its a clean unlock with a nice smooth swipe. Maybe the times I experience has a delay might be due to one of the taskbar icons refreshing or a new notification.
    03-02-2010 06:01 PM
  21. Jerry Hildenbrand's Avatar
    Huge issue found on most devices. Mine's not affected, but many others are. New version in ~1 hour.

    Some phones aren't successfully parsing the script at boot, because of all the comments. I'm going to change back to a simpler script and provide a link to the "tutorial style" script as a text file.
    03-02-2010 06:42 PM
  22. Jerry Hildenbrand's Avatar
    2nd post updated with new tweaker kernel zip.

    All users encouraged to download and flash (no wipe, backup first)
    03-02-2010 07:29 PM
  23. Robchaos_'s Avatar
    hmmm hopefully that explains the slow taskbar and the reason the web browser seemed to revert back to being a resource hog. The initial snap must have been due to a fresh update.zip I guess.
    Is there a way to tell whether my phone parsed the script properly, or will I only know once I load this updated zip and see if there's a difference?
    Flashing now will report back.
    03-02-2010 07:50 PM
  24. Drybonz's Avatar
    hopefully that explains the slow taskbar
    I actually haven't noticed any slowdown in my taskbar. Maybe it is something else causing that?
    03-02-2010 11:06 PM
  25. Robchaos_'s Avatar
    ment to say in pulling down the notifications bar. Browser always seemed to slow everything down a little too. I know ram numbers don't mean as much, but it always seemed like once they dropped down to 25MB or so things slowed down and it was always when the broswer was still open in memory. It seems like it stayed active longer then most other programs, not just passively sitting in memory. Right now after 8 hours of uptime its at 45MB and everything is still snappy. no force close issues or hanging up yet.
    03-03-2010 05:39 AM
36 12
LINK TO POST COPIED TO CLIPBOARD