[Q] init.d Script to set CPU-Governer to performance - Motorola Droid RAZR

Im looking for an init.d script to set the cpu gov to performance...i know this can be done using setcpu just wondering how to make a script. I had one on my X2 that would set Gov to performance, looking for one for razr.
This is ont one from the X2, will this work? also will it work for both cores?
Code:
#!/system/bin/sh
echo 1 > /sys/devices/system/cpu/cpu1/online
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo 312000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 312000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo 1200000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 1200000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq

It will, but it would suck your battery really, really fast.
And you should set 1200000 as max_freq if you want to use the real CPU's max freq.

kholk said:
It will, but it would suck your battery really, really fast.
And you should set 1200000 as max_freq if you want to use the real CPU's max freq.
Click to expand...
Click to collapse
Ya i wouldn't use those freq values that was just the code copied from X2

mattfox27 said:
Ya i wouldn't use those freq values that was just the code copied from X2
Click to expand...
Click to collapse
download Linpack... run a multi-threaded benchmark in mot_hotplug governor, then switch to performance and run a multi-threaded benchmark. Why do you want to run in performance mode? I think we'll discover that the least amount of cycles on these batteries as possible, will be desired.

tekahuna said:
download Linpack... run a multi-threaded benchmark in mot_hotplug governor, then switch to performance and run a multi-threaded benchmark. Why do you want to run in performance mode? I think we'll discover that the least amount of cycles on these batteries as possible, will be desired.
Click to expand...
Click to collapse
I don't know, im just messing around with phone...

Related

[Module] | X8 | X10 mini/pro | AX8_SMARTASS v002 | 'smartass' governor | [2011-07-19]

