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

Search This thread

AnDyX

Senior Member
May 27, 2008
195
452
Ruda Śląska
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.

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!

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
 

Attachments

  • ax8_smartass_v001.zip
    5 KB · Views: 1,098
  • ax8_smartass_v002.zip
    5.2 KB · Views: 4,085
  • ax8_smartass_x10mini_v002.zip
    5.2 KB · Views: 247
  • ax8_smartass_x10minipro_v002.zip
    5.2 KB · Views: 547
Last edited:

firdausmbois

Senior Member
Jan 7, 2011
208
112
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?
 
Last edited:

biscoitu

Senior Member
Apr 26, 2011
678
146
Downloading to make some tests :p
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
 

AnDyX

Senior Member
May 27, 2008
195
452
Ruda Śląska
Downloading to make some tests :p
As I can see it is a custom CPU governors, like one "Do it yourself" :)

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".

I will test it now and I let know how it compares to 'ondemand' tomorrow.
 

doixanh

Inactive Recognized Developer
Jan 23, 2011
1,263
5,314
Nice module AnDyX :) I'm gonna check it. Did you have to hijack many calls?
 

lukewong01

Senior Member
May 17, 2011
317
13
AndyX...Is this an AI SetCPU??....when we push it to out phone..it will auto config or we config ourself?
 

Aashrey99

Senior Member
May 26, 2011
451
167
Hyderabad
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! :D
 

wujekandrzej

Senior Member
Mar 1, 2011
109
20
Very nice Andy! Apparently we found ourselves a new Module Man :D

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 :D
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) :p
 
  • Like
Reactions: afifrohiki

deedii

Senior Member
May 25, 2011
1,647
963
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?
 

DeFcOn

Senior Member
Jun 21, 2011
756
221
Győrszemere
this thing works well!:D 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!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 44
    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.

    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!

    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
    2
    Can anyone compile it to mini / mini pro ? 10Q !

    already added in 1st post
    2
    PS: It is better to have DSP, the sound is so good, but more importantly saving battery is great. So when i what sounds that pumps my heart fast ill switch to ondemand then switch back to smartass on daily use. I know you will figure this out so we can use dsp again with smartass. :)

    Sent with love!

    DSP eats your battery faster :) If you really want to use 'smartass' and DSP try to set higher value for:
    Code:
    echo "320000"  > /sys/devices/system/cpu/cpu0/cpufreq/smartass/sleep_max_freq
    or
    Code:
    echo "480000"  > /sys/devices/system/cpu/cpu0/cpufreq/smartass/sleep_max_freq

    Better solution is to use any player with EQ buildin, I just quickly look and found following:
    - PowerAMP - not free but power full : PowerAMP
    - MixZing - there is free version on market too: MixZing.

    I check trial of PowerAMP and MixZing from market and works fine with EQ set to ON. Both contains EQ better then DSP.
    2
    just need a little guidance, im using froyobread v020, oc module and smartass v2 set with setcpu, main profile using on demand governor and screen off profile using smartass governor. is this ok or need tweaking?:confused:

    There is no sense to use 'smartass' governor only for 'ScreenOff' profile.

    'smartass' governor is replacement for SetCPU when is used only for 'ScreenOff' profile.
    You can disable profiles in SetCPU, set 'smartass' as default governor, set it in CM settings and after that check if you are happy while using only 'smartass' governor.

    I don't use SetCPU now and if I remember correctly in CM settings there is settings for max CPU freq too.
    2
    I don't see the point using this module.
    I used it for quite a while, but noticed no difference in terms of battery consumption or performance. In stead, it seems to be not working with background music playing. That being said, if I play some AAC files and then turn off the screen, the playback would be sluggish and broken. MP3 playback seems to be fine. So I switched back to ondemand.

    I'm not in good mood today - I click 'Thanks' instead of Quote .....

    Do you use equaliser/DSP Manager ??