[INITSCRIPT] screenstate_scaling - switch CPU freq governor on screen state change - Desire General

Attached init script changes the CPU frequency governor based on the screen state:
Code:
screen on -> interactive governor
screen off -> powersave governor
Don't use this with SetCPU!
Thanks NeoPhyTe.x360 for the idea...
Edit:
This script is released to public domain, so it can be freely used for derivative works without permission!

Good thinking!
Thanks for sharing.

do we flash this in clockwork?

bradputt said:
do we flash this in clockwork?
Click to expand...
Click to collapse
Nope, it's just a init script for the ROM devs...

but is possible to applu in a rooted phone simply copying to /systen/etc or nope? needs setcpu or works without?
thx

Awesome work you do
+10

This is supercool, we wont need to use SETCPU anymore, just flash this and enjoy super battery life, big thanks FloHimself!

bartito said:
but is possible to applu in a rooted phone simply copying to /systen/etc or nope? needs setcpu or works without?
thx
Click to expand...
Click to collapse
You can push this script to /system/etc/init.d but it has some dependencies e.g. the interactive governor, perflock disabler when you want to underclock, ...
NeoPhyTe.x360 said:
Awesome work you do
+10
Click to expand...
Click to collapse
It was your idea, so same goes to you!
ivicask said:
This is supercool, we wont need to use SETCPU anymore, just flash this and enjoy super battery life, big thanks FloHimself!
Click to expand...
Click to collapse
That's the reason we are doing it this way: make the governor switching a bit more low level without SetCPU. But remember, this is not a update.zip and not flashable from recovery...

nice work. i really appreciate this. lets hope all the devs see this

FloHimself said:
Attached init script changes the CPU frequency governor based on the screen state:
Code:
screen on -> interactive governor
screen off -> powersave governor
Don't use this with SetCPU!
Thanks NeoPhyTe.x360 for the idea...
Click to expand...
Click to collapse
Useless... Interactive governor sets low speed when idle.

sbricout said:
Useless... Interactive governor sets low speed when idle.
Click to expand...
Click to collapse
You are right, the interactive governor sets the lowest speed when idle. But idle != screen off.

sbricout said:
Useless... Interactive governor sets low speed when idle.
Click to expand...
Click to collapse
Applications and services can still ramp up the CPU speed during the screen being off, so not useless at all. Switching to the powersave governor for when the screen is off, will stop it ramping up during this time.

I modified the script abit to include frequencies for min and max.
http://linux-box.nl/~sjoer/90screenstate_scaling

sfjuocekr said:
I modified the script abit to include frequencies for min and max.
http://linux-box.nl/~sjoer/90screenstate_scaling
Click to expand...
Click to collapse
Nice, that`s something I`ve done later, too :
http://dl.dropbox.com/u/31174/android/90screenstate_scaling
Thought about extending it some more...

don't punch me, but... how can this be installed?