EASY ENGLISH: Differences between this module and the others:
- allows to set max CPU freq when screen is off (to save battery),
- allows to set starting CPU freq when phone awakes (to speed up awake process),
- allows set/change almost all aspects of governor (to suite needs),
- should be a bit more responsive when parameters are well chosen.
Note: Don't use DSP Manager when this governor is enabled (it consumes more CPU then player itself). When screen goes off - sound will be distorted. Use player with equalizer build-in instead.
Governor have some predefinied values - more info in "Available settings".
Start:
The goal was bring 'smartass' governor to work with X8 and also make some improvements.
What Is A CPUFreq Governor?
==============================
Most cpufreq drivers (in fact, all except one, longrun) or even most
cpu frequency scaling algorithms only offer the CPU to be set to one
frequency. In order to offer dynamic frequency scaling, the cpufreq
core must be able to tell these drivers of a "target frequency". So
these specific drivers will be transformed to offer a "->target"
call instead of the existing "->setpolicy" call. For "longrun", all
stays the same, though.
How to decide what frequency within the CPUfreq policy should be used?
That's done using "cpufreq governors". Two are already in this patch
-- they're the already existing "powersave" and "performance" which
set the frequency statically to the lowest or highest frequency,
respectively. At least two more such governors will be ready for
addition in the near future, but likely many more as there are various
different theories and models about dynamic frequency scaling
around. Using such a generic interface as cpufreq offers to scaling
governors, these can be tested extensively, and the best one can be
selected for each specific use.
Click to expand...
Click to collapse
SMARTASS GOVERNOR - is based on the concept of the interactive governor.
I have always agreed that in theory the way interactive works - by taking over the idle loop - is very attractive. I have never managed to tweak it so it would behave decently in real life. Smartass is a complete rewrite of the code plus more. I think its a success. Performance is on par with the "old" minmax and I think smartass is a bit more responsive. Battery life is hard to quantify precisely but it does spend much more time at the lower frequencies.
Smartass will also cap the max frequency when sleeping to 245Mhz (or if your min frequency is higher than 245 - why?! - it will cap it to your min frequency). Lets take for example the 600/245 kernel, it will sleep at 245. No need for sleep profiles any more!
Click to expand...
Click to collapse
Info:
- information about governors is here,
- more information about 'smartass' governor is here,
- how different governors work is explained here: [Q] SetCPU governors (explained).
Prerequisites:
- X8,
- Baseband x15
- desire to replace SetCPU - when used only for 'ScreenOff' profile.
Manual installation:
- push ax8_smartass.ko to /system/lib/modules
- run the following command
Code:
insmod /system/lib/modules/ax8_smartass.ko
echo "smartass" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Available settings:
Note: there is no need to add following commands without changed value. The values are already implemented in module.
- up_rate_us:
The minimum amount of time to spend at a frequency before we can ramp up.
Default value:
Code:
echo "24000" > /sys/devices/system/cpu/cpu0/cpufreq/smartass/up_rate_us
- down_rate_us:
The minimum amount of time to spend at a frequency before we can ramp down. Default value:
Code:
echo "49000" > /sys/devices/system/cpu/cpu0/cpufreq/smartass/down_rate_us
- up_min_freq:
When ramping up frequency with no idle cycles jump to at least this frequency.
Zero disables. Set a very high value to jump to policy max freqeuncy.
Code:
echo "0" > /sys/devices/system/cpu/cpu0/cpufreq/smartass/up_min_freq
- sleep_max_freq:
When sleep_max_freq>0 the frequency when suspended will be capped by this frequency. Also will wake up at max frequency of policy to minimize wakeup issues.
Set sleep_max_freq=0 to disable this behavior.
Default value:
Code:
echo "122880" > /sys/devices/system/cpu/cpu0/cpufreq/smartass/sleep_max_freq
- sleep_wakeup_freq:
The frequency to set when waking up from sleep.
When sleep_max_freq=0 this will have no effect.
Default value:
Code:
echo "600000" > /sys/devices/system/cpu/cpu0/cpufreq/smartass/sleep_wakeup_freq
- awake_min_freq: When awake_min_freq>0 the frequency when not suspended will not go below this frequency.
Set awake_min_freq=0 to disable this behavior.
Default value:
Code:
echo "0" > /sys/devices/system/cpu/cpu0/cpufreq/smartass/awake_min_freq
- sample_rate_jiffies:
Sampling rate, I highly recommend to leave it at 2.
- ramp_up_step:
Freqeuncy delta when ramping up.
zero disables and causes to always jump straight to max frequency.
Default value:
Code:
echo "220000" > /sys/devices/system/cpu/cpu0/cpufreq/smartass/ramp_up_step
- ramp_down_step:
Freqeuncy delta when ramping down.
zero disables and will calculate ramp down according to load heuristic.
Default value:
Code:
echo "160000" > /sys/devices/system/cpu/cpu0/cpufreq/smartass/ramp_down_step
- max_cpu_load:
CPU freq will be increased if measured load > max_cpu_load.
Default value:
Code:
echo "75" > /sys/devices/system/cpu/cpu0/cpufreq/smartass/max_cpu_load
- min_cpu_load: CPU freq will be decreased if measured load < min_cpu_load.
Default value:
Code:
echo "25" > /sys/devices/system/cpu/cpu0/cpufreq/smartass/min_cpu_load
- sleep_rate_us: Sleep rate when screen is off
Code:
echo "500000" > /sys/devices/system/cpu/cpu0/cpufreq/smartass/sleep_rate_us
Release history:
v002:
- sleep_max_freq set to 122880 - more battery saving,
- sleep_wakeup_freq set to 600000 - faster wake up,
- ramp_down_step set to 160000 - to slow down decreasing CPU freq,
- when screen is off - governor acts like its 'conservative' version, just checks CPU loads using 500ms rate,
- added sleep_rate_us parameter - sleep rate when screen is off can be changed using this parameter.
v001:
- just initial version fixed to work with X8.
Sources at: GitHub
Very nice Andy! Apparently we found ourselves a new Module Man
i don't really know what this is all about, its some kind of an AI for cpu governor?
i like the kuyadroid setting(its use native cm setting not setcpu), so its gonna be an setup on cm setting?
Downloading to make some tests
As I can see it is a custom CPU governors, like one "Do it yourself"
Maybe now some people stop complaining about battery life in every ROM. Thx AnDyX
biscoitu said:
Downloading to make some tests
As I can see it is a custom CPU governors, like one "Do it yourself"
Click to expand...
Click to collapse
It is rather - get abandoned project ('erasmux') and refresh it . I tried to resolve one of annoying issue:
12. Using smartass the CPU frequency does go above 352Mhz (with screen off)
Intentional to keep standby battery life under control.
13. Using smartass the CPU frequency is always at its max (or always at 352Mhz when screen is off)
See "Monitoring the CPU frequency" in the "Advanced subjects".
Click to expand...
Click to collapse
I will test it now and I let know how it compares to 'ondemand' tomorrow.
so in plain english(sorry im a noob) this changes the CPU freq scaling behavior? does it improve preformance?
Aashrey99 said:
so in plain english(sorry im a noob) this changes the CPU freq scaling behavior? does it improve preformance?
Click to expand...
Click to collapse
I will add better explanation soon.
Nice module AnDyX I'm gonna check it. Did you have to hijack many calls?
doixanh said:
Nice module AnDyX I'm gonna check it. Did you have to hijack many calls?
Click to expand...
Click to collapse
Only two
But your:
Code:
kallsyms_lookup_name_ax = (void*) OFS_KALLSYMS_LOOKUP_NAME;
is irreplaceable
AndyX...Is this an AI SetCPU??....when we push it to out phone..it will auto config or we config ourself?
lukewong01 said:
AndyX...Is this an AI SetCPU??....when we push it to out phone..it will auto config or we config ourself?
Click to expand...
Click to collapse
Module has predefinied value - I changed info and explained this in main post.
Well this is an instant success!!!!! My stock SE 2.1 is much more responsive now. Menus are smoother and apps start up faster and dont lag much.
I haven't tested it on any custom ROM yet, but i'll do that today. Will report back soon.
Thanks for the awesome module!
AnDyX said:
Module has predefinied value - I changed info and explained this in main post.
Click to expand...
Click to collapse
hmm...i just have 1 question on my mind...i just wanna know we need to customize the value ourself or just push it to our phone and insmod and thats it?
lukewong01 said:
hmm...i just have 1 question on my mind...i just wanna know we need to customize the value ourself or just push it to our phone and insmod and thats it?
Click to expand...
Click to collapse
Just push - module has predefined values as standing in 1st post, after that you can tweak it if you want and share opinion.
khartaras said:
Very nice Andy! Apparently we found ourselves a new Module Man
Click to expand...
Click to collapse
yeah, that's the first thing that came to my mind when i noticed this thread. when doixanh focused on improving his rom, there is a new module-star rising up
thanks, andyx! i haven't tried it yet, but i'll sure test it in a few days. actually, i came up with a simmiliar idea, but i have no programming/scripting/whatever skills (ability to write a "hello world" prog in pascal doesn't count, does it? LOL)
Does this module has conflict with the other modules if i push it or it will work with itself? I mean if this is safe in all ROM without conflicts from racht or dx modules?
i have one question: if i reboot my x8, will i have to insmod it again ??? or can i add these 2 lines in hwconfig ??? thanks for reply
deedii said:
Does this module has conflict with the other modules if i push it or it will work with itself? I mean if this is safe in all ROM without conflicts from racht or dx modules?
Click to expand...
Click to collapse
This module adds completely new functionality, so should work in all ROM-s.
Oh thanks much andyx.x0x0
this thing works well! applications start quickly and everything runs smoothly. Thank you very much for all your modules AnDyX. You're doing really useful and necessary moduls and I'm use all your modules.
Good job!

[MOD]8-21-Powersave CPU Manager-Auto Underclock/Overclock Based on Batt %

Powersave CPU Manager
Automatically manages you cpu no matter what you use, ie. setcpu, cpumaster, virtuous_oc. This will automatically underclock your cpu and change the governor when your battery reaches a specified level. Kind of like powersave mode in settings.
You don't need to do anything to make it happen its all automated. By default it sets the governor to conservative and underclocks to 702000 then depending on whats installed it restarts virtuous_oc or changes back the governor to ondemand and the cpu back to stock (1188000).
These settings can be edited at:
/system/etc/init.d/74-virtuous for virtuous users
/system/etc/init.d/75-pcm for stock users
/system/etc/init.d/76-pcmapk for apk users (setcpu)
The lines are commented so editing should be easy enough in root explorer, if not lmk i will help out.
You will have to restart setcpu or whatever apk after your battery reaches the threshold. It works with setcpu, cpumaster, cputuner, and overclock widget.
Once you battery gets above the threshold it will restart virtuous oc or change the gov and cpu freq to whatever you specify in the script. It checks the battery level every minute.
The virtuous oc attachment includes virtuous oc this can be flashed right over my flashable oc daemon. It can be used with roms that include virtuous oc as well.
Download the zip you need:
Virtuous_OC-PCM = Virtuous_OC and PCM
PCM = PCM Stand alone Auto sets default cpu frequency use without setcpu or virtuous
PCMAPK = PCM for use with some apk's that control cpu (setcpu)
Please report any bugs here.
How to edit settings:
This is virtuous_oc version but they are all about the same.
Edit the lines in red to adjust settings, this is labeled actual script will look a little different.
Code:
#!/system/bin/sh
#PowerSave CPU Manager Virtuous
#smokin1337
SLEEP=60
(
while : ; do
#Powersave Threshold Default-25
CAP=[color=red]25[/color] [color=blue]<<-- This is the battery percent where the powersave settings will be applied, change the number in red.[/color]
LEVEL=`cat /sys/class/power_supply/battery/capacity`
if [ "$LEVEL" -lt "$CAP" ]; then
pkill virtuous_oc
#Powersave Governor
echo [color=red]conservative[/color] > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor [color=blue]<<-- Edit this to the governor you want it to be set to in powersave mode. ie. powersave, conservative, ondemand, userspace, etc.[/color]
#Powersave CPU Frequency
echo [color=red]702000[/color] > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq [color=blue]<<-- Edit this to set the cpu frequency for powersave mode ie. underclock. [/color]
else
/system/xbin/virtuous_oc
fi
sleep $SLEEP
done
) &
In the stand alone version (75-pcm) there is also a setting for your default governor when not in powersave. This will be your default setting.
Your rom MUST support init.d, this is a script.​
Thank you!
I will try it now.
Does this work with the kernel in the 2.08.651.2 release?
Is this a Terminal-based app or an actual app? If Terminal, what command invokes it?
Also, you say whatever CPU management tool we use doesn't matter, does that also mean I can just toss SetCPU altogether?
Yes it works with the new kernel. It gets installed to init.d so it runs by itself when you boot the phone. You dont need to run it in a terminal.
It works with setcpu, you need the pcmapk version. What it does is shutdown setcpu when your battery gets low and underclocks your cpu to save battery. You just have to run setcpu again when your battery gets charged.
I'm interested in this mod but I don't understand what i have to do. Do I download all 3? I don't want to use any apk. to help. Do any of those downloads manage everything alone. PLEASE HELP...thank you and sorry for the noob ???s.
abreuw83 said:
I'm interested in this mod but I don't understand what i have to do. Do I download all 3? I don't want to use any apk. to help. Do any of those downloads manage everything alone. PLEASE HELP...thank you and sorry for the noob ???s.
Click to expand...
Click to collapse
Yes the PCM-signed.zip will manage it without any apk or virtuous oc. Just flash it as is. Sorry about the explanation of it i didnt know how far to go.
Wow...thanks for the quick response. Thank you for your work.
not trying to be a **** here but whats the point of this being used with setcpu since setcpu seems to already do what you are describing here. profiles set up right will underclock and change govenor when battery gets to level X.
Now for the others it seems to be helpful for those that like profiles being used.
Honestly i havent used setcpu. But your right it works well by itself, and really good with virtuous oc. I use it personally with virtuous oc and it helps alot saving juice.
Gonna try this out. I don't want to overclock, I just want to underclock in order to save juice.
Please help me understand it a little more, I already use virtuous oc, I've been running the pcm version with virtuous oc the last dew days and notice a huge lag when phone reaches 20%, how can i give it a bit more juice? I think whatever you set it to when battery is low is too slow..
How does virtuous oc work together with pcm?
Also is the version for the virtuous OC-PCM in this thread the same as in the other thread (virtuous OC thread)?
3vo fre3vo'd
Anyone can help with this please ^^^^
3vo fre3vo'd
my phone after installing virtuos OC-PCM kept rebooting spiral how can I remove it from recovery.. thank you...please fast ...
drZuheir said:
my phone after installing virtuos OC-PCM kept rebooting spiral how can I remove it from recovery.. thank you...please fast ...
Click to expand...
Click to collapse
Download the uninstaller file in the thread related to it. But by now im pretty sure you fixed it. Is it stable yet?
Edit: This is stable but it doesn't save juice and my OC isn't completely stable.

Init.d scripts

Here are the init.d scripts that I have been using for Siyah. Please note that 95% of the scripts were done by Pikachu's thunderbolt scripts and I have modified then to my liking. Thanks to Pikachu for the hard work he has put in for the developement of our devices. For those that will use these scripts please use them with caution! I am not responsible for any damage done to your phone! You are free to use these as you wish, adjust them to your liking. The s70darkyzipalign, s98cfs, s98systemtweak should be universal for all setups and you do not need to adjust these init.d scripts. The one you need to be aware of is the s98bolt1 and screenstate_scaling script. The s98bolt1 script has cpu freq. steps set at max 1504 min 100. Scaling @ max 1304 min 200. The voltages for these steps are pretty aggressive and may not work for your device so please PLEASE adjust them accordingly. This script will also set ondemand/sio as default. You can replace those as you wish. GPU is set for 40, 133, 267mhz. (Andreilux's settings, Thanks Andrei) Sched_mc and AFTR have been enabled for some extra power saving.
Screenstate_scaling have been modified to set as Ondemand as wake governer and Powersave as sleep governer. You can adjust these as well. The scripts are pretty self explantory and you can adjust these values using root explorer and using the menu in root explorer to "open in text editor". Or you can you wordpad or notepad++ on your pc and adjust them. Save the scripts to your phone. Using root explorer copy the init.d scripts to /etc/init.d. Paste in this directory and set permissions as rwx,rwx,rwx and reboot.
I am sure I missed some things as I'm kind of in a hurry. Please pm me if you have any questions or need help. I have used this setup for quite some time now without any problems. Battery life has been amazing without sacrificing performance. Oh please do not use VC to save boot settings as these will clash. Everything in the init.d scripts will do the same as VC as long as you adjust them accordingly. Good luck and happy flashing/modding!
P.S. After downloading the file remove the .txt extension in the files before using. Thanks!
Here is the link to the Originator and Creator of these awesome scripts. Thanks Pikachu!
http://forum.xda-developers.com/showthread.php?p=18285859
PHP:
I just want to make sure before I utilize these. I need to use a file manager to place these in /etc/unit.d folder without the .txt correct?
Should I remove the existing scripts as well?
Edit: do these scripts completely take the place of voltage control and setcpu? I wanted to get all of my questions out of the way
These seem awesome. Can't wait to try them out
moustro said:
I just want to make sure before I utilize these. I need to use a file manager to place these in /etc/unit.d folder without the .txt correct?
Should I remove the existing scripts as well?
Edit: do these scripts completely take the place of voltage control and setcpu? I wanted to get all of my questions out of the way
Click to expand...
Click to collapse
Everything you posted is correct. Please keep in mind the voltage settings are a little extreme. If you think or know your phone can handle the UV then just drop them in without modifying. But if you're not sure add +25 mv to each step.
I almost gaurantee your phone will sleep like a baby. And fly like the wind when in use.
Thanks for the scripts!
I've also found an interesting script at 9100 Siyah Kernel topic ( http://forum.xda-developers.com/showthread.php?t=1263838&page=1813 )
I got sleep of death by using below script so you may want to check voltages setting before using it.
Code:
#!/system/bin/sh
# ******************
# 1°) I/O Schedulers
# ******************
# Set i/o scheduler (Valid values are: noop, deadline, cfq, bfq, sio, vr, anticipatory)
echo bfq > /sys/block/mmcblk0/queue/scheduler;
# ************************************************
# 2°) Scaling Governor & Smooth Scaling Parameters
# ************************************************
# Set scaling governor, according to available governors in your kernel
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
# Smooth scaling parameters to control any governor jumping to higher frequency directly.
echo 2 > /sys/devices/system/cpu/cpu0/cpufreq/smooth_target;
echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/smooth_offset;
echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/smooth_step;
# ****************************************************************
# 3°) Deepsleep Levels
# cpulevel = 4 (100Mhz - 800Mhz, default), 5 (100Mhz - 500Mhz)
# buslevel = 0 (400MHz, default), 1 (266MHz), 2 (133MHz)
# ****************************************************************
# Set deep sleep frequency & bus speed:
echo 5 > /sys/devices/system/cpu/cpu0/cpufreq/deepsleep_cpulevel;
echo 2 > /sys/devices/system/cpu/cpu0/cpufreq/deepsleep_buslevel;
# ****************************
# 4°) CPU Frequency & Voltages
# ****************************
# Set frequency steps according to the number of steps in your kernel.
echo "1600 1400 1200 1000 800 500 200 100" > /sys/devices/system/cpu/cpu0/cpufreq/freq_table;
# Set voltages for frequency steps. Changes possible at +/-25mV steps
echo "1350 1275 1150 1050 950 900 850 800" > /sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table;
# Sets global scaling min&max frequencies as 100 and 1000 mhz
echo 100000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo 1200000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
# ************************************
# 5°) GPU Clock, Voltages & Thresholds
# ************************************
# Set GPU clocks (Valid values are: 100 114 133 160 200 267 300 400 )
echo "40 133 267" > /sys/class/misc/gpu_clock_control/gpu_control;
# Set GPU Up and Down thresholds
echo "90% 25% 90% 45%" > /sys/class/misc/gpu_clock_control/gpu_control;
# Set GPU voltages (Changes possible at +/-50mV ie at 50000 steps)
echo "850000 900000 950000" > /sys/class/misc/gpu_voltage_control/gpu_control;
# ======================================================
# 6°) Hot Plug Thresholds, Sampling Interval & Frequency
# ======================================================
# Set second core kick-in threshold for screen-on state
echo 35 > /sys/module/pm_hotplug/parameters/loadl;
echo 80 > /sys/module/pm_hotplug/parameters/loadh;
# Set second core kick-in threshold for screen-off state
echo 90 > /sys/module/pm_hotplug/parameters/loadl_scroff;
echo 100 > /sys/module/pm_hotplug/parameters/loadh_scroff;
# Set hot plug sampling intervals for screen-on state
echo 400 > /sys/module/pm_hotplug/parameters/rate;
echo 400 > /sys/module/pm_hotplug/parameters/rate_cpuon;
# Set hot plug sampling intervals for screen-off state
echo 1000 > /sys/module/pm_hotplug/parameters/rate_scroff;
# Set frequency below which second core will not be turned on, regardless of thresholds.
echo 524288 > /sys/module/pm_hotplug/parameters/freq_cpu1on;
# ===================
# 7°) Bus Frequencies
# ===================
# Set bus frequencies for highest-to-lowest cpu frequencies and enable static bus frequency scaling
#echo "0 0 0 1 1 2 2 2" > /sys/devices/system/cpu/cpu0/cpufreq/busfreq_static;
#echo enabled > /sys/devices/system/cpu/cpu0/cpufreq/busfreq_static;
# ====================================
# 8°) Schedule Multi Core & Idle Modes
# ====================================
# Enable sched_mc
echo 1 > /sys/devices/system/cpu/sched_mc_power_savings;
# Enable AFTR
echo 3 > /sys/module/cpuidle/parameters/enable_mask;
# =============================
# 9°) Brightness Curve Settings
# =============================
# Brightness settings (Possible values for min_bl = 0 to 255 | min_gamma = 0 to 24 | max_gamma = 0 to 24)
echo 20 > /sys/class/misc/brightness_curve/min_bl;
echo 1 > /sys/class/misc/brightness_curve/min_gamma;
echo 24 > /sys/class/misc/brightness_curve/max_gamma;
# =================================
# 10°) Touch Sensitivity Parameters
# =================================
# Set touch sensitivity (Possible values are between 40 to 80. Lower value = higher sensitivity)
echo 40 > /sys/devices/virtual/sec/sec_touchscreen/tsp_threshold;
# ===================
# 11°) Charge Current
# ===================
# Set AC, Misc & USB charge current (Do not set Ac & Misc more than 1000mA or Usb more than 450)
echo "950 950 450" > /sys/devices/virtual/misc/charge_current/charge_current;
# =======================================
# 12°) Switch Hotplug/DualCore/SingleCore
# =======================================
# Set Dynamic hotplug mode
echo on > /sys/devices/virtual/misc/second_core/hotplug_on;
echo on > /sys/devices/virtual/misc/second_core/second_core_on;
# ===================
# 13°) Disable logger
# ===================
if [ ! -d /data/.siyah ];
then
mkdir /data/.siyah;
chmod 777 /data/.siyah;
fi;
touch /data/.siyah/disable-logger;
# ====================
# 14°) Graphic tunings
# ====================
setprop debug.sf.hw 1; # HARDWARE RENDERING (GPU)
setprop video.accelerate.hw 1;
setprop debug.performance.tuning 1;
# Set deep sleep frequency & bus speed:
echo 5 > /sys/devices/system/cpu/cpu0/cpufreq/deepsleep_cpulevel;
echo 2 > /sys/devices/system/cpu/cpu0/cpufreq/deepsleep_buslevel;
See the echo 5, change that to 4. And your SOD's will be gone!!
Steve you are the man! Thank you for bundling these scripts all in one place. Everything is smooth and my phone is sleeping like a baby so far.
moustro said:
Steve you are the man! Thank you for bundling these scripts all in one place. Everything is smooth and my phone is sleeping like a baby so far.
Click to expand...
Click to collapse
What ROM are you using?
Can these scripts be used on Unnamed?
Unit.d generator in the i9100 forum works great for this.
Must script manager be used to give these scripts root access to work?
Sent from my i777.
desiromeo719 said:
What ROM are you using?
Can these scripts be used on Unnamed?
Click to expand...
Click to collapse
Miui 2.1.13
I believe these scripts are universal and can run on siyah or entropy dd. Can someone else confirm this?
Sorry guys for the late reply. Busy at work. Yes these scripts are universal for any ROM. Just make sure your kernel supports init.d. Siyah and Entropy both support them.
moustro said:
Miui 2.1.13
I believe these scripts are universal and can run on siyah or entropy dd. Can someone else confirm this?
Click to expand...
Click to collapse
No, some of them depend on tunables in Siyah I haven't ported over yet.
Personally, I would not recommend putting voltage settings in a script that you distribute to the public, as voltages are device-unique.
I'm also a firm believer in a number of small separate scripts with descriptive names, instead of a "megascript" that does it all - harder to analyze and harder to pick and choose.
I'll take a look at the specific script contents when I have some time.
thx for clarifying entropy. i did state specifically about the voltages and they have been modified to my likings. so for now use for siyah kernel. and once again pls adjust the voltages to values that your phone can handle. some phones can only take a -25 mv from stock voltages. s98bolt1 and screenstate should be used as a base only. adjust them to your liking. the other scripts are system tweaks and are universal for most roms.
Sent from my SGH-I777 using xda premium
Thanks for this post Steve. Im sure once I get a handle on these tweaks and applying them I will greatly benefit from them!
No problem. Trying to help out anyway I can. I know all these scripts can be confusing and a headache. I noticed a lot of people asking how to make scripts and OC and UV settings so why not make them avail for the general public. It's just a good base to start off with for siyah users. If anyone has or needs any help in reading the scripts and how to adjust them let me know.
I could ask ya a million questions..but I wont lol. Just trying to do lots of reading here..and on Google to learn about scripts..init.d..OC and UV. Sometimes I think I got it...but then i get all confused. The only script I have now is the V6. That one just seemed like I could handle since it basically walks ya through the entire process. And to be honest..not even sure i notice a difference.
jasvncnt1 said:
I could ask ya a million questions..but I wont lol. Just trying to do lots of reading here..and on Google to learn about scripts..init.d..OC and UV. Sometimes I think I got it...but then i get all confused. The only script I have now is the V6. That one just seemed like I could handle since it basically walks ya through the entire process. And to be honest..not even sure i notice a difference.
Click to expand...
Click to collapse
Trust me, it made a difference. It's nothing flashy, and nothing some people would notice, but it did.
Nice post stevehkim, I may give these are try.
Sent from my SGH-I777 using xda premium
If I may..s70darkyzipalign, s98cfs, s98systemtweak...Are theses kinda like OC and UV or just minor system tweaks? I tried opening them and taking a look...but have no idea what im looking at. I admit, I am not the smartest person thats for sure
They, from their titles, are system tweaks. I haven't looked through them, so I can't tell for sure.
Edit: Steve, you might want to post a brief description of what each script does, which can be run independently, which need to be run together, and most importantly how to implement them.
Just a suggestion to cut back on confusion and potential fights
Sent from my SGH-I777 using xda premium

