[mod] gov-tuner project - Xiaomi Mi Max Themes, Apps, and Mods

Hai guys,
There is a interesting MOD for pre defined CPU governor tuning so that we can have better performance, better battery life or have balanced tweaks.
I wont go into further details, but will copy/paste as this is not my work, im just sharing the info.
Main thread and source:
http://forum.xda-developers.com/and...tuner-project-29th-june-2016-t3407828/page307
A CPU governor in Android controls how the CPU raises and lowers its frequency in response to the demands the user is placing on their device. Governors are especially important in smartphones and tablets because they have a large impact on the apparent fluidity of the interface and the battery life of the device over a charge.
This mod will configure your governor to have the best experience with more battery, fluidity and smoothness.

It's all pretty much a keen bull****. You can tune interactive pretty much & using a deadline as an IO with it pretty much puts an "." to every discussion of the sort about it. The thing that is needed right now is a decent hotplug solution that can be tuned for the SoC's that are in use with minimum micro shattering still saving juice especially on S652...

Related

[Q] CM 7 performance question?!?

Im running CM7 with ADW EX launcher and a 3500 MAH battery. I want to know how I should adjust the CPU for maxium performance? Any suggestions help. Thanks!
Whatever setting you want.
Performance will run the cpu at max. Best performance, worst battery
conservative slowly ramps up the cpu, usually good performance and battery
ondemand ramps up cpu quickly and slowly moves it down. better perfromance, worse battery (than conservative)
Interactive - tries to modify cpu a little more efficiently- performance and battery unknown (there is no known concesus as far as I know)
Therefore if you want amazing performance and dont care about battery go performance, if you want to use your phone more than 6 hours, go with ondemand or interactive.
Thank you
Sent from the CM7 Green Machine!!
If ADW Ex feels laggy, download VM Heap Tool and increase the dalvik heap size. That always worked better for me than increasing the cpu - at least as far as the launcher goes.
My Evo + xda Premium App = This post.

Disscusion thread on I/O schedulers and Governors

which best I/O scheduler and governor for baterry life and gaming
razer1224 said:
which best I/O scheduler and governor for baterry life and gaming
Click to expand...
Click to collapse
IMO Noop is best I/O scheduler since there is not much tweaking needed.
Advantages:
Serves I/O requests with least number of cpu cycles. (Battery friendly?)
Best for flash drives since there is no seeking penalty.
Good throughput on db systems
.
Disadvantages:
Reduction in number of cpu cycles used is proportional to drop in performance
.
But SIO is best optimized for most environments.
As for governor I think Interactive is good but our case OnDemand is tweaked the most and best for games (SmartassV2 is my personal favorite but it's not used by our kernel developers).
A little about OnDemand Governor:
Default governor in almost all stock kernels. One main goal of the ondemand governor is to switch to max frequency as soon as there is a CPU activity detected to ensure the responsiveness of the system. (You can change this behavior using smooth scaling parameters, refer Siyah tweaks at the end of 3rd post.) Effectively, it uses the CPU busy time as the answer to "how critical is performance right now" question. So Ondemand jumps to maximum frequency when CPU is busy and decreases the frequency gradually when CPU is less loaded/apporaching idle. Even though many of us consider this a reliable governor, it falls short on battery saving and performance on default settings. One potential reason for ondemand governor being not very power efficient is that the governor decide the next target frequency by instant requirement during sampling interval. The instant requirement can response quickly to workload change, but it does not usually reflect workload real CPU usage requirement in a small longer time and it possibly causes frequently change between highest and lowest frequency.
But it's all up to the kernel developers which governor or I/O scheduler he wish to tweak and modify to bring the best results.
More info: http://forum.xda-developers.com/showthread.php?t=1369817

[Q] Best Governor + i/o Scheduler for battery life?

what's the best combo for pure battery life? everyone's been saying smartassv2 with sio but its not really giving me great battery life. what do you guys use?
oh and can you guys please state the amount of battery life you get with the combo you're using. thanks
I've been using smartassV2 in combination with SIO scheduler for general use on my T989 and my old Captivate, it has helped my phone last a day or usually longer.
I don't really look at my 'battery usage' as it varies with what I'm doing in the day, for the most part it did make a big difference compared to the defaults.
Also, if you're looking for better battery results underclocking/undervolting and have certain governors turn on during different phone usage will definitely make a huge impact with your battery results.
You can do this with many apps, but the one that has been working for me is usually between Pimp My CPU and SetCPU. Cheers!

[Q] What Governor to Choose ?

I am seriously tired of battery drain so I am now searching for a governor that would balance between Battery Life and Performance. I read this http://forum.xda-developers.com/showthread.php?t=1369817 but actually I was lost in that large number of governors, so Can anyone simply tell me what governor is the best ? I mainly leave WiFi On but Screen On is not usually for a large time ...
amr.reflection said:
I am seriously tired of battery drain so I am now searching for a governor that would balance between Battery Life and Performance. I read this http://forum.xda-developers.com/showthread.php?t=1369817 but actually I was lost in that large number of governors, so Can anyone simply tell me what governor is the best ? I mainly leave WiFi On but Screen On is not usually for a large time ...
Click to expand...
Click to collapse
afaik and base on their details. personally, i use interactive+row on stock then smartassv2/ lulzactive+sio on custom.
SmartassV2:
The motto of this governor is a balance between performance and battery
SavagedZen:
Another smartassV2 based governor. Achieves good balance between performance & battery as compared to brazilianwax.
edit:
Q. "Ok. Enough of explanations. Tell me which governor is for performance and which one is for battery life."
A. Tough question! lulzactive and smartassV2 for a balance between performance and battery. For light weight tasks, lulzactive should be better for battery. And for heavy weight tasks, lulzactive should be better for performance also.
NOTE: It's not so easy to tame luzactive. If you don't know how exactly to do it, stay away from it or you will end up complaining about battery drain!
Click to expand...
Click to collapse
amr.reflection said:
I am seriously tired of battery drain so I am now searching for a governor that would balance between Battery Life and Performance. I read this http://forum.xda-developers.com/showthread.php?t=1369817 but actually I was lost in that large number of governors, so Can anyone simply tell me what governor is the best ? I mainly leave WiFi On but Screen On is not usually for a large time ...
Click to expand...
Click to collapse
I use SmartAss V2 and SIO as governor and scheduler.
Like you, my wifi is permanently on, but screen is not on for long periods, and using this combo since Alpha releases of CM10 onward I have had good results, getting up to 2 days plus on CM10 EOL, and currently on LiquidSmooth 2.9 am getting well over a day from a charge.
Performance is good and LiquidSmooth ROM runs beautifully at stock CPU speeds (I currently use educk's Phenom Kernel ported by Madridii with 370Mb RAM, but have had great results with any Madridii kernel)

The non-technical guide to understanding CPU/GPU governors

The non-technical guide to understanding CPU/GPU governors
There are a lot of guides out there about CPU and GPU governors. They are all very informative, and usually somewhat technical. The other day, however, I needed to explain CPU and GPU governors to a non-technical person, and I realized that a lot of big verbiage and vague terms get thrown around which help the technical, but cloud the issue for some. So, I decided to share my non-technical explanation here, in hopes that it will help others also. This is not a perfect analogy, nor a technical one, but I think it gets the job done.
Consider driving your car in the rain.
The more it rains, the less you can see. Hence the slower you should drive. Each swipe of the windshield wiper clears the window. The rain is like the CPU/GPU load, or how much work the CPU/GPU needs to do to clear the windshield.
Sometimes it is raining very hard. Sometimes it is a sprinkle. But in this make believe world, it is always raining.
As the driver of the car, you get to pick the speed at which the wipers swipe. It is entirely up to you, you are the governor, or the one in charge of the windshield wipers. You can't control how much it rains, but you can control how fast your wipers swipe the windshield clear.
There are many types of drivers out there, just like there are many governors. However, they all fall into several basic categories.
The Performance type governors are like a driver who gets into the car, and he turns on the wipers full speed. Even if it is barely raining. No matter how much rain does, or does not fall on the windshield, he keeps the wipers going full blast. This works very well to keep the windshield clear. However it also makes the wiper blades get pretty hot when it is just a sprinkle. All the friction from swiping back and forth will eventually wear out his wiper blades, and he will replace them a lot sooner if he does this, but his windshield will stay clear!
The Powersave type of governors are like a driver who gets into her car and turns the wipers on at the lowest possible speed, with the longest delay between swipes. This works great if it is just sprinkling, but anytime she gets into a down pour, she has to practically come to a stop, because she can't see where she is going through all that rain on her windshield.
The On Demand type governors, are the drivers who are always adjusting by wild amounts. "Oh, it's raining harder, I will turn the wipers all the way up!" He says. "Oh, I guess that was too much. I'll turn them down now." Back and forth this driver goes, always pushing up to maximum wiper speed, only to find that he should probably turn the wiper speed down. Often, this guy is over-adjusting for the actual amount of rain, but his windshield stays pretty clear. Essentially, he has become his own delay module, waiting for rain on the windshield, he then turns on the wipers to clear it, then practically turns the wipers off. Then repeat, over and over again.
The Conservative type governors, however, take a more methodical approach. When she sees that it is raining harder, she turns her wiper speed up one notch. Then she waits a few seconds to see how well that works. Not enough wiper speed to keep the window clear? Then she will turn up the wiper speed another notch. Still not enough? Then she turns the wiper speed up another notch. One notch at a time, with a moment to check the results before making another correction. Then, if the wipers are too fast, she turns them down one notch. The process continues, constantly adjusting, one notch at a time. This can work very well. It can also be problematic if there is a huge change in the amount of rain. If it was sprinkling, and then starts to pour, it may be a while before she gets her wiper blades to "catch up" with the amount of rain.
Of course, there are Ideal frequency governors. This man has already determined that if it is raining, he will use a particular delay or speed setting for his wipers. He may adjust them slightly if it is raining more or less, but he will always strive to keep his wipers at the setting that he already determined was the one that he thought was best. Usually this setting is somewhere in the middle. Not really performance, not quite powersave, just somewhere in the middle that he thinks is best. This can work good for average use, but can be taxing your battery while "coasting" and can be less able to handle heavy rains (high work loads).
Then there are the dependent type of governors. This person gets into her car and begins to drive through the rain. Rather than setting her wipers based on her view out the window, this lady sets her wiper speed based on some other variable. For instance, the Intellidemand governor sets the CPU frequency based on GPU speed. This would be like a woman who sets her wiper speed based on her car's speedometer. If she is driving faster, then she turns up the wiper speed. If she is driving slower, then she turns down her wiper speed. It makes sense, but works only as good as the thing controlling it. It seems like a good idea, if you drive faster, you need a clearer windshield, so you should wipe the rain away faster. The only issue here is that it may not be raining very hard, yet, because you are driving faster, you must set your wipers to swipe faster. Generally this works very well, but may not work in every condition. Some of these governors have other variables, such as "touch poke" where the CPU frequency, or wiper speed, goes up when you touch the screen. Much like turning up the wiper speed when the hi-beam headlights get turned on.
Essentially, all governors are like one or more, or some combination of, the above. Most simply fine tune the variables or combine some functions of the above to get the results they want. Some are designed for power saving, others for performance.
So, which one is the best?
Well, that depends. Is it raining really hard all the time? Does it barely rain at all? Is there just a good gully-wash once a day, and other than that it is just a sprinkle?
Lots of people argue over which one is the best, but it is really hard to quantify. The reality of it is not which governor is the "best" but which governor is the "best for you". Only you know what your daily "rainfall" is like. Perhaps you are okay with driving a little slower in the rain. You might even enjoy it. Maybe you have ADD and need that windshield spotless all the time. I don't know.
A few thoughts for you to consider though:
Do you need your phone to be battery friendly?
I get up at 4:30 AM every morning for work. I put my phone back on the charger every night around 8 PM. My battery only has to last 16-17 hours. Typically, based on my choices and daily use, I average about 50% battery life left when I put it on the charger. Based on my usage, I could choose a more performance driven governor, and not have to worry too much about battery usage. If you are always out and about, in the wild, hiking, camping, fishing, you may want to consider a more battery friendly option to extend your use for longer trips between chargers. My point being that it does you little good to choose so many battery friendly options that your phone lasts 6 days on a charge, but you plug it in every night.
Do you need your phone to out perform anybody?
I don't play video games. I rarely watch youtube/hulu/netflix/vudu/(name your video streaming service here) on my phone. Do I need a performance based governor? Sure, the benchmarks are impressive, but does it really mater that you are clocking max speeds to check you email?
You don't have to choose just one setting.
Many people get "stuck in a rut" (back to our car analogy) when it comes to settings like governors. With apps such as Kernel Adiutor, Device Control, and others, you can set profiles, or make backup configurations that you can quickly implement when you want to. If you hardly use your phone when you are at work, but become a gaming fiend at home. Maybe it is the opposite, at work you use your phone for serious number crunching with some math apps, and at home it just becomes your telephone. Choose a different option that suits your needs in each instance.
I hope that helps lay the groundwork for what a governor does. Here is a technical guide to each governor: http://forum.xda-developers.com/general/general/ref-to-date-guide-cpu-governors-o-t3048957
Feel free to post if you have thoughts, comments, or questions relating to governors. It is only a community when people participate.
@AlaskaLinuxUser I went through the post twice or thrice. I have a better and clearer concept about governors now. But I have a confusion. Is there a way to create my own CPU governor? Is there any such thing as creating own governor?
SoapDev2018 said:
@AlaskaLinuxUser I went through the post twice or thrice. I have a better and clearer concept about governors now. But I have a confusion. Is there a way to create my own CPU governor? Is there any such thing as creating own governor?
Click to expand...
Click to collapse
Absolutely, positively the best governor question I've ever been asked.
Yes.
You most certainly can make your very own governor. Obviously, the original kernel builders made the first governors, and so many govs exist because users made more. Typically, to write one from scratch would take strong c or c++ programming skills.
However, a good place to start would be to edit an existing governor to suit your liking. A lot of trial and error is required, as well as many testing trial runs.
If I get the chance, perhaps later I can point out a few govs that are simpler to understand the code, and point a few things out for you, but you are welcome to dig around a bit.
Off the top of my head, minmax might be a good one to look at.
Also, here is a repository of a bunch of govs, check here:
https://gitlab.com/alaskalinuxuser/Kernel_Tweaks
And take a look at performance and powersave, and compare them to minmax and lionheart. This hopefully will give you a general idea of how a gov works, then perhaps we can talk about it a little more.
AlaskaLinuxUser said:
Also, here is a repository of a bunch of govs, check here:
https://gitlab.com/alaskalinuxuser/Kernel_Tweaks
And take a look at performance and powersave, and compare them to minmax and lionheart. This hopefully will give you a general idea of how a gov works, then perhaps we can talk about it a little more.
Click to expand...
Click to collapse
Unlimited thanks might not be enough. Kudos! I'll go through them all, try to get a grasp over them and post queries accordingly
SoapDev2018 said:
Unlimited thanks might not be enough. Kudos! I'll go through them all, try to get a grasp over them and post queries accordingly
Click to expand...
Click to collapse
Thanks, but building govs is a bit high level and advanced stuff. I'm no expert, in the past, I have only done small modifications to govs to get them to work with the kernels I was working on.
A good place to take a look is to download the conservative gov and the lionheart gov. Open both in a program like diffuse or other line by line comparing program and you can see how the lionheart governor was made from the conservative governor. Typically, any gov maker is just modifying one of the 5 "original" govs (performance, powersave, ondemand, conservative, or userspace).
By comparing the conservative and lionheart govs, you can see the real changes were these three things:
1. Changing the frequency up and down thresholds.
Code:
#define DEF_FREQUENCY_UP_THRESHOLD (80)
#define DEF_FREQUENCY_DOWN_THRESHOLD (20)
2. Changing what was used to measure idle time. In the conservative gov it is u64, in the lionheart it is cputimer.
Code:
static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)
{
u64 idle_time;
u64 cur_wall_time;
u64 busy_time;
vs.
Code:
static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,
cputime64_t *wall)
{
cputime64_t idle_time;
cputime64_t cur_wall_time;
cputime64_t busy_time;
3. Changing the sampling rate determination from a math formula (conservative) to a set flat amount (lionheart):
Code:
/*
* conservative does not implement micro like ondemand
* governor, thus we are bound to jiffes/HZ
*/
min_sampling_rate =
MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10);
/* Bring kernel and HW constraints together */
min_sampling_rate = max(min_sampling_rate,
MIN_LATENCY_MULTIPLIER * latency);
dbs_tuners_ins.sampling_rate =
max(min_sampling_rate,
latency * LATENCY_MULTIPLIER);
vs.
Code:
min_sampling_rate = 10000;
dbs_tuners_ins.sampling_rate = 10000;
So you can see how you could edit at least #1 or #3 to change the way this governor functions, and learn a little about how it works.
Another option is to utilize the userspace gov. It is written to allow the user of the phone to specify what cpu frequencies that they want. Almost all kernels support the userspace gov, and you as a user can just specify what cpu frequency you want by writing it to a certain file. This will require root permission, typically. So, if you program in another language, say python, shell scripting, c++, c, java, etc., you can use an app that you make for Android to control this file, and be your own governor. This is a slow and somewhat backwards method, but it may give you an idea of what you might like to change in a governor.
Hope that helps!

Categories

Resources