yashsingh1/xdaforums huggingface dataset:
[Redmi Note 2 General] DarthJabba9:
How about these, for providing easy on-the-fly access to cores/speed (if there was a way of providing a one-click execution on the home screen)?

# single core, max 806mhz
Snail_speed()
{
local MinS=403000
local MaxS=806000
echo "0" > /proc/hps/enabled
echo "$MaxS" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "$MaxS" > /proc/cpufreq/cpufreq_limited_max_freq_by_user
echo "$MinS" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
# turn off all other cores
echo "0" > /sys/devices/system/cpu/cpu1/online
echo "0" > /sys/devices/system/cpu/cpu2/online
echo "0" > /sys/devices/system/cpu/cpu3/online
echo "0" > /sys/devices/system/cpu/cpu4/online
echo "0" > /sys/devices/system/cpu/cpu5/online
echo "0" > /sys/devices/system/cpu/cpu6/online
echo "0" > /sys/devices/system/cpu/cpu7/online
}

# two cores, max 1183mhz
Turtle_speed()
{
MinS=403000
MaxS=1183000
echo "0" > /proc/hps/enabled
echo "$MaxS" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "$MaxS" > /proc/cpufreq/cpufreq_limited_max_freq_by_user
echo "$MinS" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "1" > /sys/devices/system/cpu/cpu1/online # turn on second core
echo "0" > /sys/devices/system/cpu/cpu2/online
echo "0" > /sys/devices/system/cpu/cpu3/online
echo "0" > /sys/devices/system/cpu/cpu4/online
echo "0" > /sys/devices/system/cpu/cpu5/online
echo "0" > /sys/devices/system/cpu/cpu6/online
echo "0" > /sys/devices/system/cpu/cpu7/online
}

# return to normal
Normal_speed()
{
MinS=403000
MaxS=1950000
echo "1" > /proc/hps/enabled
echo "$MaxS" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "$MaxS" > /proc/cpufreq/cpufreq_limited_max_freq_by_user
echo "$MinS" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
}
[Redmi Note 2 General] jwchen119:
It just an app which can record the dropped frame within the time when using.

The developer said he will complete the app after the Chinese New Year.

[MENTION=5952980]jajk[/MENTION] you may forgot to enter the app and press "刷新" after press "stop".
[Redmi Note 2 General] jajk:
[MENTION=5850987]DarthJabba9[/MENTION] The script looks like it will work but you are disabling hotplug in the process which is not ideal. How about leaving hotplug enabled and writing the desired core number limit to one or all of the following:

echo 1 > /proc/hps/num_limit_low_battery # 8 default

echo 1 > /proc/hps/num_limit_power_serv # 8 default

echo 1 > /proc/hps/num_limit_thermal # 8 default

echo 1 > /proc/hps/num_limit_ultra_power_saving # 8 default

I do not know why you can't extract the boot image using Ubuntu as AndroidMasterChef repacks with same format of original file which is gz. If you install it with TWRP, you get the extracted version on your phone do you not?

[MENTION=5261119]jwchen119[/MENTION] I press the "刷新" and no results displayed. I was more wondering what the software was in the screen shots back a few posts?
[Redmi Note 2 General] DarthJabba9:
The script does work. I am not particularly bothered about hotplug when using "Snail" or "Turtle" speed (I even created one called "Molasses" speed, which stays permanently at 403mhz and one cpu core active). These are really for times when I will not be using the phone for a long time, but I need it to be on, without draining the battery. Who knows whether it will achieve this effect? I have a number of widgets on my launcher to run the script in each mode with a single tap whenever I want - and this seems to work well.

I will try your solution and see if it really does turn off all the other cores - but I now know that the cores will remain off if I do it myself

Like I said, two files are extracted, but the ramdisk cannot be extracted. And, like I said, I don't have this problem with any other boot image. I have not installed it on the phone, and won't do so unless I can see exactly what is in it (and I am running a miui ROM).

---------- Post added at 10:53 PM ---------- Previous post was at 10:01 PM ----------

[MENTION=5952980]jajk[/MENTION] Your tweaks seem to do the job of keeping only one core active, but run that core mostly (70% of the time) at 1183mhz, and less than 1% at 403mhz. I am not sure how battery-friendly that is. It also creates very noticeable lags.
[Redmi Note 2 General] jwchen119:
[MENTION=5952980]jajk[/MENTION] you have to press "Stop" before press "刷新" or you'll get nothing.

About the app, it is PerfMon by [MENTION=631273]Chainfire[/MENTION] and CPU times by [MENTION=4684315]flar2[/MENTION]

To check the total cpu time and monitoring the CPU freq in real time.

