Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,737,563 Members 44,717 Now Online
XDA Developers Android and Mobile Development Forum

(CM7/MIUI) Screenstate, Governor and Threshold Control Script

Tip us?
 
well.heeled.man
Old
(Last edited by well.heeled.man; 5th June 2011 at 03:00 PM.)
#1  
Member - OP
Thanks Meter 22
Posts: 73
Join Date: Jan 2011
Default (CM7/MIUI) Screenstate, Governor and Threshold Control Script

Hi Folks,

For those who are interested, I have modified the 90screenstate_scaling script used in Zach's (and now Glitch's) kernel for use with other CM7 compatible kernels. The aim is to create a very simple script that can easily be read, modified and improved upon by non-coders, such as myself.

I have retained only the code that will read the screen state, set the governor appropriately and set the scaling threshold, giving users complete control over the scheduling behavior of their CM compatible kernel.

I am not a coder and all credit goes to FloHimself and zacharius.maladroit for the original content. all I have done is (hopefully) simplify the script and make it easy for non-specialists to read.

If you would like to try it out, copy the script in to /system/etc/init.d and modify the values to your liking. If you are already on Zach's kernel there is nothing new here, as you already have this script.

The script currently includes kernel defaults from Glitch for the smartass governor, from Zach for the conservative and ondemand governors, a few experimental settings, and of course, the ability to modify them yourself.

If you add anything or make any modifications (particularly in relation to your specific usage pattern) you would like to share, please post them and I will update this thread. If you make modifications, comment them appropriately and explain your usage pattern for which the settings work best so that people know if it would work for them.

The experimental conservative settings that I have made (that are currently in use on Glitch kernel) for the screen off state are designed to aggressively keep the frequency very low, almost like a 100mhz frequency cap, while still allowing them to scale up under considerable load. They are (hopefully) ideal for background screen off behaviour such as listening to music, exercise applications or aggressive sync and push/pull email behavior (like in an office).

The experimental smartass settings are designed to test the hypothesis that quick downscaling may cause as many lags as as slow scaling up behavior. The goal is to create a more linearly scaling version of smartass which is slower to upscale or downscale (only a matter of milliseconds difference). These are still under testing.

With one of the main reasons for using smartass as a single governor, the min/max frequencies for the screen on/off state no longer applicable with the governor changing in relation to the screen state, I have moved to ondemand settings, which may have battery implication while the screen is on, but they are VERY smooth.
Attached Files
File Type: zip 90kernelcontrol.zip - [Click for QR Code] (1.8 KB, 170 views)
Samsung Galaxy S

Please take a look at the 'screenstate, governor and threshold control script', for those of you who want more control over the behavior your CM7 compatible kernel!
The Following 3 Users Say Thank You to well.heeled.man For This Useful Post: [ Click to Expand ]
 
zacharias.maladroit
Old
#2  
zacharias.maladroit's Avatar
Retired Recognized Developer
Thanks Meter 2180
Posts: 2,930
Join Date: Oct 2010
Location: Vienna

 
DONATE TO ME
*subscribes*

we could probably make conservative governor more aggressive

with the settings that laststufo used on his kernel but I'm not sure if it would scaled up fast enough if you used e.g. some DSP settings on sound while the screen is off

worth as shot

if I don't forget it - I'll post the settings later
development-mode: occasional (as time permits); Status: currently "retired"

Seasons Greetings to everyone and thank you for everything !

Kernels:
TalonDev (for Samsung stock ROMs, SGS/i9000, Captivate)



* for GT-i9000/Telus-Fascinate * for Captivate * for Vibrant


<-- Like my work ? buy me a beer

Please press thanks button if my post was helpful and/or useful to you, get me more dropbox space by signing up - Thanks !
The Following User Says Thank You to zacharias.maladroit For This Useful Post: [ Click to Expand ]
 
Tk-Glitch
Old
#3  
Tk-Glitch's Avatar
Recognized Developer
Thanks Meter 3034
Posts: 1,413
Join Date: Mar 2011

 
DONATE TO ME
Subscribes too

I like the idea and the simplicity of this. And with Zach's help, also known as "F*ckin scripts master" (almost a private joke ), it can only be great.
Samsung GT-i9000 - Glitch Kernel - CPU @ 1.5GHz - GPU @ 250MHz
Samsung GT-i9300 - Glitch Kernel - CPU @ 1.7GHz - GPU @ 733MHz
Samsung GT-i9505 - Glitch Kernel - CPU @ 2.1GHz - GPU @ 627MHz
Asus Flo (N7 2013) - Glitch Kernel - CPU @ 2.0GHz - GPU @ 627MHz
The Following User Says Thank You to Tk-Glitch For This Useful Post: [ Click to Expand ]
 
well.heeled.man
Old
(Last edited by well.heeled.man; 20th May 2011 at 01:31 AM.)
#4  
Member - OP
Thanks Meter 22
Posts: 73
Join Date: Jan 2011
I'm a big fan of simple, though as a user of Arch Linux on the desktop I have no choice (BSD style init scripts a boot - beautiful simplicity)!

It's great you lads are watching this! Hopefully the thread will grow in to something, even if it is just an sandbox for users to experiment with the settings they prefer. If nothing else, hopefully you guys get some useful info!
Samsung Galaxy S

Please take a look at the 'screenstate, governor and threshold control script', for those of you who want more control over the behavior your CM7 compatible kernel!
 
well.heeled.man
Old
#5  
Member - OP
Thanks Meter 22
Posts: 73
Join Date: Jan 2011
I just added a bit of an experimental version that moves away from the default smartass values.

