[SOLVED]Ondemand tweaks using init.d script - Android Q&A, Help & Troubleshooting

I want to edit some ondemand values and I have a script but when I run it in script manager it shows errors.
My Q is what commands do I have to add for it to work?
This was my original post regarding the Q,please refer here for more details: http://forum.xda-developers.com/showthread.php?t=1815616
Here's what I have:
#!/system/bin/sh
echo 85 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/powersave_bias

So many devs and no one can help.. Whats Q&A good for?
EDIT---
Solved by myself

Related

[Need help on shell script]

Can anyone tell me how to add lines in one file by another bash file?
I make a script to change governors and frequency but I need to make the setting set on boot (But I dun want use 3rd party app like SetCPU).
So I need to add these lines to init.d folder's file :
Code:
#!/system/bin/bash (and i add line but this is by default?)
echo "interactiveX" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor (if the next time i chg setting , will this line be deleted or there will be another line with new setting?)
echo "800000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "245670" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
so what command should i use to add these line ?
Code:
#!/system/bin/sh
an0nym0us_ said:
Code:
#!/system/bin/sh
Click to expand...
Click to collapse
thanks for your reply but i dont really understand...
those '800000' , '245670' and 'interactiveX' are just some example
i mean i want to write this:
echo "800000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
in init.d folder's file by other file
this file is in /system/bin
so i can access and chg my cpu setting by typing 'cpuclock'
there for i need a command to add line to init.d in order to set on boot
Code:
echo " Change CPU Governor Profile "
echo ""
echo ""
echo " Current Governor: "
echo "$CUR_GOV"
echo ""
$sleep
echo " Available Governors: "
echo "$AVAIL_GOV"
echo ""
$sleep
echo " Insert your desired governor: "
echo -n " Your Governor: ";read GOV
echo $GOV > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
[COLOR="Red"][so now i change my current governor,but the governor will be reset to default(ondemand) after next reboot]
[all i want is , while echoing current governor , i need to add one line to init.d there too , but i don know how :(][/COLOR]
echo " Complete "
echo ""
$sleep
echo -e " Current Governor: "
echo ""
echo ""
$sleep
echo -n " Press Enter Key To Continue... ";
read enterKey
opt=0;;
asd

[Q] init.d overclock script

Is this what an overclock init.d script should look like?
And how would you know if it worked?
#!/system/bin/sh
echo 245760 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governer
echo "sio" > /sys/block/mmcblk0/queue/scheduler;
If no one can tell me if I'm in the right direction or not is there a way to see if the script is working in the init.d?
If I use this:
cat > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
it still shows the default and not what I put it too.
Do I have to edit the kernel before making a script?
How can this be done properly?
The kernel needs to support overclocking before anything, if you're confident with kernel development then do that and try an o/c app from the market before using a script.
sinksterĀ©

[Q] adding governors to the init.d scripts

I have a question about adding different governors to the init.d scripts?
Is it possible to just add governors to the init.d script even though it is not in the kernel itself?
For example adding this:
echo "800000" > /sys/devices/system/cpu/cpufreq/smartass/awake_ideal_freq;
echo "200000" > /sys/devices/system/cpu/cpufreq/smartass/sleep_ideal_freq;
echo "800000" > /sys/devices/system/cpu/cpufreq/smartass/sleep_wakeup_freq
echo "75" > /sys/devices/system/cpu/cpufreq/smartass/max_cpu_load;
echo "45" > /sys/devices/system/cpu/cpufreq/smartass/min_cpu_load;
echo "0" > /sys/devices/system/cpu/cpufreq/smartass/ramp_up_step;
echo "0" > /sys/devices/system/cpu/cpufreq/smartass/ramp_down_step;
echo "24000" > /sys/devices/system/cpu/cpufreq/smartass/up_rate_us
echo "99000" > /sys/devices/system/cpu/cpufreq/smartass/down_rate_us
Even though the kernel doe's not have smartass folder?
Will this run properly?

[BOTH][SCRIPT] Make it Last/Speed it UP!

Okay guys, I made some kernel tweaks that work on any ROM, and on the ROMs I have tried, improve battery life/performance.
THE BATTERY SAVER SCRIPT WILL NOT IMPROVE QUADRANT SCORES!
THIS SCRIPT WILL BE UPDATED FREQUENTLY!
Last update 7/11
Latest update notes: Focused more on battery life.
Battery stats on Liquid Smooth 1.5 with script:
{
"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"
}
Prerequisites:
Have root access
An app that can run scripts on boot, like Script Manger, located here:
https://play.google....ptmanager&hl=en
INSTRUCTIONS:
If using Script Manager:
1. Navigate to file.
2.Open as Script/Executable.
3.Set it to run at boot and as SU.
4.Save
5. Reboot.
If using ROM Toolbox:
1. Select "Scripter"
2.Select new script
3. Copy and paste script into Scripter
4. Select "At Boot"
5. Reboot
Make it Last script:
Code:
#!/system/bin/sh
echo "500,512000,64,2048" > /proc/sys/kernel/sem
echo "3072" > /proc/sys/kernel/msgmni
echo "74000" > /proc/sys/kernel/msgmax
echo "3072" > /proc/sys/kernel/shmmni
echo "2268435456" > /proc/sys/kernel/shmmax
echo "16777216" > /proc/sys/kernel/shmall
echo "400000" > /proc/sys/kernel/sched_min_granularity_ns
echo "256" > /proc/sys/kernel/random/write_wakeup_threshold
echo "256" > /proc/sys/kernel/random/read_wakeup_threshold
echo "5" > /proc/sys/kernel/panic
echo "575810" > /proc/sys/kernel/threads-max
echo "1" > /proc/sys/kernel/panic_on_oops
echo "25" > /proc/sys/kernel/hung_task_timeout_secs
echo "600000" > /proc/sys/kernel/sched_latency_ns
echo "2000000" > /proc/sys/kernel/sched_wakeup_granularity_ns
echo "1" > /proc/sys/kernel/sched_compat_yield
echo "0" > /proc/sys/kernel/sched_child_runs_first
echo "0" > /proc/sys/kernel/hung_task_timeout_secs
echo "0" > /proc/sys/vm/oom_kill_allocating_task
#end of /kernel , start of /fs
echo "10240" > /proc/sys/fs/inotify/max_user_watches
echo "256" > /proc/sys/fs/inotify/max_user_instances
echo "32000" > /proc/sys/fs/inotify/max_queued_events
echo "15" > /proc/sys/fs/lease-break-time
echo "165164" > /proc/sys/fs/file-max
echo "1053696" > /proc/sys/fs/nr_open
#end of /fs, start of /vm
echo "0" > /proc/sys/vm/oom_kill_allocating_task
echo "4" > /proc/sys/vm/min_free_order_shift
echo "1" > /proc/sys/vm/overcommit_memory
echo "2" > /proc/sys/vm/panic_on_oom
echo "8" > /proc/sys/vm/page-cluster
echo "3" > /proc/sys/vm/drop_caches
echo "0" > /proc/sys/vm/oom_kill_allocating_task
echo "2048" > /proc/sys/vm/min_free_kbytes
echo "20" > /proc/sys/vm/vfs_cache_pressure
echo "80" > /proc/sys/vm/dirty_background_ratio
echo "90" > /proc/sys/vm/dirty_ratio
echo "3700" > /proc/sys/vm/dirty_writeback_centisecs
echo "2100" > /proc/sys/vm/dirty_expire_centisecs
echo "0" > /proc/sys/vm/laptop_mode
echo "0" > /proc/sys/vm/block_dump
echo "0" > /proc/sys/vm/swappiness
IF THESE SCRIPTS DON'T WORK, USE THIS ONE.
Find them HERE
STEP 1. Under File, select DOWNLOAD.
STEP 2. Find a way to get it to your phone,make sure it's not opened in any text editors, until it's on your phone.
STEP 3. Follow other instructions
All credit ofr the above script goes to housas08
Latest update notes: enabled ZRAM(compressed RAM), loads SIO I/O if available, also loads the hotplugx governor and SIO on boot. Ups read and write speeds all around, file system speedups, enables multi threading, tweaks to the hotplug and hotplugx governor, and more. You might get random reboots using this script, you might only get a coupke and then they will stop or they'll never stop. Inform me if you consistent random reboots.
Credit to zepelinrox for minfreee and adj valueshttp://forum.xda-developers.com/showthread.php?t=991276
Credit to whirleyes for theKernel Modules.
GET THE SIO I/O SCHEDULER AND THE HOTPLUGX GOVERNOR HERE!
I HIGHLY RECOMMEND THEM FOR PERFORMANCE!
Speed it UP! script:
Code:
#!/system/bin/sh
# Load SIO I/O and hotplugx governor
insmod /system/lib/modules/cpufreq_hotplugX.ko
insmod /system/lib/modules/sio-iosched.ko
echo "700000" > /proc/sys/kernel/sched_latency_ns
echo "300000" > /proc/sys/kernel/sched_min_granularity_ns
echo "26188" > /proc/sys/kernel/sched_features
#writes more pages to disc, when given oppurtunity
echo "8" > /proc/sys/vm/page-cluster
#drop all cahces when given oppurtunity
echo "3" > /proc/sys/vm/drop_caches
#Keep 4MB in memory
echo "4096" > /proc/sys/vm/min_free_kbytes
#Dump Vfs cache less
echo "20" > /proc/sys/vm/vfs_cache_pressure
echo "80" > /proc/sys/vm/dirty_background_ratio
#How much dirty data there must be to write to disc
echo "90" > /proc/sys/vm/dirty_ratio
#How often writeback daemons wakeup to write data to disc.
echo "900" > /proc/sys/vm/dirty_writeback_centisecs
#How old 'dirty" data has to be to be written to disc
echo "800" > /proc/sys/vm/dirty_expire_centisecs
#^^^^^^Both expressed in 100th of second^^^^^^
echo "20" > /proc/sys/vm/swappiness
#faster sdcard read speed
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
#enable multi threading
echo "1" > /proc/sys/kernel/multi_threading
# file system speedups
mount -o remount,noauto_da_alloc /system /system
mount -o remount,noauto_da_alloc /data /data
mount -o remount,noauto_da_alloc /cache /cache
# disable logcat - performance boost & save memory,comment, reboot for logcat.
rm /dev/log/main
#sets cpu governor to hotplug, is most intelligent
echo "hotplug" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "950" > /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_transition_latency
#decreases sampling rate, stops lag and saves battery
echo "500000" > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate
echo "75" > /sys/devices/system/cpu/cpufreq/hotplug/up_threshold
echo "45" > /sys/devices/system/cpu/cpufreq/hotplug/down_threshold
echo "15" > /sys/devices/system/cpu/cpufreq/hotplug/hotplug_out_sampling_periods
echo "5" > /sys/devices/system/cpu/cpufreq/hotplug/hotplug_in_sampling_periods
#sets I/O scheduler to SIO, considered best
echo "sio" > /sys/block/mmcblk0/queue/scheduler
echo "sio" > /sys/block/mmcblk1/queue/scheduler
#Sets read and write on I/O sceduler to max.
echo "2048" > /sys/block/mmcblk0/queue/read_ahead_kb
echo "2048" > /sys/block/mmcblk1/queue/read_ahead_kb
#will merge tasks if able
echo "1" > /sys/block/mmcblk0/queue/nomerges
echo "1" > /sys/block/mmcblk1/queue/nomerges
echo "1" > /sys/block/mmcblk0/queue/low_latency
echo "1" > /sys/block/mmcblk1/queue/low_latency
echo "256" > /sys/block/mmcblk0/queue/nr_requests
echo "256" > /sys/block/mmcblk1/queue/nr_requests
echo "2048" > /sys/block/mmcblk0/bdi/read_ahead_kb
echo "2048" > /sys/block/mmcblk1/bdi/read_ahead_kb
echo "256" > /sys/block/zram0/bdi
#cache cleaner
rm -r /cache/*.apk
rm -r /cache/*.tmp
rm -r /data/dalvik-cache/*.apk
rm -r /data/dalvik-cache/*.tmp
#doesn't verify bus info, faster I/O
echo "N" > /sys/bus/hid/drivers/motorola/module/parameters/mot_pass_through_mt_input
echo "256" > /sys/class/bdi/default/read_ahead_kb
#faster scroll speed
echo "64" > /sys/bus/hid/drivers/magicmouse/scroll_speed
#performance boost in read/write when heap is at 4MB.
echo "4096" > /sys/block/mmcblk0/queue/optimal_io_size
echo "4096" > /sys/block/mmcblk1/queue/optimal_io_size
#better memory mangement
echo "2048,4096,43008,47104,51456,55808" > /sys/module/lowmemorykiller/parameters/minfree
#OOM fixes , shoould see awesome increase in multitasking
echo "0,3,6,10,12,15" > /sys/module/lowmemorykiller/parameters/adj
#net speed tweaks
echo "0" > /proc/sys/net/ipv4/tcp_timestamps
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse
echo "1" > /proc/sys/net/ipv4/tcp_sack
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes
echo "30" > /proc/sys/net/ipv4/tcp_keepalive_intvl
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout
echo "404480" > /proc/sys/net/core/wmem_max
echo "404480" > /proc/sys/net/core/rmem_max
echo "256960" > /proc/sys/net/core/rmem_default
echo "256960" > /proc/sys/net/core/wmem_default
echo "4096,16384,404480" > /proc/sys/net/ipv4/tcp_wmem
echo "4096,87380,404480" > /proc/sys/net/ipv4/tcp_rmem
# Enable ZRAM compressed memory.
if [ -e /sys/block/zram0/disksize ] ; then
$LOG -p i "Enabling compressed RAM functionality (ZRAM)"
echo $((120*2048*2048)) > /sys/block/zram0/disksize
busybox mkswap /dev/block/zram0
busybox swapon /dev/block/zram0
fi
You will definitely see a boost in performance when running the following script.
For this to work, either run this code at boot with an app like ROM Toolbox.
Or run the attached file at boot with an app like Script Manager.
Thank you to PureMotive for the battery saving kernel tweaks to make compatible and tweak for this phone. and this thread by him
http://forum.xda-developers.com/showthread.php?t=1621808
If you can, please donate:
Donate!
Or at least leave me a thanks.
<<<<<<<<<<<<<<<
Enjoy!
Your link is broken
This can be added to my BootMenu boot script.
Do have any details on what each line improve??
maybe add comment before each line
whirleyes said:
Your link is broken
This can be added to my BootMenu boot script.
Do have any details on what each line improve??
maybe add comment before each line
Click to expand...
Click to collapse
I might comment this in the future, but I don't have the time right now. I'll fix the link to the forum in the morning, the script download is operational.
I'll suffice it to say that these tweaks make the kernel write to disc less, using less battery, but decreasing performance.
Sent from my DROID RAZR using XDA
So far: Running your script, CPU set to 800mhz max, felt no performance decrease. We'll see how this works in the future. Battery drain on EU kernel is terrible. I hope this helps a bit. Thank you!
dtrail1 said:
So far: Running your script, CPU set to 800mhz max, felt no performance decrease. We'll see how this works in the future. Battery drain on EU kernel is terrible. I hope this helps a bit. Thank you!
Click to expand...
Click to collapse
Yeah, us OG RAZR guts have to deal with crappy battery life. That's why I made this script, please post your findings.
Sent from my DROID RAZR using XDA
Can you make and update.zip that makes the script works?If this is possible ;s i'm a little newbie
luizfilipel said:
Can you make and update.zip that makes the script works?If this is possible ;s i'm a little newbie
Click to expand...
Click to collapse
Unfortunately, I don't have the skill to do so, if somebody with this skill would like to put together a flashable .zip, then I would be grateful.
Script updated, now has kernel tweaks for performance!
Enjoy!
sorry, a little question from noobs...
it should run both? or just pick one of it?
teradaz said:
sorry, a little question from noobs...
it should run both? or just pick one of it?
Click to expand...
Click to collapse
Just pick one, they contradict each other in values, so if you try to run both there will be issues in what gets applied.
Leviathan26 said:
Just pick one, they contradict each other in values, so if you try to run both there will be issues in what gets applied.
Click to expand...
Click to collapse
thank you...
doesn't work for me:
luizfilipel said:
Can you make and update.zip that makes the script works?If this is possible ;s i'm a little newbie
Click to expand...
Click to collapse
it would be useless, since you have to run the script each time you reboot your phone.
Turkishflavor said:
doesn't work for me:
Click to expand...
Click to collapse
Use the option in Script Manager to run on boot. Then reboot your phone. And the values will be applied.
sevenup30 said:
it would be useless, since you have to run the script each time you reboot your phone.
Click to expand...
Click to collapse
The updater script would probably look for an Init.d folder and run it from there on every boot, if it was there anyway.
Sent from my DROID RAZR using XDA
Leviathan26 said:
Yeah, us OG RAZR guts have to deal with crappy battery life. That's why I made this script, please post your findings.
Sent from my DROID RAZR using XDA
Click to expand...
Click to collapse
Some feedback: there are really improvements in battery life! Now I can rum the EU leak with 3G all the time and it doesn't eat the battery that much... No performancy decrease so far..
Gesendet von meinem XT910 mit Tapatalk 2
dtrail1 said:
Some feedback: there are really improvements in battery life! Now I can rum the EU leak with 3G all the time and it doesn't eat the battery that much... No performancy decrease so far..
Gesendet von meinem XT910 mit Tapatalk 2
Click to expand...
Click to collapse
Awesome! Can you take a screenshot so I can put it in the OP?
Leviathan26 said:
Awesome! Can you take a screenshot so I can put it in the OP?
Click to expand...
Click to collapse
But ive just charged it 3 hours ago and iam using it all the time. Screen on is 2 hours.
This is an older one without tweaks...
Gesendet von meinem XT910 mit Tapatalk 2
Your kernel tweaks, they are like governors? If so why is it not possible to have smartassv2 for example?
As well, did you started to work on this because of this?
Anyway, good job and I'll let you know about my experience with your tweaks =)
An1mA said:
Your kernel tweaks, they are like governors? If so why is it not possible to have smartassv2 for example?
As well, did you started to work on this because of this?
Anyway, good job and I'll let you know about my experience with your tweaks =)
Click to expand...
Click to collapse
Governors are different to tweak scripts. A governor drives the CPU directly to its needed configuration, speed on processes or things like that. This script makes the kernel working different on some processes.
---------- Post added at 12:05 AM ---------- Previous post was at 12:02 AM ----------
@OP: You added a second script. Can we run them both or better one of them alone?
dtrail1 said:
Governors are different to tweak scripts. A governor drives the CPU directly to its needed configuration, speed on processes or things like that. This script makes the kernel working different on some processes.
---------- Post added at 12:05 AM ---------- Previous post was at 12:02 AM ----------
@OP: You added a second script. Can we run them both or better one of them alone?
Click to expand...
Click to collapse
Just run one at a time, they contradict each other in values. And the performance script is going to be getting an update later today.

NEED HELP

I have some scripts in my init.d folder, but when i check it on init.d log file.. it doesn't work. I do same as tutorial that i got here.. but it said "nonexistent directory" . Is there anyone know why?
I still confused because two of my scripts (zipalign & loopy_smoothness) are working.. but not for the other..
Here one of my tweaks :
#!system/bin/sh
echo "64" > /sys/module/lowmemorykiller/parameters/cost
echo "0,1,2,4,9,15" > /sys/module/lowmemorykiller/parameters/minfree
echo "0" > /sys/module/lowmemorykiller/parameters/debug_level
The log file said " nonexistent directory "..
Thanks before.. and sorry for my bad english..
Sent from my Hisense E-860 using Tapatalk 2
Looks like you have a typo on line 1.
Should start
#!/system/bin/sh
Sent from my HTC One X+ using Tapatalk 2
albraine said:
I have some scripts in my init.d folder, but when i check it on init.d log file.. it doesn't work. I do same as tutorial that i got here.. but it said "nonexistent directory" . Is there anyone know why?
I still confused because two of my scripts (zipalign & loopy_smoothness) are working.. but not for the other..
Here one of my tweaks :
#!system/bin/sh
echo "64" > /sys/module/lowmemorykiller/parameters/cost
echo "0,1,2,4,9,15" > /sys/module/lowmemorykiller/parameters/minfree
echo "0" > /sys/module/lowmemorykiller/parameters/debug_level
The log file said " nonexistent directory "..
Thanks before.. and sorry for my bad english..
Sent from my Hisense E-860 using Tapatalk 2
Click to expand...
Click to collapse
try this and make sure about script permissions
Code:
#!/system/bin/sh
echo "64" > /sys/module/lowmemorykiller/parameters/cost;
echo "0,1,2,4,9,15" > /sys/module/lowmemorykiller/parameters/minfree;
echo "0" > /sys/module/lowmemorykiller/parameters/debug_level;
you can also add #!/system/xbin/busybox/sh instead of #!/system/bin/sh
No.
I'm not using tipo..
I'm on hisense E-860
Thanks..
I just saw this post..
.
My init.d script is working now

Categories

Resources