CPU governor : interactive VS hotplug

In my previous thread, I made mistakes in my findings.
http://forum.xda-developers.com/showthread.php?t=1750444
Thank you for your inputs and feedbacks which made me to investigate further.
I used OS Monitor app, to change the governor, and it seem the app changed the cpu governor of 1 core (cpu0) only, where, we need to change both cores (cpu0, cpu1) cpu governor's setting.
Here are my revised procedures.
Code:
$ adb shell 'ls /sys/devices/system/cpu/cpufreq/'
interactive # CPU governor mode
$ adb shell 'cat /sys/devices/system/cpu/online'
0-1 # This means, both cores are currently running.
Now leave the RAZR for 5 minutes... and run these commands
Code:
$ adb shell 'cat /sys/devices/system/cpu/online'
0-1 # This means, both cores are currently running.
$ adb shell 'su -c "cat /sys/devices/system/cpu/cpu[01]/cpufreq/cpuinfo_cur_freq"'
1200000 # current CPU core 0 speed. 1.2GHz
1200000 # current CPU core 1 speed. 1.2GHz
Now we combine both and make a simple monitoring.
Code:
$ adb shell 'su -c "while ((1)); do cat /sys/devices/system/cpu/cpu[01]/cpufreq/cpuinfo_cur_freq /sys/devices/system/cpu/online; sleep 1; done"'
1200000
1200000
0-1
300000
300000
0-1
300000
300000
0-1
300000
300000
0-1
Imagine this, even during idling, BOTH cores are running, and it shoots to 1.2GHz immideately from 300Mhz, IMHO, this is might be onf the causes of the lower battery life.
Now, this command will change the CPU governor to hotplug
Code:
adb shell 'su -c "echo hotplug > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor; echo hotplug > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor"'
Yes, you need to set BOTH cores CPU governor to hotplug.
Now start monitoring, while
Code:
$ adb shell 'su -c "while ((1)); do cat /sys/devices/system/cpu/cpu[01]/cpufreq/cpuinfo_cur_freq /sys/devices/system/cpu/online; sleep 1; done"'
600000
600000
0-1
300000
300000
0-1
600000
0
300000
0
300000
0
300000
0
Conclusions:
Now we can see, the hotplug CPU governor dynamicly enable and disable the second core, and may improves the battery's life. The interactive CPU governer seem to be nice to make thing runs very smooth, but, the downside is, it uses more power.
Thank you and very sorry for the mistakes which may lead to the misinfonrmations in my previous thread.
i always thought adding more cores will improves battery life..
Let's see... NVIDIA's Tegra 3 cpu has 4+1 cores, which the the 5th core is a 500MHz low power core, which is run during standby. In logic, reducing cores, also mean less or no electrical current is going to the disabled cores, and improves the battery life.
The previous Andorid version, which is the GB 2.3.6, Motorola set the CPU governor to mot_hotplug which IMHO, gave a reasonably good battery life.
Now, how about we do some testings, by comparing the average battery life, when using interactive or hotplug CPU governor.
Thank you.
bahathir said:
Now, how about we do some testings, by comparing the average battery life, when using interactive or hotplug CPU governor.
Click to expand...
Click to collapse
I've back-ported some cpu-freq governor modules to Motorola kernel 3.0.8.
I would love to see how this module competes with stock version
List of cpu-freq governor
interactiveX V2 by imoseyon (Lean Kernel for Galaxy Nexus)
hotplugX by imoseyon (Lean Kernel for Galaxy Nexus)
SmartassV2 by Erasmux
Personally, I like the interactiveX. Having best of the both world.
interactive profile + hotplug ability (screen off -> core 1 off)
Thread link [GSM/CDMA][ICS][KERNEL] extra kernel modules
Tq. I'll try it later.
Sent from my XT910 using xda app-developers app
Here are some information after about a day with hotplug CPU governor.
Code:
[email protected]:~$ adb shell 'su -c "cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state"'
300000 1986985
600000 196658
800000 51932
1000000 40389
1200000 348778
[email protected]:~$ adb shell 'su -c "cat /sys/devices/system/cpu/cpu0/cpufreq/stats/trans_table"'
From : To
: 300000 600000 800000 1000000 1200000
300000: 0 0 0 0 8768
600000: 3378 0 0 23 1605
800000: 731 1279 0 20 546
1000000: 624 412 732 0 586
1200000: 4035 3315 1844 2310 0
and here is the battery usage information...I deleted /data/system/batterystats.bin first and full charged the battery.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I was using my phone to read/update this forum using XDA app and reading news using Pulse apps during about 1.5 hours commuting. I also listening to podcasts or lectures for about 3-4 hours, which I downloaded using Wifi. Several chattings using gtalk, and several phone calls, on 3G/HSDPA network.
I still have 10%, and seem to be able to get 20 hours of battery life. It was like the GB 2.3.6 with default 'mot_hotplug' CPU governor. Battery life would be much better if I use 2G/GSM network only all the time
Not bad, I may use this setup for a while... before trying other CPU governors.
Note: I like minimalist settings. No live wallpaper, very few widgets. Brightness is at 'Auto'.
Thank you
I noticed that while monitoring the CPU and running Antutu, that the cpufreq hardly ever stayed at 1.2ghz. it dropped to 300M or 600M for most of the test.
I did get a score increase of 703 going from 5606 before switching to hotplug, to 6309 after.
Updates: 2012-07-12
Another day with hotplug CPU governor. This time, I changed the governor's sampling_rate
Code:
$ adb shell 'su -c "cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate"'
100000
100000 is a default sampling rate, ie, how quick 'sensitive' the kernel to react and change the CPU frequency.
On my laptop, which runs on conservative CPU governor, the sampling rate is 25000.
I changed the sampling rate to 25000 to my RAZR, and,...I felt a bit jerky, if I scroll the screen SLOWLY, comparted to the original 100000. Next, I tried 50000, and it reduced the jerkiness, at the same time, keep the CPU frequency at the lowest for most for the time. I also changed down_threshold value, to mimic the conservative CPU governor from 35 (default) to 20. Not as smooth as the defualt 100000 sampling rate, but, still usable. Yeah, it is a small sacrifice if you want to conserve energy.
Now, here are all commands that I am using right now.
Code:
adb shell 'su -c "
echo hotplug > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
echo hotplug > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor;
echo 20 > /sys/devices/system/cpu/cpufreq/hotplug/down_threshold;
echo 50000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate
"'
I hope these screenshots can speak itself
My activities whit the RAZR were...
1) Listening to 2 podcasts ...total about 2 hours (Google Listen)
2) Listening 1 lecture . 1.5 hours (Google Play Music)
3) Browse/read news from 8 sites in Pulse :
4) Sevaral gtalks
5) Several short phone calls.
6) Reading this forum using XDA App
Quite good battery life fo a low usage.
Thank you.
Reference:
http://www.kernel.org/doc/Documentation/cpu-freq/user-guide.txt
http://www.kernel.org/doc/Documentation/cpu-freq/governors.txt
Sorry, but why did you lower the down_threshold? This means your CPU stays longer in higher frequencies because the utilization has to drop under 20% to scale down.
dafi87 said:
Sorry, but why did you lower the down_threshold? This means your CPU stays longer in higher frequencies because the utilization has to drop under 20% to scale down.
Click to expand...
Click to collapse
Thank you for your feedback.
You are right. I just copied the value (20) from my laptop which is running on conservative CPU governor.You can always try with other value, while monitoring the cores' frequency. I did few experiments with value of 50. and do some 'real world' usage, such as... playing Angry Birds SPACE.
Based on my observation, not much differences between value of 20 and 50. but, it seem that value 20 able to keep lower speed more gracefully. Most probably this related to the sampling_rate. The cpu frequency changes are done in microseconds..
Need some more tests for this matter.
Thank you.
So this means that hotplug is as efficient as interactive plus saves battery?
Based on ny daily usage, hotplug gives me a small improvement in performances and battery life. YMMV.
Sent from my XT910 using xda app-developers app
for me,
hotplugx >> hotplug > interactive.
R3dbeaver said:
for me,
hotplugx >> hotplug > interactive.
Click to expand...
Click to collapse
hotplugx stutters here and there after a while... way better pegasus or even hotplug
edit

[MOD] Workaround for ATP performance fix

Hey guys,
To those who are still yet unlocked but rooted, I thought I share my experience after tweaking and fine tuning my ATP. I have tested these settings for the last 3 weeks and it appears to be stable and fast. Most of these tweakings are based on various mods/suggestions found on this forum but I have changed some values/settings and picked and mixed others during the fine tuning process.
Tweak 1:
The sio.sh scheduler.
Possibly the best scheduler for my experience. Less lags and less apps complaining of anr's. Our ATPs run noop by default.
To do it (using automated script to be run as startup; e.g. using SManager)
insmod /system/lib/modules/sio-iosched.ko
echo sio > /sys/block/mmcblk0/queue/scheduler
The tweaked script is attached (which combined Tweak 1 and Tweak 2)
Thank you to batoo for compiling this (I think this is by far a big lifesaver) – and to the original developer which I believe the name is Miguel Bolton.
Tweak 2:
Various VM values
The suggested workaround were these (the tune.sh)
swappiness = 0
dirty background ratio =50
dirty ratio = 70
dirty expire centisecs = 20000
dirty writeback centisecs = 20000
However I have changed mine to (with my added comments after //)
swappiness = 0
dirty background ratio =5
dirty ratio = 5
//don't want to be waiting until there are lot of processes' dirty caches before pdflush is done. So we handle this in a more graceful way by chewing a little at at time considering we already have slow io
dirty expire centisecs = 1000
//let's write dirty page to the disk and not wait too long if the ratio above has not been achieved
dirty writeback centisecs = 1000
This is reflected in the script as below:
VM values changed
echo 0 > /proc/sys/vm/swappiness
echo 5 > /proc/sys/vm/dirty_background_ratio
echo 5 > /proc/sys/vm/dirty_ratio
echo 1000 > /proc/sys/vm/dirty_expire_centisecs
echo 1000 > /proc/sys/vm/dirty_writeback_centisecs
The tweaked script is attached.
Thank you to batoo for first sharing tweaks.
Tweak 3:
Changing the default values we run Powersave – Balanced – Performance. What I think is, because core throttling is a clever thing, pushing up current Powersave to 1.2, Balanced to 1.4 and Performace to 1.6 shouldn't affect battery life that much. I am running Balanced on battery and I seemed not to lose that much battery life < 1.30hour loss and most of the time much less.
To do this, I modified the scripts in /system/etc so the appropriate one is “invoked” when the respective mode is chosen (changed scripts uploaded).
Tweak 4:
build.prop.
I have only cherry picked and commented out other settings which I think wouldn't confer any additional benefits. My modified build.prop (for ww sku) that is, is attached.
Thank you to seanzscreams for first sharing this tweaks.
It would be good to have some input from experts/devs in here on what they think especially the vm tweaks above.
Disclaimer:
I am not an android expert or a developer. It works well for me. Whilst I don't think how any of these scripts can brick your Prime, the advice is of course, do it at your own risk.
maxfac1234 said:
Hey guys,
To those who are still yet unlocked but rooted, I thought I share my experience after tweaking and fine tuning my ATP. I have tested these settings for the last 3 weeks and it appears to be stable and fast. Most of these tweakings are based on various mods/suggestions found on this forum but I have changed some values/settings and picked and mixed others during the fine tuning process.
Tweak 1:
The sio.sh scheduler.
Possibly the best scheduler for my experience. Less lags and less apps complaining of anr's. Our ATPs run noop by default.
To do it (using automated script to be run as startup; e.g. using SManager)
insmod /system/lib/modules/sio-iosched.ko
echo sio > /sys/block/mmcblk0/queue/scheduler
The tweaked script is attached (which combined Tweak 1 and Tweak 2)
Thank you to batoo for compiling this (I think this is by far a big lifesaver) – and to the original developer which I believe the name is Miguel Bolton.
Tweak 2:
Various VM values
The suggested workaround were these (the tune.sh)
swappiness = 0
dirty background ratio =50
dirty ratio = 70
dirty expire centisecs = 20000
dirty writeback centisecs = 20000
However I have changed mine to (with my added comments after //)
swappiness = 0
dirty background ratio =5
dirty ratio = 5
//don't want to be waiting until there are lot of processes' dirty caches before pdflush is done. So we handle this in a more graceful way by chewing a little at at time considering we already have slow io
dirty expire centisecs = 1000
//let's write dirty page to the disk and not wait too long if the ratio above has not been achieved
dirty writeback centisecs = 1000
This is reflected in the script as below:
VM values changed
echo 0 > /proc/sys/vm/swappiness
echo 5 > /proc/sys/vm/dirty_background_ratio
echo 5 > /proc/sys/vm/dirty_ratio
echo 1000 > /proc/sys/vm/dirty_expire_centisecs
echo 1000 > /proc/sys/vm/dirty_writeback_centisecs
The tweaked script is attached.
Thank you to batoo for first sharing tweaks.
Tweak 3:
Changing the default values we run Powersave – Balanced – Performance. What I think is, because core throttling is a clever thing, pushing up current Powersave to 1.2, Balanced to 1.4 and Performace to 1.6 shouldn't affect battery life that much. I am running Balanced on battery and I seemed not to lose that much battery life < 1.30hour loss and most of the time much less.
To do this, I modified the scripts in /system/etc so the appropriate one is “invoked” when the respective mode is chosen (changed scripts uploaded).
Tweak 4:
build.prop.
I have only cherry picked and commented out other settings which I think wouldn't confer any additional benefits. My modified build.prop (for ww sku) that is, is attached.
Thank you to seanzscreams for first sharing this tweaks.
It would be good to have some input from experts/devs in here on what they think especially the vm tweaks above.
Disclaimer:
I am not an android expert or a developer. It works well for me. Whilst I don't think how any of these scripts can brick your Prime, the advice is of course, do it at your own risk.
Click to expand...
Click to collapse
Nothing against, but my recommendation is try to read something about dirty ratio function.
Btw my opinion for this is that advance user will change these values without advice and beginner or non linux skilled user will not modify ATP sources...
BTW guys ALL of you who has not unlocked device (like me) I really DON'T recommend you to modify build.prop at all.
This post is not offensive or personal, only my opinion.
Sent from my Transformer Prime TF201 using Tapatalk 2

Categories

Resources