I am hypothesizing that the very accasional lags in the smartass governor might be related to the governor scaling down too fast, rather than it not scaling up fast enough.

I changed the default down threshold from 40 to 35 and the default up threshold from 60 to 65. Hopefully this will scale up and down a little more linearly and this will make the GUI even smoother. I am still testing this theory at the moment, but thought I might post it (on the first post) if anyone wanted to have a go.
Samsung Galaxy S

Please take a look at the 'screenstate, governor and threshold control script', for those of you who want more control over the behavior your CM7 compatible kernel!
 
zacharias.maladroit
Old
#6  
zacharias.maladroit's Avatar
Retired Recognized Developer
Thanks Meter 2180
Posts: 2,930
Join Date: Oct 2010
Location: Vienna

 
DONATE TO ME
well.heeled.man,

you need to test your conservative settings while the screen is on

they're way too aggressive (at least the up threshold, down threshold may be ok)

also the freq_step at 10% should be at least at 15%


if we compare it with laststufo's kernel (he almost had 100 MHz steps everywhere: 100, 200, 400, 600, 800, 900, 1000 MHz)

so that needs to be compensated to get smoother & similar behavior


I'll take a look & see how the new smartass settings work out






my new conservative settings are:

echo "76" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold # 50 # 76 # 76
echo "30" > /sys/devices/system/cpu/cpufreq/conservative/down_threshold # 35 # 12 # 30 (higher will lead to noticable lags) # 35
echo "15" > /sys/devices/system/cpu/cpufreq/conservative/freq_step # more aggressive ramping up (50)


this currently keeps the cpu between 100-200 MHz while playing MP3s for me (screen off) - mostly 200 afaik right now


but I'll try your conservative settings, too, when I find time - let's see how they are in terms of "smoothness" (I'm sure they're not too usable with the GUI but could be great for background tasks while the screen is off)
development-mode: occasional (as time permits); Status: currently "retired"

Seasons Greetings to everyone and thank you for everything !

Kernels:
TalonDev (for Samsung stock ROMs, SGS/i9000, Captivate)



* for GT-i9000/Telus-Fascinate * for Captivate * for Vibrant


<-- Like my work ? buy me a beer

Please press thanks button if my post was helpful and/or useful to you, get me more dropbox space by signing up - Thanks !
 
well.heeled.man
Old
#7  
Member - OP
Thanks Meter 22
Posts: 73
Join Date: Jan 2011
Hi Zach, indeed, I would say that the conservative settings are completely unusable with the screen on. I would not recommend these with the screen on.

However, with music (DSP manager too) GPS and Cardio Trainer all running (my cycle home), it seems to work fine (screen off). Every km, Cardio trainer speaks the time taken over the music (two audio streams). With many kernels this becomes slow, or slurred, but sounds perfect with these settings.
Samsung Galaxy S

Please take a look at the 'screenstate, governor and threshold control script', for those of you who want more control over the behavior your CM7 compatible kernel!
The Following User Says Thank You to well.heeled.man For This Useful Post: [ Click to Expand ]
 
zacharias.maladroit
Old
#8  
zacharias.maladroit's Avatar
Retired Recognized Developer
Thanks Meter 2180
Posts: 2,930
Join Date: Oct 2010
Location: Vienna

 
DONATE TO ME
Quote:
Originally Posted by well.heeled.man View Post
Hi Zach, indeed, I would say that the conservative settings are completely unusable with the screen on. I would not recommend these with the screen on.

However, with music (DSP manager too) GPS and Cardio Trainer all running (my cycle home), it seems to work fine (screen off). Every km, Cardio trainer speaks the time taken over the music (two audio streams). With many kernels this becomes slow, or slurred, but sounds perfect with these settings.
awesome !

so it still raises the frequency when needed ?

100 -> 200 (or more)

you checked via e.g. CPU Spy ?


thanks !
development-mode: occasional (as time permits); Status: currently "retired"

Seasons Greetings to everyone and thank you for everything !

Kernels:
TalonDev (for Samsung stock ROMs, SGS/i9000, Captivate)



* for GT-i9000/Telus-Fascinate * for Captivate * for Vibrant


<-- Like my work ? buy me a beer

Please press thanks button if my post was helpful and/or useful to you, get me more dropbox space by signing up - Thanks !
 
well.heeled.man
Old
(Last edited by well.heeled.man; 22nd May 2011 at 12:37 AM.)
#9  
Member - OP
Thanks Meter 22
Posts: 73
Join Date: Jan 2011
Yes, it still goes up when needed (confirmed via CPU Spy), but it needs to be really pushed. It seems like good behaviour in the screen off state.

EDIT: something in the region of a 66%/33% 100/200mhz split at these settings.
Samsung Galaxy S

Please take a look at the 'screenstate, governor and threshold control script', for those of you who want more control over the behavior your CM7 compatible kernel!
The Following 2 Users Say Thank You to well.heeled.man For This Useful Post: [ Click to Expand ]
 
well.heeled.man
Old
#10  
Member - OP
Thanks Meter 22
Posts: 73
Join Date: Jan 2011
I am struggling to confirm that my settings are being applied as I would like in the screen off state. I can read off the values in /sys/devices/system/cpu(/cpu0)/cpufreq/conservative if I manually set conservative in Pimp My CPU with the screen on, but the behaviour seems at odds with the values i.e. not as laggy as one would suspect.
Samsung Galaxy S

Please take a look at the 'screenstate, governor and threshold control script', for those of you who want more control over the behavior your CM7 compatible kernel!

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes