[TUT] Tasker CPU Control V5|Frequency/Governor Customisable Profiles|SetCPU with OCD

Search This thread

brandall

Senior Member
May 16, 2008
2,679
5,222
Birmingham
INSTALLATION INSTRUCTIONS ADDED TO POST #2

For those of you not familiar with Tasker, it’s a pretty damn amazing application that works toward fully automating your Android phone.

You can pick up a free trial version from here.

This thread is to show, assist and learn (from your input) how to fully utilise the newly introduced CPU controls, with the ultimate goal of preserving battery life without using additional applications such as SetCPU or other power saving scripts. This may look like a beast of a tutorial, but it really doesn't take that long to set up. Honest...

Tasker can be a little daunting at first, but a quick read through the manual, some tweaking of the profiles and step-throughs on the Tasker wiki and you’ll be up to speed in no time.

In order to control the CPU, you’ll need a rooted device and a compatible kernel. A quick acronym lesson can be found here. In brief, you require the following Governors (or as many of them as you can get!):

Performance (keeps the CPU frequency always at the maximum. Most power-hungry, most responsive)
Ondemand (when the CPU is needed, immediately sets it to maximum frequency. Slowly reduces the frequency back down to the minimum as time passes. Responsive, reasonable power usage).
Interactive (like Ondemand, but more responsive with slightly more battery usage)
Conservative (when the CPU load is needed, slowly increases the frequency to maximum. When the CPU is no longer needed, immediately drops back to the minimum. Less power-usage than Ondemand or Interactive, less responsive).

If there isn’t such a kernel for your device, then I can only suggest you beg and plead with a Dev in your device’s forum!

You can check the following in a file explorer to see your available frequencies and governors of your current/updated Kernel:
sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors


I have a Desire and am running an Oxygen AOSP ROM. I’m therefore using vorkKernel detailed here. There’s a detailed breakdown in the first post of that thread showing the kind of kernel you’re looking for.

WARNING! DO NOT ENABLE THE PROFILES UNTIL YOU HAVE DOUBLE CHECKED THEY DO NOT EXCEED YOUR PHONE’S CAPABILITIES!! I TAKE NO RESPONIBILITY IF IT SETS ON FIRE! BE CAUTIOUS TO BEGIN WITH. IF THE AVAILABLE FREQUENCIES I DETAIL ARE NOT IN YOUR KERNEL, USE YOUR COMMON SENSE AND APPLY SIMILAR ONES! Ok? Right, ready to blow your phone up…? Just kidding….! Maybe….

Before you import the profiles, make sure you disable/archive/uninstall SetCPU or any other similar applications or scripts that could take precedent over the CPU control.

You’ll also need a couple of tools to see/hear your progress at a glance/listen:

A widget that shows CPU frequency, with regular refresh intervals would be handy. (If you don’t have one, I suggest you use Process Monitor available for free on the market here . The widget refreshes every 5 seconds from the home-screen).

As they’ll be some ‘screen-off’ states, it's very useful to have a speech engine so you can be told what’s happening without having to turn the screen on and therefore changing the state! (I use Pico TTS)

The application CPU Spy can be helpful to show you how these profiles combined with the Data Sync profiles will increase the amount of time your device will be spending in 'deep-sleep' and at lower frequencies. Thanks leftAlone for pointing this app out.

In Tasker, the main triggers for the CPU controls are as follows:

Display Off
Display On
Battery Low
Battery Hot
Phone Charging
In call
(added in V2)
End Call (added in V2)
Initial Boot (added in V2)
Application Launched (added in V2)

In my set-up, these triggers become intertwined as there is often more than one active state to consider. Here we go....

READ THE REST OF THIS POST, BUT INSTALL WITH INSTRUCTIONS FROM POST TWO!

The speech profile (CPU-SayState) is the first one to download – it’s set up to tell you every 5 minutes (in very clear English), your frequency and governor. Not only will this confirm that your screen-off state is working correctly by just listening, but when you are performing other routine tasks, it will alert you if for some reason you find yourself overclocking/underclocking when you don’t want to be and you'll know something is wrong (the alternative to this is good old fashioned log files).

Next, CPU-BatteryHot. It's stand alone. You’ll see that the ‘Event’ is simply ‘Battery Overheating’. If this event occurs, then the governor is set to conservative and the frequencies to 245 and 422,400. Let’s be honest, if you do have an overheating battery, you’re more likely to panic and put the phone in the fridge rather than rely on this profile to resolve it, but it’s a simple start and provides a useful notification should this ever occur.

Next, CPU-DisplayOff. This is a good chance to save some battery life. The event is ‘screen off’ and the task sets a tiny vibrate notification so you’ll know it’s applied whilst the screen is off. An icon will be present in the status bar when you turn the screen back on. Conservative governor and frequency of 245 and 384. You of course should tweak these to whatever you wish - that's the point of this! The other tasks within the profile are removing the notification of other CPU profiles that may have been active prior to the screen turning off.

Next, let’s set up CPU-BatteryLow. It’s relatively stand alone again, triggered by an event of the ‘battery level’ being less than 25%. Conservative governor, with frequencies of 245 and 499,200 with an added IF statement at the bottom confirming the battery level. A popup on the screen will tell you the battery is low, which will go away on its own or can be pressed to dismiss. All other notifications of previous states are cancelled and finally a ‘stop’ is applied IFthe battery goes above 35%. At this point a task is performed that matches the governor and frequency of what will be your ‘regular ***’ CPU settings (again, these should be whatever you wish). This will end once the screen is turned off so the profile returns to CPU-DisplayOff.

Next, CPU-ChargingAny. Triggered by the 'power' state, the first task checks the battery level being above 50%. If it isn’t, an interactive governor is applied (to concentrate on charging), if it is, a performance governor is applied pushing the frequency up to 1075200. A status bar notification/icon and a vibrate pattern alert you that you are overclocking. Other notifications are killed.

Now we have to look at cancelling the overclocking once the phone is no longer charging/on external power. This isn’t totally straight forward, as the preferable states (inverted) of ‘no usb connected’ or ‘battery not charging’ relate to most of the time you use your phone.

The answer is to use an ‘exit task’, which will activate once the current state no longer applies e.g. the charge is removed. At this point, we need to check the current state of the phone, by applying tasks in order of their priority. The first task checks if the screen is off (therefore assuming the phone is no longer being used). If it is, it applies the DisplayOff profile. Secondly, if the battery level is now greater than 25%, it applies the DisplayOn profile (shown below). Finally (assuming the other two tasks states were not true), it applies the BatteryLow profile. The current task is instructed to ‘stop’ once a true state is found.

Finally, CPU-DisplayOn. The event is of course ‘display on’ and it applies the governor and frequencies that you would consider your ‘regular profile***’ for your normal phone usage. For me this is interactive with frequencies of 245 and 998,400. It of course first checks that the battery is not less than 25%, otherwise the BatteryLow profile would have already been activated and should be left to do so. A status notification and the killing of existing notifications is included at the end.

You’ll need to create a manual ‘regular profile’ (mine is called CPU-InteractiveManual in the .zip folder) that you can leave unchecked. This is named to match the *** above. It’s also there in case circumstances require you deactivate all of the other profiles and just run your regular profile (because you want to).

Very finally (!), I have a manual MaxOverclock profile, which I activate when I’m going to be using certain applications – A ROM Emulator for example.

Added in Version 2

CPU-DeviceBoot. I noticed that the Kernel I'm using boots as standard using a conservative governor (this surprised me a little) and overclocking to max frequency (I assume to help boot speed). This profile waits 30 seconds on initial boot and then checks the phone state before applying the correct profile from above.

CPU-DuringCall. During a call, my proximity sensor turns the screen on and off. When inputting numbers on a call (Voicemail for example), this caused the CPU-DisplayOff and CPU-DisplayOn profiles to be constantly flicking on and off unnecessarily. This profile deactivates all CPU profiles until the call is finished.

CPU-EndCall. Once the call is finished, the profiles are activated once again.

An obvious way (so obvious I previously didn't include it) to preserve battery life is to set individual CPU profiles for individual applications. Tweaking of these if you suffer lag, will help you find the minimal settings for each application.
 
Last edited:

brandall

Senior Member
May 16, 2008
2,679
5,222
Birmingham
STEP-THROUGH INSTRUCTIONS

With Tasker currently ristricting the import of CPU actions, I've had to strip them out of the profiles, meaning you have to add them in manually for the time being. Shouldn't take too long... Follow these instructions:

Download the latest 'Tasker CPU Profiles STEP-THROUGH.zip' and Unzip the profiles into sdcard/Tasker/profiles - Import them individually from the menu options. There should be 11:

CPU_BatteryHot
CPU_BattertLow
CPU_ChargingAny
CPU_DeviceBoot
CPU_DisplayOff
CPU_DisplayOn
CPU_DuringCall
CPU_EndCall
CPU_InteractiveManual
CPU_MaxManual
CPU-SayState


There is one additional stand-alone task:

MTVar

Ensure they remain unchecked until we've added all of the CPU activities below.

Before applying your custom CPU profiles, it would be highly recommended that you observe your current kernel's/ROM's/device's behaviour using home-screen widgets and the speech task included. My device (Desire), has custom kernels that use different governors to get the best performance out of the device. Please understand which governor(s) your kernel dev has focused on and if the voltage and/or governor(s) are changed in certain states. This will be well documented in your Kernel thread.

Overclocking

Please be more than aware that overclocking your device is not without its risks. Within the profiles Overclocking will occur only when the screen is on, the device is on charge and the battery is above 50% to ensure this is intentional. Should your screen go off, you will have to manually restart overclocking by unplugging and replugging the charger. Using a 'Performance' governor, will increase the CPU frequency to the maximum available and remain at that level. This is unecessary unless you are using a particularly high resource application such as a ROM emulator. Using an alternative governor that allows maximum frequency when required, but does not remain there when not, should be considered.

Instructions

The CPU settings have been replaced by actions entitled 'Type'. The text says 'Insert Frequency and Governor here'. In addition, they may be instructions to tick the 'IF' statement and add the values included in the text. Remove the 'Type' entries as you go, replacing them with the following suggested entries:

(CPU action entries are contained under 'Misc'
Select Edit
Press +
Select Misc
CPU)

Tap CPU-DisplayOn
Tap on CPUDispOn - Replace action #6 | Interactive | 128,000 | 998,400

Tap CPU-DisplayOff
Tap on CPUDispOff - Replace action #7 | Conservative | 128,000 | 245,000

Tap CPU-BatteryLow
Tap on CPUBatLow - Replace action #2 | Conservative | 128,000 | 998,400

Tap CPU-ChargingAny
Tap on CPUCharg - Replace action #2 | Interactive | 128,000 | 998,400
Replace action #3 | Performance | 128,000 | 1,075,200

Tap CPU-BatteryHot
Tap on CPUBatHot - Replace action #1 | Conservative | 128,000 | 422,400

Tap CPU-InteractiveManual
Tap on CPUManual - Replace action #1 | Interactive | 998,400 | 128,000

Tap CPU-MaxManual
Tap on CPUMaxMan - Replace #1 | Performance | 128,000 | 1,075,200

----------------------------------------------------------------------
Enable all APART FROM CPU-MaxManual and CPU-InteractiveManual, click 'On', then apply and turn the screen off and on and you should be up and running!

I assume you'll need to add your own icons in to each of the notifications.
-----------------------------------------------------------------------
Minimalistic Text Widget

Also included in the tasks and the V5 download is a profile for Minimalistic Text showing the Tasker variables all of my profiles use. Drag it into the Minimalistic Text folder on the SD card and it will be there in the preference manager. It you don't use all of my other profiles (why the hell not?!) you can delete the entries that are not applicable to you. My other profiles are in my signature btw. I've no idea where my signature is though... Not using Minimalistic Text?? It's a great low resource home-screen widget with Tasker integration. Check out the XDA thread here

I DON'T WISH TO USE THE MINIMALISTIC TEXT PLUGIN!

Then delete the following 'Perform Task MTVar' entries:

CPUDispOn - Action #9
CPUDispOff - Action #14
CPUCharge - Action #10
CPUBatLow - Action #8
CPUEndCall - Action #2
CPUBatHot - Action #6
CPUManual - Action #5
CPUMaxMan - Action #5
 
Last edited:

brandall

Senior Member
May 16, 2008
2,679
5,222
Birmingham
Conclusion

I’ve never used so much battery working these out!! It may well be that the amount of tasks, or the way they are structured, actually uses more battery life than controlling the CPU could save. I’ll be running some tests over the coming days to monitor it. If that does prove to be the case, I'll still be glad I’ve done this and learnt more about this fantastic application and look forward to it making me even more lazy.

Let me know your feedback please folks, inconsistencies, errors, I’m all ears and feel free to use the 'thanks meter'

Battery life:
Without brandall's profiles: ~9hrs
With brandall's profiles: ~16hrs!

my batterylife has GREATLY improved!
Without tasker: 10h 21% left, with tasker: 15h 67% left..!

Since using your profiles, I haven't had to charge my battery in 23 days and I'm having much better sex with my wife! Thanks!


FAQ

Q) I'm getting missing plug-in errors on V5? What do I do?
A) Read the bottom of post #2 and delete the Minimalistic Text actions if you do not wish to use it.

Q) Which profiles do I leave unticked and ticked again??
A) See this post

Q) I get a CPU Action Not Available error - why?!?
A) See the bottom of this page (thanks wanfauzan)

Q) Why doesn't Overclocking start again when the display is turned on and the phone is on charge?
A) Best solution see here. Credit Matrix72

Q) The icons you use are rubbish. How do I use my own?
A) See this post

Q) I have many other Tasker questions, can I post them here??
A) To avoid clutter, probably best to use this official Google group

Q) My phone is sluggish when the 'battery low' profile is active.
A) Be cautious, but adjust the frequencies and maybe governor until you find the perfect settings for your phone.

Change Log

Code:
[B][U]V2[/U][/B]
Added [B]CPU-DuringCall[/B] profile to V2 .zip
Added [B]CPU-EndCall[/B] profilie to V2 .zip
Added [B]CPU-DeviceBoot[/B] profile to V2.zip
Changed how [B]CPU-DisplayOn[/B] behaves when battery level low
Changed how [B]CPU-ChargeAny[/B] behaves when battery is less than 50%. Also added sound effect and matching vibrate pattern because I'm childish. 
Added wait task to [B]CPU-BatteryLow[/B] until charge reaches 35%
Added [B]CPU-Navigation[/B] example profile to V2 .zip
Changed how cancelled notifications are handled for aesthetic reasons. 

[B][U]V2.1[/U][/B]
Added missing IF statement to vibrate pattern of 'Overclocking' on [B]CPU-ChargeAny[/B]

[B][U]V2.2[/U][/B]
Changed collision handling of [B]CPU-BatteryLow[/B] to consider wait task