Kinda complicated, you`ll need a modified init.rc to run the scripts from /system/etc/init.d/ at startup, you have to push the governor modules and perflock_disabler module compiled for your kernel in /system/lib/modules/ the insmod scripts for the governors, perflock_disabler script and the script above to /system/etc/init.d/
FloHimself thank you very much for the scripts and the modules.

Is it me or is this script constantly looping with no breaks/sleeps?

I've installed Neophytes' ArauxtSense 7.1 rom and he already added this on his rom. The question is, do I have to uninstall my SetCPU now? I have my referred settings on it and don't know how to disable it. I have unchecked the "Set on Boot" but everytime I boot my device, I can see that the SetCPU is still running on the background. Any advice? Any risks when having them both?

sub0min0us said:
I've installed Neophytes' ArauxtSense 7.1 rom and he already added this on his rom. The question is, do I have to uninstall my SetCPU now? I have my referred settings on it and don't know how to disable it. I have unchecked the "Set on Boot" but everytime I boot my device, I can see that the SetCPU is still running on the background. Any advice? Any risks when having them both?
Click to expand...
Click to collapse
There shouldn't be any risks, but one of them will force its set freq, and the other one will be constantly changing it
Sent from my HTC Desire using XDA App

Thanks for clearing that out. I guess I'll have to uninstall it then not unless I install another rom. Thank you...

Related

[MOD]Flashable OverClocking Daemon- Use with any ROM

First off i take no credit for the virtuous oc daemon itself, it was developed by rmk40.
And credit goes to -viperboy- for the idea, i used his rom and really liked the oc daemon and saw the difference it makes. Check his rom out here. It has a nice interface to control the oc daemon and other features of the rom.
You can get more info here
DON'T use any apps to adjust cpu with this ie., setcpu, cpumaster, etc.
Ok, here is the deal flash the zip file the script will run by itself the only adjustment you have to make is the virtuous oc settings. This should work with any rom and probably any device i just don't have any other devices to test it on.
Here is how:
Open root explorer (or whatever file manager you use) and navigate to /system/etc/virtuous_oc, you will see 6 files named:
sleep_governor
sleep_max_freq
sleep_min_freq
wake_governor
wake_max_freq
wake_min_freq
These are the files you edit to your liking, i only edited wake_max_freq to read 1863000 or 1.8ghz
The two governor file have different settings and they are:
conservative
userspace
powersave
ondemand
performance
Again edit to your liking i left them ondemand myself seems to work good. I don't really know what the settings do exactly when it comes to these but they seem pretty self explanatory.
To see if it's working all you need to do is open terminal emulator or adb shell and type one of the following:
Current CPU frequency
Code:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
Current CPU governor
Code:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Current min CPU Freq
Code:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
Current max CPU Freq
Code:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
It autostarts using init.d, so MAKE SURE your rom supports init.d, if it doesn't you can still use it but it has to be started manually by entering the following in terminal emulator:
Code:
/system/xbin/virtuous_oc
If you overclock MAKE SURE your kernel supports it, I'm not responsible for any damage incurred
In the future i want to make an app to control the settings but i am still learning that part.
Big thanks to rmk40 for this awesome daemon and -viperboy- the bad ass idea !!​
EDIT:
A basic rundown of the oc daemon is it scales up your cpu when you screen is on and scales it down when it is off, so your cpu is not overclocked continuously. It does save on battery as long as you don't get crazy with the overclocking.
rugedraw said:
The frequencies are:
Underclock: 192000 384000 432000 486000 540000 594000 648000 702000 756000 810000 864000 918000 972000 1026000 1080000 1134000 1188000 (stock)
Overclock: 1188000 (stock) 1296000 1404000 1512000 1620000 1782000 1836000 1944000 2052000
There may be some extra ones not listed here. From doing basic math, it seems you have to go up or down in increments of 54,000 when adjusting the CPU speeds. So if you want to UC higher than 192000 but lower than 384000, then you SHOULD be able to add 54,000 to 192000 and use that, or subtract 54,000 from 384000 and go that route.
Click to expand...
Click to collapse
Changelog:
-Added Juwe11 ram optimization script
-Added speed up SD hack (Set at 3072) Details here
I tested this for the My Touch 4G last night and it works great, installs in seconds. I'll help out watching the thread and answering questions for those whom need it if Smokin isn't around to answer them.
What does this exactly do for your phone?
Sent from my HTC Glacier using XDA Premium App
codey895 said:
What does this exactly do for your phone?
Sent from my HTC Glacier using XDA Premium App
Click to expand...
Click to collapse
This is an OC Daemon, its designed to control the processing speeds of your device. SetCPU does the same thing but this method is more stable and works without using any voltage. You can read some of the information listed in the links above.
whats the difference of the 2 zip files?
bstylz911 said:
whats the difference of the 2 zip files?
Click to expand...
Click to collapse
Changelog:
-Added Juwe11 ram optimization script
-Added speed up SD hack (Set at 3072) Details here
Click to expand...
Click to collapse
That's the information for the second ZIP file, the other one doesn't have that optimization.
so is it safe to say that i can use this on my MT4G running CM7 latest nightly?
I'm a little confused here. I got this up and running using the intstructions in the OP. But the frequencies don't match my kernels frequencies. Shouldn't they match?
Sent from my HTC Glacier using XDA App
estallings15 said:
I'm a little confused here. I got this up and running using the intstructions in the OP. But the frequencies don't match my kernels frequencies. Shouldn't they match?
Sent from my HTC Glacier using XDA App
Click to expand...
Click to collapse
No, the kernel gives you a range of highest to lowest frequency range in which they are able to run. You tune the kernel to run at the frequency that you want it too so if you run the kernel at the highest frequency the phone will run fast but you will use the battery faster, if you tune the kernel to run slow the phone will run slower but your battery will last longer.
What your looking to do is adjust the kernel to the closest frequency to give you the best performance but low enough to continue to keep a long battery life.
Kernels run by using Governors, if you select "OnDemand" as your governor it will run what ever Highest frequency you set it for when ever your device is out of sleep mode, (Example: MAX 1836000 and Minimum 192000) when ever you put the device in sleep mode it will automatically run at the lowest setting. This conserves battery while you still use better performance when actually using the phone.
Hope this clears it up for you.
itzsmokey: so is it safe to say that i can use this on my MT4G running CM7 latest nightly?
Click to expand...
Click to collapse
Yes this will work for that ROM, it's designed to be flashed after the ROM is installed, there are ways to check if it is working for you in the "OP". I would take the time to look through the links provided in the OP as well.
Orical said:
No, the kernel gives you a range of highest to lowest frequency range in which they are able to run. You tune the kernel to run at the frequency that you want it too so if you run the kernel at the highest frequency the phone will run fast but you will use the battery faster, if you tune the kernel to run slow the phone will run slower but your battery will last longer.
What your looking to do is adjust the kernel to the closest frequency to give you the best performance but low enough to continue to keep a long battery life.
Kernels run by using Governors, if you select "OnDemand" as your governor it will run what ever Highest frequency you set it for when ever your device is out of sleep mode, (Example: MAX 1836000 and Minimum 192000) when ever you put the device in sleep mode it will automatically run at the lowest setting. This conserves battery while you still use better performance when actually using the phone.
Hope this clears it up for you.
Click to expand...
Click to collapse
Lol. Thank you, but that's not what I meant. My kernel uses different frequencies. It has a range of 122000 to 203000. The numbers don't directly match up to the numbers in the OP, even in multiples of 54,000. See what I mean?
Sent from my HTC Glacier using XDA App
That was my point, your using MIUIs kernel it looks like, yes the kernel says 2.03 for the Max and 122 for the min the frequency in the output says 1188000 for the Max, that's what the daemon was preset too you go in and edit the files yourself. I first tested this before it was released on MIUI and it worked fine, look through and you'll find info on how to change the frequencies
Sent from my HTC Glacier using XDA App
Orical said:
That was my point, your using MIUIs kernel it looks like, yes the kernel says 2.03 for the Max and 122 for the min the frequency in the output says 1188000 for the Max, that's what the daemon was preset too you go in and edit the files yourself. I first tested this before it was released on MIUI and it worked fine, look through and you'll find info on how to change the frequencies
Sent from my HTC Glacier using XDA App
Click to expand...
Click to collapse
CM7 kernel. I'm obviously not making myself clear, so I'll just figure it out myself. Thank you for your help, though.
Sent from my HTC Glacier
Is there a smartass version or one being worked on?
Sent from my HTC Glacier using XDA App
estallings15 said:
CM7 kernel. I'm obviously not making myself clear, so I'll just figure it out myself. Thank you for your help, though.
Sent from my HTC Glacier
Click to expand...
Click to collapse
OK I'll put it like this..
The daemon your flashing is preset, you have to go in the files and change them to what ever frequencies your kernel is set for if you want them to work for the minimum and maximum settings.
I can't make you understand it, I hope you figure it out but personally before I do anything that could potentially be harmful to my device I read everything I can find before doing anything to it.
jayb222 said:
Is there a smartass version or one being worked on?
Sent from my HTC Glacier using XDA App
Click to expand...
Click to collapse
This is directly made from Virtuous Unity, the Governors associated are pretty much in every kernel release but the OP was mainly released for those interested in using the daemon it's self and it wasn't modified because there was no permission to do so.
Sorry about that though but I know Smokin isn't trying to step on any toes with this so that's why it remains as it was originally released.
Orical said:
change them to what ever frequencies your kernel is set for if you want them to work for the minimum and maximum settings.
Click to expand...
Click to collapse
That answered my question. Thanks buddy. I read the OP repeatedly and this isn't my first custom kernel or ROM. I crack flash like nobody's business. Drives my wife nuts. I'm no stranger to frequencies or voltages, but this is my first OC daemon. My confusion was in how specific the OP was in its frequency listing.
Sent from my HTC Glacier using XDA App
jayb222 said:
Is there a smartass version or one being worked on?
Sent from my HTC Glacier using XDA App
Click to expand...
Click to collapse
I edited the governor type file to smartass. Terminal output says smartass. Voila!
Sent from my HTC Glacier using XDA App
Just use the Viper app mentioned in the OP, it makes editing easier and much quicker, with a nice UI instead.
Ace42 said:
Just use the Viper app mentioned in the OP, it makes editing easier and much quicker, with a nice UI instead.
Click to expand...
Click to collapse
That's what I suggested before it was posted but I think it's important that people learn where all of the files are and how to edit the files and set the permissions for them.
Sent from my HTC Glacier using XDA App
I like the idea of this setup. It works well in Virtuous unity.
I know they have a GUI app that makes it easier to set this up. It would be great if we could get this daemon and GUI flashable for all ROMs.
The GUI app will probably need an auto detect CPU speeds function added for those that use custom kernels. Maybe we can talk to some of the overclock app devs (like the SetCPU dev) And see if we can get this functionality built into them.
It would be great if we could get this daemon in all ROMs and get the overclock app devs on board as well. As this app disables itself if there are overclock apps we would need them to be on board as those apps have so many other benefits (like profiles for low battery and the like) that I would hate to lose that as well. The apps could have the option to to enable or disable the daemon and then control it as well. The custom GUI app could be included in the ROMs for those that do not need or want to use the overclock apps.

SetCPU frequencies and govenor not sticking

Running MikG3.11 along with underworld0.8 kernel nohavs noUv:
SetCPU v3.0.7
Frequency and govenor will not stick after setting. Defaults back to smartassV2 or conservative DEADLINE after screen on/off or after a reboot. Any ideas?
lostsoul77 said:
Running MikG3.11 along with underworld0.8 kernel nohavs noUv:
SetCPU v3.0.7
Frequency and govenor will not stick after setting. Defaults back to smartassV2 or conservative DEADLINE after screen on/off or after a reboot. Any ideas?
Click to expand...
Click to collapse
Do you have another app, like system tuner, or rom toolbox, that has the settings for frequency and sheduler set for "set at boot"?
i.e...perhaps another app is changing it back
MIKESTONY said:
Do you have another app, like system tuner, or rom toolbox, that has the settings for frequency and sheduler set for "set at boot"?
i.e...perhaps another app is changing it back
Click to expand...
Click to collapse
Unless MIK placed something in the system/etc or in the init.d file. It only began doing this when I upgraded to the latest version of SetCPU. Not running system tuner; only running Gemini App which is a task manager and I have SetCPU marked as a Favorite so that it never gets killed. Only other thing I can think of is something in MikTweaks but I havent found any settings related to the frequency/schedulers, only memory settings and i'm using defaults.
Yeah, setCPU doesn't like to keep the CPU settings upon reboot. Just use NoFrills from the Play Store, it's free!
I agree with MBQ,No-Frills CPU is the best one out,its never givin me any problems mate.
6ANONAMUS9 said:
I agree with MBQ,No-Frills CPU is the best one out,its never givin me any problems mate.
Click to expand...
Click to collapse
Yep. It is the best IMO.
AND it's free

[Q]Governor Ondemand 19MHz min 600MHz max

Ive flashed the cake v1.2 kernel on my stock rom, and gives me the option to set the cpu to 19MHz min, ¿theres some evidence if this setting gives more battery life or something?
Thnx
frostwildfire said:
Ive flashed the cake v1.2 kernel on my stock rom, and gives me the option to set the cpu to 19MHz min, ¿theres some evidence if this setting gives more battery life or something?
Thnx
Click to expand...
Click to collapse
No. But the idea is something like that I think. If the phone goes to deep sleep it will be at 0mhz with any kernel. It may freeze if U change the governor ondemand.
Use cake 1.4 or .9. Later is far better tho.
finance.resat said:
No. But the idea is something like that I think. If the phone goes to deep sleep it will be at 0mhz with any kernel. It may freeze if U change the governor ondemand.
Use cake 1.4 or .9. Later is far better tho.
Click to expand...
Click to collapse
Thanx, by the way i like your work on EQDKP!

Cpu problem

My cpu is scaling to 900mhz, any one can help me to fix this at 300 mhz. I tried a lot of apps but nothing change, is there a tool to modify the cpu freq in the kernel ?
U hv to root ur phone and then install SetCPU...then set the min frequency as 300 mhz
prabhuinbar said:
U hv to root ur phone and then install SetCPU...then set the min frequency as 300 mhz
Click to expand...
Click to collapse
I tried a lot of cpu apps, look no frills cpu, set spu etc.. But nothing change, see the attachment
in general section there is a thread with Thermal Config to prevent lagging and overheating by ravinder003
Use that thermal config
SH3H1 said:
in general section there is a thread with Thermal Config to prevent lagging and overheating by ravinder003
Use that thermal config
Click to expand...
Click to collapse
I deleted the red lines in the thermal config too but now i just want to set my cpu min to 300, i juste want to modify the cpu freq in the kernel
What cpu frequency to set for gaming and also for battery saving
In No-frills Cpu set Governor to powersave and also go to nofrills cpu settings and check prevent changes from other apps.
However it may cause unexpected behaviour like hangs and slow down so better stay bit above of 300Mhz.
alok932 said:
In No-frills Cpu set Governor to powersave and also go to nofrills cpu settings and check prevent changes from other apps.
However it may cause unexpected behaviour like hangs and slow down so better stay bit above of 300Mhz.
Click to expand...
Click to collapse
I tried but the cpu freq is not changing in the scaling_min freq, cpu is min is always scaling on 900, thanks for reply
Ferhat78 said:
I tried but the cpu freq is not changing in the scaling_min freq, cpu is min is always scaling on 900, thanks for reply
Click to expand...
Click to collapse
Delete the thermal engine file. Then go to /sys/devices/system/cpu/cpu0/cpufreq/
There you'll see two files at the bottom ~ scaling_max_freq and scaling_min_freq
Change the values in them. See if it works.
EDIT: Seems like you already tried it.
alok932 said:
In No-frills Cpu set Governor to powersave and also go to nofrills cpu settings and check prevent changes from other apps.
However it may cause unexpected behaviour like hangs and slow down so better stay bit above of 300Mhz.
Click to expand...
Click to collapse
zTweaked said:
Delete the thermal engine file. Then go to /sys/devices/system/cpu/cpu0/cpufreq/
There you'll see two files at the bottom ~ scaling_max_freq and scaling_min_freq
Change the values in them. See if it works.
EDIT: Seems like you already tried it.
Click to expand...
Click to collapse
Thabks for reply, but i can change the value of the cpu min scaling, it's impossible to change, i changed but after a reboot a have always 900mhz min
Ferhat78 said:
Thabks for reply, but i can change the value of the cpu min scaling, it's impossible to change, i changed but after a reboot a have always 900mhz min
Click to expand...
Click to collapse
Check apply on boot in no frills cpu. However it wont always stay on 300 bcoz its based on performance. if you want it to stay near to 300 always then reduce max freq. If it still doesnt work and you are on miui then change your rom...Try using mokee rom.
alok932 said:
Check apply on boot in no frills cpu. However it wont always stay on 300 bcoz its based on performance. if you want it to stay near to 300 always then reduce max freq. If it still doesnt work and you are on miui then change your rom...Try using mokee rom.
Click to expand...
Click to collapse
Tried kernel tuner 2014 and now the cpu is scaling on 300, thanks for reply everybody, thanks a lot for yours answers kernel tuner work perfectly but no frills cpu or setcpu doesnt work perfectly look like kernel tuner

Is Redmi note 8 pro locked at 2 GHz normal?

i've been using this phone for about 2 years now and recently moved (about a few months ago) to using a custom rom (crdroid 7.1.2). it was running smooth and cool until day the clockspeed decided to lock itself at 2000 MHz (checked using cpu-z). I do not know if this is normal but the phone's temperature goes up to 36C on idle. i thought the problem was with the Lspeed app (+custom kernel) so i uninstalled it but it didn't work. I also factory resetting it, but still not luck. will updating the firmware resolve my issue? if not, what other available solutions are there?
have you thought about flashing the stock kernel ?
Fytdyh said:
have you thought about flashing the stock kernel ?
Click to expand...
Click to collapse
I have, but it still gets hot
do you use a case ? does your phone goes over 45 degrees celsius when charging ?
Fytdyh said:
do you use a case ? does your phone goes over 45 degrees celsius when charging ?
Click to expand...
Click to collapse
I do use a case, but hasn't been this hot before recently, and it does tend to hit 40C when charging
topsecretasian said:
I do use a case, but hasn't been this hot before recently, and it does tend to hit 40C when charging
Click to expand...
Click to collapse
If you are using Fast Charging, that heating is entirely normal (happens to me too)
But heating during idle is not normal. Try changing CPU governor to something else. (like schedutil or powersave)
Canny1913 said:
If you are using Fast Charging, that heating is entirely normal (happens to me too)
But heating during idle is not normal. Try changing CPU governor to something else. (like schedutil or powersave)
Click to expand...
Click to collapse
Do you know how to change cpu governor? I tried doing it last night but didn't find a whole lot of information. Schedutil seems to just set it all the way to 2ghz, so I want to change it to powersave
topsecretasian said:
Do you know how to change cpu governor? I tried doing it last night but didn't find a whole lot of information. Schedutil seems to just set it all the way to 2ghz, so I want to change it to powersave
Click to expand...
Click to collapse
use Rootify, select the CPU tab located at the top then change it.
The app sometimes gets stuck at Loading screen though.
Canny1913 said:
use Rootify, select the CPU tab located at the top then change it.
The app sometimes gets stuck at Loading screen though.
Click to expand...
Click to collapse
ok so it does work when i change the cpu govenor, but the only option that actually works is 'powersave' (as well as 'userspace'). all the other ones still sets it to 2GHz. 'userspace' seems to have a somewhat of an improvement but it's only setting everything to a constant value. is there a way have it set to balanced mode?
topsecretasian said:
ok so it does work when i change the cpu govenor, but the only option that actually works is 'powersave' (as well as 'userspace'). all the other ones still sets it to 2GHz. 'userspace' seems to have a somewhat of an improvement but it's only setting everything to a constant value. is there a way have it set to balanced mode?
Click to expand...
Click to collapse
powersave forces the processor to work in the lowest frequency availible, thus consuming less power.
userspace allows the app to set the CPU frequency whatever it wants. This isn't supposed to be used in Android since changing CPU speed thorough an app is super uncommon.
Others like ondemand normally keep the power low but starts using the higher frequencies if a processor intensive app is launched.
You can learn which governors do what in this post so you can set the most suitable one for you.
[REF][GUIDE]Saber's guide on CPU governors, I/O schedulers and more!
Collective guide of CPU governors, I/O schedulers and other kernel variables I present to you a wonderful collection of descriptions, comparisons and graphs of common kernel variables. Before continuing on the wonderful journey of Linux kernel...
forum.xda-developers.com
Canny1913 said:
powersave forces the processor to work in the lowest frequency availible, thus consuming less power.
userspace allows the app to set the CPU frequency whatever it wants. This isn't supposed to be used in Android since changing CPU speed thorough an app is super uncommon.
Others like ondemand normally keep the power low but starts using the higher frequencies if a processor intensive app is launched.
You can learn which governors do what in this post so you can set the most suitable one for you.
[REF][GUIDE]Saber's guide on CPU governors, I/O schedulers and more!
Collective guide of CPU governors, I/O schedulers and other kernel variables I present to you a wonderful collection of descriptions, comparisons and graphs of common kernel variables. Before continuing on the wonderful journey of Linux kernel...
forum.xda-developers.com
Click to expand...
Click to collapse
I see. Well I guess it does work as a solution.
Thanks for the help!

Categories

Resources