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

Search This thread

well.heeled.man

Senior Member
Jan 6, 2011
73
22
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.
 

Attachments

  • 90kernelcontrol.zip
    1.8 KB · Views: 191
Last edited:

Tk-Glitch

Inactive Recognized Developer
Mar 24, 2011
1,666
4,356
Subscribes too :D

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 :p), it can only be great.
 
  • Like
Reactions: jeebspawnshop

well.heeled.man

Senior Member
Jan 6, 2011
73
22
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!
 
Last edited:

well.heeled.man

Senior Member
Jan 6, 2011
73
22
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.
 

zacharias.maladroit

Recognized Developer
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)
 

well.heeled.man

Senior Member
Jan 6, 2011
73
22
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.
 
  • Like
Reactions: zacharias.maladroit

zacharias.maladroit

Recognized Developer
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 !
 

well.heeled.man

Senior Member
Jan 6, 2011
73
22
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.
 
Last edited:

well.heeled.man

Senior Member
Jan 6, 2011
73
22
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.
 

well.heeled.man

Senior Member
Jan 6, 2011
73
22
As (a variation of) this script are now used in Glitch's too, I have changed the comments to allow people to very easily see which settings are from kernel devs (which should probably be left alone should you wish to return to their defaults) and experimental settings (which I would suggest you change, if you change any). If you want to use parts of it in Zach's, I would suggest cutting and pasting the experimental part into the appropriate part of Zach's script as overwriting any part of it would remove much of his additional functionality.
 

well.heeled.man

Senior Member
Jan 6, 2011
73
22
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 by default. This may have battery implication while the screen is on, but they are VERY smooth.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    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.
    2
    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.
    1
    *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
    1
    Subscribes too :D

    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 :p), it can only be great.
    1
    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.