[B][U]V3[/U][/B]
Updated [B]CPU-DuringCall[/B] to create an 'in call' variable ([B]%INCALL[/B]), that can be used in other tasks.
Updated [B]CPU-EndCall[/B] to create an 'in call' variable ([B]%INCALL[/B]), that can be used in other tasks.
Changed notification handling to include specific titles, so not to cancel notifications of other Tasker profiles.
Removed Overclocking Sound and chilled the vibrate pattern.

[B][U]V4[/U][/B]

The below update [COLOR="Red"]*REMOVED AS IN V5*[/COLOR] prevents the quick screen off/screen on changes between [B]CPU-DisplayOff[/B] and [B]CPU-DisplayOn[/B] which can cause lag and echo errors. This was a headache to resolve due to too many reasons to list, but I've resolved it by adding a 5 second wait before the display off CPU settings are applied - if within that 5 seconds you turn the screen back on, the display off settings will not apply, consequently neither will the display on settings reapply. Someone needs to donate me some paracetamol... 

It's achieved with an additional variable [B]%CPUSS[/B] (CPU sleep state) which is set to a value of 1 within the 5 second wait and a value of 2 after (once the CPU screen off settings have applied). This way, the CPU display on settings know whether to activate, or they remain active and therefore don't reapply.... 

[B][U]V5[/U][/B]

* So many I've forgotten them all.... Oops!

Bugs

All totally fixed in V5 (I hope).

Feature Requests

Consider states for 'smartass' governor.

Thanks

torsrex - Risking device and limb testing
-----------------------------------------------------------------------------------------------------

Due to the amount of changes, there is no 'step-through' update for users of the lower versions. Delete the profiles you have and it's a lightening quick addition of the CPU entries from post #2!

------------------------------------------------------------------------------------------------------

The thanks meter lets me know I'm appreciated! :eek:
 
Last edited:

harmohn

Senior Member
Jan 18, 2010
379
42
London
I've used a lot of battery working out similar profiles myself ;)

Will have to check yours out when I get home. Having voice overs for frequency and governor is a good addition! :)
 

enotar

Senior Member
Jun 23, 2010
1,503
496
Samsung Galaxy Tab S4
Redmi Note 9 Pro
I used CPU control with tasker and since then I uninstalled SetCPU that was a great soft but Tasker give me so much freq control for each application.
Example Book reader don't need the full juice and you can set automaticaly a low frequency.

Tasker is a great tool.
 

brandall

Senior Member
May 16, 2008
2,679
5,222
Birmingham
I've used a lot of battery working out similar profiles myself ;)

Will have to check yours out when I get home. Having voice overs for frequency and governor is a good addition! :)

Since I've stopped playing around quite so much, my battery life does seem to have improved! Could be just wishful thinking though...

I used CPU control with tasker and since then I uninstalled SetCPU that was a great soft but Tasker give me so much freq control for each application.
Example Book reader don't need the full juice and you can set automaticaly a low frequency.

Tasker is a great tool.

I've added an example of setting the CPU profiles for individual applications just in case.

Let me know your feedback! I assume no news is good news!? V2 updated in change log.
 
  • Like
Reactions: ttamirt

goz5000

Senior Member
Sep 8, 2010
123
15
I get error trying to import any of your profiles, I'm I doing something wrong??
 
Last edited:

goz5000

Senior Member
Sep 8, 2010
123
15
import failed, task contains actions unsuitable for import.

I got cpu end call, cpu device boot, and cpu during call to import but the others will not.

I'm using the vork kernel on CM7
 

brandall

Senior Member
May 16, 2008
2,679
5,222
Birmingham
import failed, task contains actions unsuitable for import.

I got cpu end call, cpu device boot, and cpu during call to import but the others will not.

I'm using the vork kernel on CM7

You're absolutely right - I just tried to import them myself and got the same result! Ok... I'll find out what's causing the problem...
 

Syndacate

Senior Member
Mar 8, 2011
291
16
36
Rochester, NY
Wow, I don't know much (anything) about the app, but I'm surprised you're allowed the level of control over the OS from userland like this without root privileges.
 

brandall

Senior Member
May 16, 2008
2,679
5,222
Birmingham
import failed, task contains actions unsuitable for import.

I got cpu end call, cpu device boot, and cpu during call to import but the others will not.

I'm using the vork kernel on CM7

Tasker didn't allow the import of the CPU actions. For now, a step-through guide is added to post two to get these working. Please download the new .zip file.

Your feedback would be appreciated.
 

soloxp

Senior Member
Jun 18, 2007
328
13
Adjust the following profiles as follows:

Tap CPU-DisplayOn
Tap on INT DISP ON
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Tick IF
Click on lable icon, select Battery Level
Click on '-' select Maths:Greater Than
Enter 25 in box
Done
Drag to position 3
Done

Tap CPU-DisplayOff
Tap on CPU CON 384/245
Select Edit
Press +
Select Misc
CPU
conservative
245000
384000
Done
Drag to position 1
Done

Tap CPU-BatteryLow
Tap on CPU CON 254/499
Select Edit
Press +
Select Misc
CPU
conservative
245000
499200
If
Click on lable icon, select Battery Level
Click on '-' select Maths:Less Than
Enter 25 in box
Done
Drag to position 1
Click on tools icon - ensure Collision Handling is set to 'Abort Existing Task'
Done

Tap CPU-ChargingAny
Tap on CPU PER 998
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Tick IF
Click on lable icon, select Battery Level
Click on '-' select Maths:Less Than
Enter 50 in box
Done
Drag to position 1
Press +
Select Misc
CPU
performance
245000
1075200
If
Click on lable icon, select Battery Level
Click on '-' select Maths:Greater Than
Enter 50 in box
Done
Drag to position 2
Ensure the Carstart.wav (included in the .zip) is selected (if you want it) under 'Music Play' - Otherwise just delete the entry.
Done

Tap CPU-BatteryHot
Tap on CPU CON 422/245
Select Edit
Press +
Select Misc
CPU
conservative
245000
422400
Done
Drag to position 1
Done

Tap CPU-InteractiveManual
Tap on CPU INT 245/998
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Done
Drag to position 1
Done

Tap CPU-MaxManual
Tap on CPU-MAX
Select Edit
Press +
Select Misc
CPU
performance
245000
1075200
Done
Drag to position 1
Done

Tap CPU-Navigation
Tap on CPU-NAV 245 998
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Done
Drag to position 1
Done
Tap on CPU INT 245/998
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Done
Drag to position 1
Done


So after I do the above...do I just enable CPU-MaxManual and CPU-InteractiveManual...or all.
 

wanfauzan

Member
Apr 5, 2011
24
2
Tap CPU-Navigation
Tap on CPU-NAV 245 998
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Done
Drag to position 1
Done
Tap on CPU INT 245/998
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Done
Drag to position 1
Done
----------------------------------------------------------------------
Enable all APART FROM CPU-MaxManual and CPU-InteractiveManual, click 'On', then apply and turn the screen off and on and you should be up and running!

I assume you'll need to add your own icons in to each of the notifications.
-----------------------------------------------------------------------

For the last step, the variables for CPU INT 245/998 are already keyed in before.
 
  • Like
Reactions: brandall

nmadd

Senior Member
May 22, 2010
108
7
Thanks for the tutorials. I think I'll simplify it for my tastes, but this was a very helpful place to start. Looking forward to seeing how your performance/battery pans out.
 

nmadd

Senior Member
May 22, 2010
108
7
Regarding the default setup:

Charging + turning display back on + >50% battery: you go back into "CPU interactive" when I would expect to go back into "Overclocking" since it is still plugged in.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 53
    INSTALLATION INSTRUCTIONS ADDED TO POST #2

    For those of you not familiar with Tasker, it’s a pretty damn amazing application that works toward fully automating your Android phone.

    You can pick up a free trial version from here.

    This thread is to show, assist and learn (from your input) how to fully utilise the newly introduced CPU controls, with the ultimate goal of preserving battery life without using additional applications such as SetCPU or other power saving scripts. This may look like a beast of a tutorial, but it really doesn't take that long to set up. Honest...

    Tasker can be a little daunting at first, but a quick read through the manual, some tweaking of the profiles and step-throughs on the Tasker wiki and you’ll be up to speed in no time.

    In order to control the CPU, you’ll need a rooted device and a compatible kernel. A quick acronym lesson can be found here. In brief, you require the following Governors (or as many of them as you can get!):

    Performance (keeps the CPU frequency always at the maximum. Most power-hungry, most responsive)
    Ondemand (when the CPU is needed, immediately sets it to maximum frequency. Slowly reduces the frequency back down to the minimum as time passes. Responsive, reasonable power usage).
    Interactive (like Ondemand, but more responsive with slightly more battery usage)
    Conservative (when the CPU load is needed, slowly increases the frequency to maximum. When the CPU is no longer needed, immediately drops back to the minimum. Less power-usage than Ondemand or Interactive, less responsive).

    If there isn’t such a kernel for your device, then I can only suggest you beg and plead with a Dev in your device’s forum!

    You can check the following in a file explorer to see your available frequencies and governors of your current/updated Kernel:
    sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
    sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors


    I have a Desire and am running an Oxygen AOSP ROM. I’m therefore using vorkKernel detailed here. There’s a detailed breakdown in the first post of that thread showing the kind of kernel you’re looking for.

    WARNING! DO NOT ENABLE THE PROFILES UNTIL YOU HAVE DOUBLE CHECKED THEY DO NOT EXCEED YOUR PHONE’S CAPABILITIES!! I TAKE NO RESPONIBILITY IF IT SETS ON FIRE! BE CAUTIOUS TO BEGIN WITH. IF THE AVAILABLE FREQUENCIES I DETAIL ARE NOT IN YOUR KERNEL, USE YOUR COMMON SENSE AND APPLY SIMILAR ONES! Ok? Right, ready to blow your phone up…? Just kidding….! Maybe….

    Before you import the profiles, make sure you disable/archive/uninstall SetCPU or any other similar applications or scripts that could take precedent over the CPU control.

    You’ll also need a couple of tools to see/hear your progress at a glance/listen:

    A widget that shows CPU frequency, with regular refresh intervals would be handy. (If you don’t have one, I suggest you use Process Monitor available for free on the market here . The widget refreshes every 5 seconds from the home-screen).

    As they’ll be some ‘screen-off’ states, it's very useful to have a speech engine so you can be told what’s happening without having to turn the screen on and therefore changing the state! (I use Pico TTS)

    The application CPU Spy can be helpful to show you how these profiles combined with the Data Sync profiles will increase the amount of time your device will be spending in 'deep-sleep' and at lower frequencies. Thanks leftAlone for pointing this app out.

    In Tasker, the main triggers for the CPU controls are as follows:

    Display Off
    Display On
    Battery Low
    Battery Hot
    Phone Charging
    In call
    (added in V2)
    End Call (added in V2)
    Initial Boot (added in V2)
    Application Launched (added in V2)

    In my set-up, these triggers become intertwined as there is often more than one active state to consider. Here we go....

    READ THE REST OF THIS POST, BUT INSTALL WITH INSTRUCTIONS FROM POST TWO!

    The speech profile (CPU-SayState) is the first one to download – it’s set up to tell you every 5 minutes (in very clear English), your frequency and governor. Not only will this confirm that your screen-off state is working correctly by just listening, but when you are performing other routine tasks, it will alert you if for some reason you find yourself overclocking/underclocking when you don’t want to be and you'll know something is wrong (the alternative to this is good old fashioned log files).

    Next, CPU-BatteryHot. It's stand alone. You’ll see that the ‘Event’ is simply ‘Battery Overheating’. If this event occurs, then the governor is set to conservative and the frequencies to 245 and 422,400. Let’s be honest, if you do have an overheating battery, you’re more likely to panic and put the phone in the fridge rather than rely on this profile to resolve it, but it’s a simple start and provides a useful notification should this ever occur.

    Next, CPU-DisplayOff. This is a good chance to save some battery life. The event is ‘screen off’ and the task sets a tiny vibrate notification so you’ll know it’s applied whilst the screen is off. An icon will be present in the status bar when you turn the screen back on. Conservative governor and frequency of 245 and 384. You of course should tweak these to whatever you wish - that's the point of this! The other tasks within the profile are removing the notification of other CPU profiles that may have been active prior to the screen turning off.

    Next, let’s set up CPU-BatteryLow. It’s relatively stand alone again, triggered by an event of the ‘battery level’ being less than 25%. Conservative governor, with frequencies of 245 and 499,200 with an added IF statement at the bottom confirming the battery level. A popup on the screen will tell you the battery is low, which will go away on its own or can be pressed to dismiss. All other notifications of previous states are cancelled and finally a ‘stop’ is applied IFthe battery goes above 35%. At this point a task is performed that matches the governor and frequency of what will be your ‘regular ***’ CPU settings (again, these should be whatever you wish). This will end once the screen is turned off so the profile returns to CPU-DisplayOff.

    Next, CPU-ChargingAny. Triggered by the 'power' state, the first task checks the battery level being above 50%. If it isn’t, an interactive governor is applied (to concentrate on charging), if it is, a performance governor is applied pushing the frequency up to 1075200. A status bar notification/icon and a vibrate pattern alert you that you are overclocking. Other notifications are killed.

    Now we have to look at cancelling the overclocking once the phone is no longer charging/on external power. This isn’t totally straight forward, as the preferable states (inverted) of ‘no usb connected’ or ‘battery not charging’ relate to most of the time you use your phone.

    The answer is to use an ‘exit task’, which will activate once the current state no longer applies e.g. the charge is removed. At this point, we need to check the current state of the phone, by applying tasks in order of their priority. The first task checks if the screen is off (therefore assuming the phone is no longer being used). If it is, it applies the DisplayOff profile. Secondly, if the battery level is now greater than 25%, it applies the DisplayOn profile (shown below). Finally (assuming the other two tasks states were not true), it applies the BatteryLow profile. The current task is instructed to ‘stop’ once a true state is found.

    Finally, CPU-DisplayOn. The event is of course ‘display on’ and it applies the governor and frequencies that you would consider your ‘regular profile***’ for your normal phone usage. For me this is interactive with frequencies of 245 and 998,400. It of course first checks that the battery is not less than 25%, otherwise the BatteryLow profile would have already been activated and should be left to do so. A status notification and the killing of existing notifications is included at the end.

    You’ll need to create a manual ‘regular profile’ (mine is called CPU-InteractiveManual in the .zip folder) that you can leave unchecked. This is named to match the *** above. It’s also there in case circumstances require you deactivate all of the other profiles and just run your regular profile (because you want to).

    Very finally (!), I have a manual MaxOverclock profile, which I activate when I’m going to be using certain applications – A ROM Emulator for example.

    Added in Version 2

    CPU-DeviceBoot. I noticed that the Kernel I'm using boots as standard using a conservative governor (this surprised me a little) and overclocking to max frequency (I assume to help boot speed). This profile waits 30 seconds on initial boot and then checks the phone state before applying the correct profile from above.

    CPU-DuringCall. During a call, my proximity sensor turns the screen on and off. When inputting numbers on a call (Voicemail for example), this caused the CPU-DisplayOff and CPU-DisplayOn profiles to be constantly flicking on and off unnecessarily. This profile deactivates all CPU profiles until the call is finished.

    CPU-EndCall. Once the call is finished, the profiles are activated once again.

    An obvious way (so obvious I previously didn't include it) to preserve battery life is to set individual CPU profiles for individual applications. Tweaking of these if you suffer lag, will help you find the minimal settings for each application.
    53
    Conclusion

    I’ve never used so much battery working these out!! It may well be that the amount of tasks, or the way they are structured, actually uses more battery life than controlling the CPU could save. I’ll be running some tests over the coming days to monitor it. If that does prove to be the case, I'll still be glad I’ve done this and learnt more about this fantastic application and look forward to it making me even more lazy.

    Let me know your feedback please folks, inconsistencies, errors, I’m all ears and feel free to use the 'thanks meter'

    Battery life:
    Without brandall's profiles: ~9hrs
    With brandall's profiles: ~16hrs!

    my batterylife has GREATLY improved!
    Without tasker: 10h 21% left, with tasker: 15h 67% left..!

    Since using your profiles, I haven't had to charge my battery in 23 days and I'm having much better sex with my wife! Thanks!


    FAQ

    Q) I'm getting missing plug-in errors on V5? What do I do?
    A) Read the bottom of post #2 and delete the Minimalistic Text actions if you do not wish to use it.

    Q) Which profiles do I leave unticked and ticked again??
    A) See this post

    Q) I get a CPU Action Not Available error - why?!?
    A) See the bottom of this page (thanks wanfauzan)

    Q) Why doesn't Overclocking start again when the display is turned on and the phone is on charge?
    A) Best solution see here. Credit Matrix72

    Q) The icons you use are rubbish. How do I use my own?
    A) See this post

    Q) I have many other Tasker questions, can I post them here??
    A) To avoid clutter, probably best to use this official Google group

    Q) My phone is sluggish when the 'battery low' profile is active.
    A) Be cautious, but adjust the frequencies and maybe governor until you find the perfect settings for your phone.

    Change Log

    Code:
    [B][U]V2[/U][/B]
    Added [B]CPU-DuringCall[/B] profile to V2 .zip
    Added [B]CPU-EndCall[/B] profilie to V2 .zip
    Added [B]CPU-DeviceBoot[/B] profile to V2.zip
    Changed how [B]CPU-DisplayOn[/B] behaves when battery level low
    Changed how [B]CPU-ChargeAny[/B] behaves when battery is less than 50%. Also added sound effect and matching vibrate pattern because I'm childish. 
    Added wait task to [B]CPU-BatteryLow[/B] until charge reaches 35%
    Added [B]CPU-Navigation[/B] example profile to V2 .zip
    Changed how cancelled notifications are handled for aesthetic reasons. 
    
    [B][U]V2.1[/U][/B]
    Added missing IF statement to vibrate pattern of 'Overclocking' on [B]CPU-ChargeAny[/B]
    
    [B][U]V2.2[/U][/B]
    Changed collision handling of [B]CPU-BatteryLow[/B] to consider wait task
    
    [B][U]V3[/U][/B]
    Updated [B]CPU-DuringCall[/B] to create an 'in call' variable ([B]%INCALL[/B]), that can be used in other tasks.
    Updated [B]CPU-EndCall[/B] to create an 'in call' variable ([B]%INCALL[/B]), that can be used in other tasks.
    Changed notification handling to include specific titles, so not to cancel notifications of other Tasker profiles.
    Removed Overclocking Sound and chilled the vibrate pattern.
    
    [B][U]V4[/U][/B]
    
    The below update [COLOR="Red"]*REMOVED AS IN V5*[/COLOR] prevents the quick screen off/screen on changes between [B]CPU-DisplayOff[/B] and [B]CPU-DisplayOn[/B] which can cause lag and echo errors. This was a headache to resolve due to too many reasons to list, but I've resolved it by adding a 5 second wait before the display off CPU settings are applied - if within that 5 seconds you turn the screen back on, the display off settings will not apply, consequently neither will the display on settings reapply. Someone needs to donate me some paracetamol... 
    
    It's achieved with an additional variable [B]%CPUSS[/B] (CPU sleep state) which is set to a value of 1 within the 5 second wait and a value of 2 after (once the CPU screen off settings have applied). This way, the CPU display on settings know whether to activate, or they remain active and therefore don't reapply.... 
    
    [B][U]V5[/U][/B]
    
    * So many I've forgotten them all.... Oops!

    Bugs

    All totally fixed in V5 (I hope).

    Feature Requests

    Consider states for 'smartass' governor.

    Thanks

    torsrex - Risking device and limb testing
    -----------------------------------------------------------------------------------------------------

    Due to the amount of changes, there is no 'step-through' update for users of the lower versions. Delete the profiles you have and it's a lightening quick addition of the CPU entries from post #2!

    ------------------------------------------------------------------------------------------------------

    The thanks meter lets me know I'm appreciated! :eek:
    24
    STEP-THROUGH INSTRUCTIONS

    With Tasker currently ristricting the import of CPU actions, I've had to strip them out of the profiles, meaning you have to add them in manually for the time being. Shouldn't take too long... Follow these instructions:

    Download the latest 'Tasker CPU Profiles STEP-THROUGH.zip' and Unzip the profiles into sdcard/Tasker/profiles - Import them individually from the menu options. There should be 11:

    CPU_BatteryHot
    CPU_BattertLow
    CPU_ChargingAny
    CPU_DeviceBoot
    CPU_DisplayOff
    CPU_DisplayOn
    CPU_DuringCall
    CPU_EndCall
    CPU_InteractiveManual
    CPU_MaxManual
    CPU-SayState


    There is one additional stand-alone task:

    MTVar

    Ensure they remain unchecked until we've added all of the CPU activities below.

    Before applying your custom CPU profiles, it would be highly recommended that you observe your current kernel's/ROM's/device's behaviour using home-screen widgets and the speech task included. My device (Desire), has custom kernels that use different governors to get the best performance out of the device. Please understand which governor(s) your kernel dev has focused on and if the voltage and/or governor(s) are changed in certain states. This will be well documented in your Kernel thread.

    Overclocking

    Please be more than aware that overclocking your device is not without its risks. Within the profiles Overclocking will occur only when the screen is on, the device is on charge and the battery is above 50% to ensure this is intentional. Should your screen go off, you will have to manually restart overclocking by unplugging and replugging the charger. Using a 'Performance' governor, will increase the CPU frequency to the maximum available and remain at that level. This is unecessary unless you are using a particularly high resource application such as a ROM emulator. Using an alternative governor that allows maximum frequency when required, but does not remain there when not, should be considered.

    Instructions

    The CPU settings have been replaced by actions entitled 'Type'. The text says 'Insert Frequency and Governor here'. In addition, they may be instructions to tick the 'IF' statement and add the values included in the text. Remove the 'Type' entries as you go, replacing them with the following suggested entries:

    (CPU action entries are contained under 'Misc'
    Select Edit
    Press +
    Select Misc
    CPU)

    Tap CPU-DisplayOn
    Tap on CPUDispOn - Replace action #6 | Interactive | 128,000 | 998,400

    Tap CPU-DisplayOff
    Tap on CPUDispOff - Replace action #7 | Conservative | 128,000 | 245,000

    Tap CPU-BatteryLow
    Tap on CPUBatLow - Replace action #2 | Conservative | 128,000 | 998,400

    Tap CPU-ChargingAny
    Tap on CPUCharg - Replace action #2 | Interactive | 128,000 | 998,400
    Replace action #3 | Performance | 128,000 | 1,075,200

    Tap CPU-BatteryHot
    Tap on CPUBatHot - Replace action #1 | Conservative | 128,000 | 422,400

    Tap CPU-InteractiveManual
    Tap on CPUManual - Replace action #1 | Interactive | 998,400 | 128,000

    Tap CPU-MaxManual
    Tap on CPUMaxMan - Replace #1 | Performance | 128,000 | 1,075,200

    ----------------------------------------------------------------------
    Enable all APART FROM CPU-MaxManual and CPU-InteractiveManual, click 'On', then apply and turn the screen off and on and you should be up and running!

    I assume you'll need to add your own icons in to each of the notifications.
    -----------------------------------------------------------------------
    Minimalistic Text Widget

    Also included in the tasks and the V5 download is a profile for Minimalistic Text showing the Tasker variables all of my profiles use. Drag it into the Minimalistic Text folder on the SD card and it will be there in the preference manager. It you don't use all of my other profiles (why the hell not?!) you can delete the entries that are not applicable to you. My other profiles are in my signature btw. I've no idea where my signature is though... Not using Minimalistic Text?? It's a great low resource home-screen widget with Tasker integration. Check out the XDA thread here

    I DON'T WISH TO USE THE MINIMALISTIC TEXT PLUGIN!

    Then delete the following 'Perform Task MTVar' entries:

    CPUDispOn - Action #9
    CPUDispOff - Action #14
    CPUCharge - Action #10
    CPUBatLow - Action #8
    CPUEndCall - Action #2
    CPUBatHot - Action #6
    CPUManual - Action #5
    CPUMaxMan - Action #5
    7
    Here's are updated profiles I reconstructed based off of brandalls original profiles. They are based on my preferences and I took out some profiles like cpu during and after calls and Manuel stuff.

    I also added toast commands that closes toasts about 15 seconds after it notifies so it won't cluster your notifications

    https://www.dropbox.com/s/jd13vkkm8vx7rcp/UpdatedCpuControl.zip

    Hit the thanks button if this helped

    Sent from my SAMSUNG-SGH-T989 using Tapatalk 2
    2
    You have the same issue with mtvar?

    Nope, worked for me.

    All right, here it is. Updated to Tasker 4.4u3m. Follow instructions on the OP. You have to import MTVAR into the task tab and the fileTaskerMT is for minimalistic text. The rest get imported to profiles.