I'll have to flash a clean ROM to do the test, ahh... it hurts :eek:

Will figure which combination is best for the battery and performance.
[Redmi Note 2 General] jajk:
[MENTION=5850987]DarthJabba9[/MENTION] If you are running MIUI, dont load that boot.img as it does not process init.miui.rc and other stuff needed for MIUI. The process to fix MIUI is quite different.

It seems that there is a (bad) habit of people embedding scripts in the boot.img which makes things difficult if a user then wants to play with their own settings via init.d scripts. What I have done is strip these out of the boot.img and put them back under control of the user who wants to play. Please identify what ROM you actually have loaded and verify that your init.d scripts do manage to write the settings without being overwritten by another script hiding somewhere.

If you are running AICP and follow exactly what I described, you will get a good result unless you run some badly written apps that won't shut up. Don't trust my boot.img? Make your own - I have given you all the info you need to modify it.

I can't help but to have another attempt at getting a super-slimmed (skinny) MIUI working after spitting the dummy last week after getting stuck at the lock screen with a log on screen to some non-existent MI account.

This time it is backup, remove an app or service, backup if it is good or restore if it is bad, move on to the next candidate.

So far..........What can be deleted (Xiaomi apps) and still boot and function O.K is:

Fwkplugin

FWUpgrade

FWUpgradeProvider

XiaomiAccount

Antispam (Blocklist)

Backup

AnalyticsCore

jjcontainer (all jeejun related apps & folders)

SystemAdSolution

Xiaomi Framework

YellowPages

Bug Report

CloudService

MiDrop

MiPub

Find Device

Cloud Backup

MiAssistant

MiLinkService

What you can't immediately delete is:

Updater (won't boot without it)

There are a few apps that are set to autostart that can be knocked back to starting only when needed. I use SD Maid to toggle the autostart components off.

Atci service

File Explorer

Download Manager

MTK logger

Sim Toolkit

UpgradeSys

Updater

Now its starting to purr.....
[Redmi Note 2 General] DarthJabba9:
That is what I thought.

I am running SlimMiui stable 7.1.3 by barome.

It is nothing to do with trust. It is to do with knowing what exactly is there, so that if any of my tweaks is not working, I am not having to guess whether something is happening during init that is undoing all my efforts.

I was able to freeze this with Titanium, and there was no problem. In the end, I defrosted everything, because I could not notice any impact on battery life.
[Redmi Note 2 General] jajk:
[MENTION=5850987]DarthJabba9[/MENTION] Have you unpacked and removed the extra script entries in the SlimMIUI boot image?

I am on 7.11 Stock as a starting point so only added init.d support to init.rc. I will revisit this script and create the init.d folder with correct permissions automatically.

With this script plus touchboost set to 806MHz 1 core, things are running pretty smooth and cool. I might see if I can get zram working but other than that, I am almost happy with the result. Nice to have a ROM with working HDR Camera, Notification Lights, FM Radio etc. without having to put up with the Xiaomi bloat, propaganda and spyware. I get rid of much of the Google bloat as well and replace with apps that require less invasive permissions.

#!/system/bin/sh

# Tweak CPU Governor

echo 806000 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq

echo 80 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load

echo 90 403000:75 806000:80 1183000:84 1326000:88 1469000:92 1625000:96 1781000:99> /sys/devices/system/cpu/cpufreq/interactive/target_loads

echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate

echo 10000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time

echo 20000 > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay

echo 10000 > /sys/devices/system/cpu/cpufreq/interactive/timer_slack

# Both the following lines are required to limit freq

echo 1781000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

echo 1781000 > /proc/cpufreq/cpufreq_limited_max_freq_by_user

# Tweak IO Scheduler

echo deadline > /sys/block/mmcblk0/queue/scheduler

#echo 0 > /sys/block/mmcblk0/queue/iosched/slice_idle #(for bfq and cfq)

echo 256 > /sys/block/mmcblk0/queue/read_ahead_kb

#echo 1048576 > /sys/block/mmcblk0/zram0/size #not working on MIUI - permissions insufficient

#Tweak VM

echo 300 > /proc/sys/vm/dirty_expire_centisecs

echo 500 > /proc/sys/vm/dirty_writeback_centisecs

#Tweak Entropy

echo 512 > /proc/sys/kernel/random/read_wakeup_threshold

echo 1024 > /proc/sys/kernel/random/write_wakeup_threshold

#Tweak for wifi router connection issues

echo 1 > /proc/sys/net/ipv6/conf/wlan0/disable_ipv6
[Redmi Note 2 General] jajk:
Geekbench results for the above configuration (not restricted to 1781MHz as shown) are 812 single 4688 multi. I have the poverty model, not the 2.2GHz variant.

https://drive.google.com/file/d/0BwdRTuyj12_yakxyeHlWQWpFZDQ/view?usp=sharing

Not a fan of benchmarks at all but I am using Geekbench to find the best settings for IO Scheduler, VM, Entropy etc. Every setting has to be evidence based - not bull#8it based.
[Redmi Note 2 General] DarthJabba9:
[MENTION=5952980]jajk[/MENTION] I did edit the speedmod boot image before flashing it.

When you finish with your super-trim miui project, perhaps you might want to share it with us all?

PS: I don't particularly want to limit my cpu speed to 1781mhz - but, do we actually need more than 1650mhz if we are not gamers? I have found that limiting the speed to 1.3ghz was quite acceptable (no lags, etc) - but then I ask myself why we have paid for a 2ghz cpu if we are only going to throttle it?
[Redmi Note 2 General] oldslowdiver:
Just my two cents, pals: exactly because I bought a 2ghz cpu device, here's why I use SetCpu with profiles: check my attachments, or, shortly:

- I generally downlock CPU to 1885 with 'normal' device use (battery > than 51%), downclock even more to 1664 with battery <50%, and even even more with screen off /not call /locked device to 1326.

Then, with specific apps (Youtube, games, camera, etc), it's normal CPU with max 2158.

In case my RN2 gets too hot, there's a specific profile to downclock CPU to 1664.

Anyway, the real magic with battery is due to xposed modules Amplify and Greenify - with the correct settings (check XDA for Celestial Fury's thread), and I have set some Macrodroid macros to enable/disable location services when specific apps are ON.

I have CM 12.1 on a RN2 Prime, and when I used MIUI, well, check this post of mine on MIUI's forum (http://en.miui.com/thread-181376-1-1.html).

I'm no gamer, just internet browsing, calls, chats, bluetooth always on, GPS, so, battery lasts at least 36/48hrs.

Downclocking like that never showed a lag so far.

Just my two cents.
[Redmi Note 2 General] jwchen119:
Here's my recent research. Thought it just tip of the iceberg, but by the app, I can only quantized user experience by recording the dropped frame when scrolling, opening app, swipe the tab etc.

I use the touch record app to make it repeatedly doing the same thing.

Pic.1 is using performance governor, lock the freq @ 1950Mhz, by changing the core number, I got the "result 1".

Pic.2 us also using performance governor, lock @ 6 cores, by change the freq, I got "result 2".

A quick conclusion,

from result 1, we can easily know that if there's no ramp up/down,no delay time factor, task using more than 3 cores is wasting the power.

from result 2, without ramp up/down, delay time factor, task using more than 1183Mhz or 1326Mhz is inefficient ...

There will be more and more table comes out, but this takes times. Every single data averaging from at least 4 result, and every task takes 60 second.
[Redmi Note 2 General] jajk:
[MENTION=5850987]DarthJabba9[/MENTION] Interestingly, Geekbench multi cpu score drops from 4688 to 4455 when throttling back to 1781MHz which is not noticeable in the real world. Thermal throttling plays a big part in what processing power is available in a sustained fashion since we have zero heatsinking on the SOC. My observation is that 1950MHz produces too much heating too quickly to be of any use. Geekbench will give you the answers if you repeat a test a second time to see the thermal throttling effect or throw your phone in the freezer to get boasting scores.

I won't publish a SkinnyMIUI ROM as it is too similar to what Barome is doing well. I will publish the complete do it yourself guide to go from stock to skinny when I update to 7.1.4

[MENTION=4258537]oldslowdiver[/MENTION] Can you publish the contents of /proc/cpufreq/cpufreq_ptpod_freq_volt for your phone? It is interesting to compare that to the 2GHz cpu figures. We can then compare the voltage at each freq step. You are on the same path in stopping all unwanted apps and services to make a better phone.

[MENTION=5261119]jwchen119[/MENTION] Brilliant work, keep it coming! Will your figures get skewed by thermal throttling?
[Redmi Note 2 General] oldslowdiver:
Sure, here it is.
[Redmi Note 2 General] jajk:
Thanks [MENTION=4258537]oldslowdiver[/MENTION]

Here is the side by side comparison - I expected the faster chip to run at lower voltages at comparable frequencies but that is not the case in these examples.

Can anyone else check their /proc/cpufreq/cpufreq_ptpod_freq_volt file and see if agrees with these figures or not? There is a possibility that the voltages are determined by a cpu stress test that writes this file hence the current and original figures??? I wonder if the stress test can be forced into recalculating the figures if that is the case???

Edit: Just checked and my file has changed the values since I recorded them a while back so some mechanism is at play to recalculate the voltages over time.

Freq	Volts

MTK6795M	MTK6795

1950000	1.09375	2158000	1.15000

1781000	1.05000	1885000	1.13125

1625000	1.01250	1664000	1.07500

1469000	0.96875	1482000 1.03125

1326000	0.93750	1326000	0.99375

1183000	0.90000	1183000	0.96250

806000	0.90000	806000	0.96250

403000	0.90000	403000	0.96250
[Redmi Note 2 General] DarthJabba9:
I agree - even at 1.65g and 1.46g there is hardly any difference in noticeable performance, and the Geekbench scores are still decent.
[Redmi Note 2 General] jajk:
I think that setting /proc/cpufreq/cpufreq_stress_test to 1 and rebooting triggers the cpu stress test that recalculates the voltages. On reboot, the setting returns to 0. Mine won't move from the current values now so I can't confirm so can anyone else confirm this is the case?

There is another setting cpufreq_ptpod_test that may be another candidate.
[Redmi Note 2 General] spoof123:
Hai [MENTION=5952980]jajk[/MENTION]; even though I don't understand this discussion; I really hope that you will provide guidelines of how to slim and optimise miui 7.1.4 so that the phone will have longer battery life. Thanks again. ( I try to read a few times from page 1 again)
[Redmi Note 2 General] jajk:
Since MIUI based on Marshmallow is probably 2 months away (in beta testing now), I don't think we are going to get another update to MIUI on 5.02.S

So I will start a new thread that will detail the method to create a SkinnyMIUI from scratch for those looking for a clean and efficient ROM now.

This thread is more about discovering and implementing mods to improve performance and efficiency not limited to a specific ROM.

Implementing zram in an init.d script can be done by adding this line:

echo 1073741824 > /sys/block/zram0/disksize # 0 default (536870912 = 512MB 1073741824 = 1GB)

This may help since MIUI is memory hungry so 2GB doesn't go far. This is a way of keeping the wolves from the door. Please feedback with any positive or adverse effects of this.
[Redmi Note 2 General] vetefan:
I'm trying to tweak my init.d script, and I want to know what is the following exactly means and how will they trigger?

I'm trying to set 4 for all, but it seems sometimes the running core can go up to 6 when I view in CPU-Z.

P.S. I'm using Redmi Note 2 Prime running on cm 12.1

echo 1 > /proc/hps/num_limit_low_battery # 8 default

echo 1 > /proc/hps/num_limit_power_serv # 8 default

echo 1 > /proc/hps/num_limit_thermal # 8 default

echo 1 > /proc/hps/num_limit_ultra_power_saving # 8 default

My freq table currently:

2158000 115000

1885000 111875

1664000 106875

1482000 101875

1326000 98125

1183000 96250

806000 96250

403000 96250
[Redmi Note 2 General] jajk:
[MENTION=3835689]vetefan[/MENTION] If you want to limit to a max of 4 cpu only then add the lines as follows:

echo 4 > /proc/hps/num_limit_low_battery

echo 4 > /proc/hps/num_limit_power_serv

echo 4 > /proc/hps/num_limit_thermal

echo 4> /proc/hps/num_limit_ultra_power_saving

Your freq - volt table is different again indicating that it is dynamically created. This is a great feature providing the decisions on voltages are sound.

I don't like the relatively high voltages I see on the 2.2GHz variants. Have you tried trying to force a retest as I mentioned a few posts back? Would love to know if you do get a new set of values.
[Redmi Note 2 General] DarthJabba9:
That would be nice! I think it would be very helpful if you could simply create a script - either:

a) a shell script to be run from a telnet/ssh session on the actual unzipped ROM files before zipping again to install on the device, or

b) an updater-script that can be run from TWRP on a live (i.e., installed) ROM

This makes everything less error-prone, because you only need to get the script right once.

---------- Post added at 09:43 AM ---------- Previous post was at 09:42 AM ----------

Can you please explain what each of those settings is for, and when they will be triggered? Thanks.
[Redmi Note 2 General] vetefan:
Yes, I do not want to limit it to 4 cores, but just want to limit it at some occasion such as thermal and low battery.

But I want to know , for example, low battery, which is the level to trigger it? And how will the phoen change to num_limit_ultra_power_saving?

Also, cannot get any clues of num_limit_power_serv.

For the stress test, I need to unroot my phone now coz I'm playing some game that detects root, and rootcloak cant solve.

Maybe a few days later when I'm less busy with it, I can root my phone again to test.
[Redmi Note 2 General] jajk:
[MENTION=3835689]vetefan[/MENTION] and [MENTION=5850987]DarthJabba9[/MENTION] First off: The hotplug core limits per event only work in MIUI, not AOSP or Cyanogen based ROMs.

I will explain per line as follows:

echo 1 > /proc/hps/num_limit_low_battery ## active when the % of battery remaining hits the level set in Battery & Performance settings

echo 8 > /proc/hps/num_limit_power_serv ## normal operation

echo 4 > /proc/hps/num_limit_thermal ##when thermald daemon detects a temperature rise above the point at which it starts limiting (I think 65C)

echo 2> /proc/hps/num_limit_ultra_power_saving ## I think this is what is now called Marathon in Battery & Performance settings

Skinny MIUI thread posted today.....
[Redmi Note 2 General] vetefan:
I think at least some of the value above works for cm 12.1 as my phone runs very slow after setting 1 to the values

So, do I need to consider modifying init.hermes.power.rc for cm 12.1 to have adaptive power control? (As you know, I need to unroot my phone so I need to reboot to change settings)
[Redmi Note 2 General] jajk:
In CM, I think that the number of cores available will be whatever the lowest figure is of any setting regardless of prevailing conditions. I mentioned that these hotplug settings don't work correctly in non-MIUI ROMs

I don't have a copy of init.hermes.power.rc to view so can't really comment on how flexible that could be made. Post it if you like.
[Redmi Note 2 General] DarthJabba9:
On my phone, the greatest battery hog is "Audio". Often it is running even when the phone is supposedly in deep sleep. It seems that anything that can give an audible notification (e.g., WhatsApp, Messaging, etc) turns on "audio" whenever a notification is received. Then it doesn't turn off until you dismiss the notification (i.e., for as long as the notification lights are flashing). If this happens when you are away from the phone for a long time, then away goes your battery!
[Redmi Note 2 General] rally200:
I had the same problem.. Gsam says its audiomix uid app 1013 causing a lot of wakelocks. In my case i am still testing it out but it seems the problem was caused by viper4android. Disabled it and the wakelocks aparently stopped.
[Redmi Note 2 General] vetefan:
Photo here:
[Redmi Note 2 General] jajk:
[MENTION=3835689]vetefan[/MENTION] That is one mother of an init.d script....I am not sure why you would want to control things that way since a basic script allows the cpu to range freely from deep sleep to idling at 403MHz, single core thru to all cores at the desired max when needed:confused:

Seems like this dynamic core voltage setting knows what it is doing - I tricked my phone into running lower voltages with a bit of coldness, it later crashed, rebooted and set the voltages higher again. So whatever you are running is probably optimal for the binning of your cpu. I am still surprised to see the faster cpu running higher voltages at low frequencies - it is usually the other way around where the reject bin is sold as lower clock speed versions.
[Redmi Note 2 General] vetefan:
I would like example also if this script can be simplified.

I use the prop sys.perf.profile to control the level of speed I want (seems this is abandoned by cm12.1 but I can still set with terminal emulator)

I limit this to idle at 403MHz as I found the phone go up to 806MHz when charging, and I want to test if limiting it can get better charging time.
[Redmi Note 2 General] jajk:
[MENTION=3835689]vetefan[/MENTION] I forgot that you are on a Cyanogen based ROM. Why not try skinny MIUI and have everything working 100% for a change? I can't offer much help for you on Cyanogen because it has a unique set of quirks that I do not want to get familiar with. (12.1 lasted all of 2 days on my phone before format system and format data fixed it permanently)

Joking aside, I tried a few ROMs before deciding to go down the road of forcing MIUI to be more like the naked Android I prefer and it has worked well for me. It did coincide with MIUI fixing a few things in 7.1.4 that only then made it a viable proposition. The toughest part in all of this is removing Xiaomi's obsession with capturing your data at every turn and in every app - very Google of them:eek:
[Redmi Note 2 General] vetefan:
I tried miui for a few minutes, and found that it varies a lot from my Android experience compared with other devices. The way they are not fully compiling to Android standard make me stop from using it.

As I know some apps, e.g. spam call blockers, stop support only for miui. Also, I feel comfortable of selling my ass to Google, but I dont want to send any 1 bit of data to xiaomi
[Redmi Note 2 General] jajk:
[MENTION=3835689]vetefan[/MENTION] I agree with your sentiments entirely and would not be using MIUI if I could not cutoff the leaks back to Xiaomi.

For my own use, I cut out a lot more than is worth talking about here.

Do people not realize why most china phones have another GUI wrapped firmly around Android? I would make a lousy communist - a long time in correction facilities for me:silly: