Forcing all 4 CPU cores to 2.26GHz? - Nexus 5 Q&A, Help & Troubleshooting

Hi. I'm trying to optimize some computer vision code, but variable CPU core frequencies is making it extremely hard to quantify any improvements I make. Basically I want to be able to force all 4 cores to 2.26GHz so that my test environment can be consistent. I'm currently running rooted Lineage OS 14.1.
I have tried doing the following through a root shell:
Code:
stop mpdecision
echo "1" > /sys/devices/system/cpu/cpu0/online
echo "1" > /sys/devices/system/cpu/cpu1/online
echo "1" > /sys/devices/system/cpu/cpu2/online
echo "1" > /sys/devices/system/cpu/cpu3/online
echo "2265000"> /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "2265000"> /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo "2265000"> /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
echo "2265000"> /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
echo "2265000"> /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "2265000"> /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo "2265000"> /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
echo "2265000"> /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
After doing this, CPU-Z shows all 4 cores running at 2.26GHz - great! But, while running my code, the performance immediately starts to drop. Upon re-opening CPU-Z, it shows all 4 cores running at ~1500-1900MHz. What gives?

Thermal throttling.
You need to delete or modify /system/etc/thermal-engine-8974.conf
Note: This could make your device run really hot.

Kotaless said:
Thermal throttling.
You need to delete or modify /system/etc/thermal-engine-8974.conf
Note: This could make your device run really hot.
Click to expand...
Click to collapse
Ah, ok, I had a hunch it might be that. Any guidance on max safe temp? Somewhere around 85C maybe? I can always put the phone on top of an icepack while running my code hahaha
Also, which value do I need to modify?
Code:
[CPU0_MONITOR]
algo_type monitor
sensor cpu0
sampling 65
thresholds 115000
thresholds_clr 110000
actions shutdown
action_info 0

Ok so I did some testing, without modifying the thermal-engine.conf file, here's what I found:
Code:
Applying load, idling at 45C:
Runs at 2.26GHz until hitting 67C;
Runs at 1.96GHz for a little bit;
Settles at 1.57Ghz @ 66C
When removing load:
Starting at 1.57GHz @ 65C
Ramps up to 1.96GHz @ 53C
Ramps up to 2.26GHz @ 51C
It looks like throttling starts at 67C and ends at 51C, but none of those values appear in the thermal-engine file. The only value that even looks remotely close is the sampling value, but I'm assuming that's some sort of sampling interval parameter, no?

Well I found a Qualcomm PDF about the DragonBoard 410 that happened to mention
Code:
~# stop thermal-engine
and what do you know, it must apply to the SD800 too, because it worked

Good for you.
I modified this part for myself.
Code:
[SKIN_THERMAL_management_1]
algo_type monitor
sensor xo_therm_pu2
sampling 10000
thresholds 40000 42000 44000
thresholds_clr 38500 40500 42500
actions cpu+lcd cpu+lcd cpu+lcd
action_info 1958400+229 1728000+204 1574400+178

Related

[Q] Ultimate Batterysaving by underclocking/undervolting

I mainly use my xt720 for phone calls, internet browsing/chatting, music,.. not any cpu intensive stuffs. My main concern for my phone is battery. Currently, these are the 2 things I have done to possibly prolong my battery charge:
1) Milestone overclock --> running at 720mhz @ 40vsel
2) setCPU --> set minimum to 150mhz (maximum remains at 720mhz)
Am I doing right?
Another question is, when I set it to run at 720mhz @ 40vsel, will the phone still use 40vsel at 150mhz when idling/screen off? or does the phone itself bring the vsel lower during 150mhz idling time? if not, are there possible ways to undervolt at each individual cpu speed level?
thank you for your help, any suggestion is appreciated
my save mode script use 125/28~350/32
but it has no perfomance problem for base work and call
dateno1 said:
my save mode script use 125/28~350/32
but it has no perfomance problem for base work and call
Click to expand...
Click to collapse
thanks for the reply!
do you mind telling me what the "save mode script" is? is that part of milestone overclock or SetCPU? Please give future steps
I think i finally figured it out... PLEASE let me know if I'm doing anything wrong
1) setCPU --> minimum to 125mhz, max. to 720mhz
2) created "oc-settings" file with the following lines:
#!/system/bin/sh
echo 40 > /proc/overclock/max_vsel
echo 720000 > /proc/overclock/max_rate
echo 1 125000000 12 > /proc/overclock/mpu_opps
echo 2 250000000 26 > /proc/overclock/mpu_opps
echo 3 400000000 30 > /proc/overclock/mpu_opps
echo 4 600000000 34 > /proc/overclock/mpu_opps
echo 5 720000000 40 > /proc/overclock/mpu_opps
echo 0 720000 > /proc/overclock/freq_table
echo 1 600000 > /proc/overclock/freq_table
echo 2 400000 > /proc/overclock/freq_table
echo 3 250000 > /proc/overclock/freq_table
echo 4 125000 > /proc/overclock/freq_table
Click to expand...
Click to collapse
I rebooted the phone and checked the "/proc/overclock/mpu_opps" file and the frequency/vsel values have been updated to the ones above.
If I am doing it correctly, then everytime the phone reboots, I would have the following frequency/vsel:
125mhz - 12vsel
250mhz - 26vsel
400mhz - 30vsel
600mhz - 34vsel
720mhz - 40vsel
Please let me know if I did it correctly. I cannot find a way to verify whether I have successfully set these vsels into each frequency, and SetCPU does not seem to display vsel values.
Also, in setCPU, where it tells you the time spent in each frequency, it still lists the frequency as 125,250,500,550,720.

[Q] Sonya v2 not throttling down all the way

Hey imhaving an issue with my underclock... I have it set to 250 500 900 and 1200 and it seems to get stuck on 500 after its running for a while, and the only thing that fixes it is to restart the phone any ideas why this is happening?
I eventually stopped underclocking to 250 because of this.
You might try altering the up and down thresholds in the governor settings in SetCPU (or similar apps or maybe manually echoing them to the proc governor structure).
I never really bothered messing with it as the battery life with the extended battery is amazing anyway
moofree said:
I eventually stopped underclocking to 250 because of this.
You might try altering the up and down thresholds in the governor settings in SetCPU (or similar apps or maybe manually echoing them to the proc governor structure).
I never really bothered messing with it as the battery life with the extended battery is amazing anyway
Click to expand...
Click to collapse
Right on maybe ill try using set CPU I don't cause its not necisary... I've never had this problem before with 250 until now.... what about the frequencies setting after the actual 250 setting could that help?
EDIT --- SET CPU DOES NOT FIX THIS PROB.... any other ideas anyone?
EDIT2--- My buddy that knows more than me is going to mess with the uv voltages and see if that is the issue, i think its something in the backbground that wont die when i kill processes....?????
Edit 3... been working with my friend here are my new settings if anyone wants to use them .... working really well....
#!/system/bin/sh
#
# init.d script for Milestone Overclock Simplified version 1.5
if [ -e /system/lib/modules/symsearch.ko ]; then
insmod /system/lib/modules/symsearch.ko
if [ $? -eq 0 ]; then
echo "symsearch.ko loaded!"
if [ -e /system/lib/modules/overclock.ko ]; then
insmod /system/lib/modules/overclock.ko
if [ $? -eq 0 ]; then
echo "overclock.ko loaded!"
else
echo "Damn, overclock.ko failed to load"
fi
else
echo "Damn, overclock.ko missing"
fi
else
echo "Damn, symsearch.ko failed to load"
fi
else
echo "Damn, symsearch.ko missing"
fi
# MPU a.k.a. CPU Overclocking, edit to suit your needs
#
# *** Warning, only run custom settings at boot after thoroughly testing. ***
#
# Uncomment and modify for your device. The numbers below are known
# stock settings. If you have device not listed here, please run the
# following command, and send the output to [email protected]
# Your stock settings will be added. This is also how you can verify
# changes you've made. From teminal/adb/script:
#
# cat /proc/overclock/*
#
# The format for modifying frequency for a given CPU slot is as follows.
#
# echo <opp_id> <frequency_in_hz> <uV_voltage> > /proc/overclock/mpu_opps
#
if [ -e /proc/overclock/mpu_opps ]; then
# Droid3/Bionic/Atrix2 stock Settings
echo 3 1200000000 1405000 > /proc/overclock/mpu_opps
echo 2 840000000 1357000 > /proc/overclock/mpu_opps
echo 1 500000000 1217000 > /proc/overclock/mpu_opps
echo 0 250000000 1105000 > /proc/overclock/mpu_opps
fi
# GPU Overclocking, uncomment the line with desired frequency
#
# Stock: 307.2MHz
# Underclock: 256MHz
# Overclock: 384MHz
#
if [ -e /proc/overclock/gpu_opps ]; then
echo 250000000 > /proc/overclock/gpu_opps
# echo 384000000 > /proc/overclock/gpu_opps
fi

[COLLECTION] Scripts&Explaination [06/07]

This is a collection of echo scripts with optimized values for our janice (i9070&i9070P).
I will add an explanation for every tweak to make things clear.
BATTERY
Code:
[COLOR="Red"]deepest_state[/COLOR]: this allow you to set a sleep level. As far as I know, 3-4-5 states are available; major is the state, better your phone will sleep and so less battery draining (obviously while screen is off).
A tip: I think that 4 state is the best, it doesn't cause troubles on the contrary of the 5 level that may causes problems, but it is stable if using ONDEMAND as governor.
[COLOR="Blue"]echo "4" > /d/cpuidle/deepest_state;[/COLOR]
Code:
[COLOR="Red"]dirty_expire_centisecs[/COLOR]: In hundredths of a second, how old data must be to be written out next time a thread wakes to perform periodic writeback. As I know, permitted values are 100 to 5000, but if I'm wrong, don't esitate to correct me!
[COLOR="Blue"]echo "5000" > /proc/sys/vm/dirty_expire_centisecs;[/COLOR]
Code:
[COLOR="Red"]dirty_writeback_centisecs[/COLOR]: In hundredths of a second, how often threads should wake up to write data back out to disk.
[COLOR="Blue"]echo "5000" > /proc/sys/vm/dirty_writeback_centisecs;[/COLOR]
Code:
[COLOR="Red"]laptop_mode[/COLOR]: is a special page writeback strategy intended to optimize battery life by minimizing memory activity. My tip is to take it off.
[COLOR="Blue"]echo "0" > /proc/sys/vm/laptop_mode;[/COLOR]
Code:
[COLOR="Red"]max_ac_c[/COLOR]: Is a CoCore kernel feature that allow to edit the chargin' values. Safe values are among 100 to 700, put an higher value may damage your battery, instead putting lower value (400 for example) it will preserve battery life.
[COLOR="blue"]echo "400" > /sys/kernel/abb-charger/max_ac_c;[/COLOR]
PERFORMANCE
Code:
[COLOR="Red"]mali_l2_max_reads[/COLOR]: Set max reads that mali l2 can do.
[COLOR="Blue"]echo "48" > /sys/module/mali/parameters/mali_l2_max_reads;[/COLOR]
Code:
[COLOR="Red"]mali_debug_level[/COLOR]: Disabling it, you can gain some performance improvements.
[COLOR="Blue"]echo "0" > /sys/module/mali/parameters/mali_debug_level;[/COLOR]
Code:
[COLOR="Red"]fsync[/COLOR]: Fsync is an android capability that always writes data out to the memory preventing data loss. If you have a stable system, disable it and you'll have: more battery life, faster system. But be careful you may loose all of your data if your phone shuts down suddenly.
[COLOR="Blue"]echo "0" > /sys/kernel/fsync/mode;[/COLOR] // To enable (default)
[COLOR="Blue"]echo "1" > /sys/kernel/fsync/mode;[/COLOR] // To disable
[COLOR="Blue"]echo "2" > /sys/kernel/fsync/mode;[/COLOR] // Dynamic (writes data only when screen is off)
Code:
[COLOR="Red"]vfs_cache_pressure[/COLOR]: File system cache is really more important than the block cache above in dirty ratio and dirty background ratio, so we really want the kernel to use up much more of the RAM for file system cache, this will increase the performance of the system without sacrificing performance at the application level. Lower value is better (100 is the max), so for example:
[COLOR="Blue"]echo "10" > /proc/sys/vm/vfs_cache_pressure;[/COLOR]
Code:
[COLOR="red"]page-cluster[/COLOR]: This controls the number of pages which are written to swap in a single attempt.
It is a logarithmic value - setting it to zero means "1 page", setting it to 1 means "2 pages", setting it to 2 means "4 pages", etc.
[COLOR="Blue"]echo "3" > /proc/sys/vm/page-cluster;[/COLOR]
SD CARD
Code:
The default value of sd card cache is 128, but some various tests have estabilished that if you increase this value to 2048, you'll have improvements in write and read sd card operations.
[COLOR="Blue"]echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
echo "2048" > /sys/devices/virtual/bdi/7:0/read_ahead_kb;
echo "2048" > /sys/devices/virtual/bdi/7:1/read_ahead_kb;
echo "2048" > /sys/devices/virtual/bdi/7:2/read_ahead_kb;
echo "2048" > /sys/devices/virtual/bdi/7:3/read_ahead_kb;
echo "2048" > /sys/devices/virtual/bdi/7:4/read_ahead_kb;
echo "2048" > /sys/devices/virtual/bdi/7:5/read_ahead_kb;
echo "2048" > /sys/devices/virtual/bdi/7:6/read_ahead_kb;
echo "2048" > /sys/devices/virtual/bdi/7:7/read_ahead_kb;
echo "2048" > /sys/devices/virtual/bdi/default/read_ahead_kb;[/COLOR]
Code:
[COLOR="Blue"]This should block charging when phone reaches 100% and recharge phone when is 50% (Thanks to [user=2855249]@bobfrantic[/user]).
THIS IS ONLY WORKING WITH COCORE KERNEL[/COLOR]
echo on > /sys/kernel/abb-fg/fg_cyc
echo dischar=100 > /sys/kernel/abb-fg/fg_cyc
echo rechar=50 > /sys/kernel/abb-fg/fg_cyc
I will add more tweaks, stay tuned guys
@hastalafiesta
No DL on OP?
---------- Post added at 02:56 AM ---------- Previous post was at 02:47 AM ----------
Do you have Purging of assets and kernel sampage merging enabled manually in AOSPA with this script? Or only KSM?
Thanks
coffeecore said:
@hastalafiesta
No DL on OP?
---------- Post added at 02:56 AM ---------- Previous post was at 02:47 AM ----------
Do you have Purging of assets and kernel sampage merging enabled manually in AOSPA with this script? Or only KSM?
Thanks
Click to expand...
Click to collapse
I will also add here a script. Nope both (ksm and purging of assets) disabled

Galaxy tab 4 7" t230nu Intro.Tips n Ideas

Hey everyone! My name is Kori. So i have been homeless for awhile.Been usinf 2 lg motions as my enertainment.Watching video and typing was annoying on such small screens.
About new years i got a few extra bucks and ended up buying a Samsung Galaxy tab 4 7".
This thing was possessed with Demon Scripts. 2 minutes after my first boot i get notifications the phone cant see my eyes. Every time i touched the phone or even thought about it Power Manager,SSRM and DVFS get twitchy and bump my cpu_minfreq to max.
Chargin my battery isnt always possible when your "Camping" So i began Un-Development.
Then noticing Low Volume ,Weird Wifi and several other problems
My wifi would drop or data transfer would drop. I found that when connected with low signal icould run file in /system/bin called oem_iptables_init.sh would g3t me a data flow again. Then i noticed there seemed to be 2 sets of wifi and bluetooth drivers.
Anyways heres the bulk.
I have removed almost ALL the junk i dont need.
Selinux disabled. Knox is disabled
telephony is all gone. All but the jar and odex in frame"though i removed all permissions to the odex.
Nvm is gone and doesnt load. That means all rf reductionstables as well.
Csc is gone
nothing loads from /NVM , /etc/tel or /system/csc
removed Enterprise SSRM Dvfs has been cut out. Turned off all motion .palm swipe,air motion,smart stay and whatever else
Also managed to Stop several services that are useless to me
So nothing THERE IS NOTHING IN CONTROL OF MY CPUS EXCEPT FOR MY INIT.D SCRIPTS.AHhhhh
i have None of the original apps such as
touchwiz home,keyboard.camera,gallery,Lets say everything¡
All thats left from stock is like google play 'and its apps',settings,mtp,vpn,kies,bluetooth,cert installerand a few others
I mean completley stripped
i have a ton of apps on my phone including 5 or 6 social apps and 2 messenger apps. After a bootup phone idles on one cpu core on st 312 with about 700 to 650 mb of free ram
yes,i unlocked the Hotplug feature.And drastically changed the load balancing to the cores.
This allows the phone to Turn On and Off cpu cores as it needs. Saving battery life with great performance.
I have managed to Increase Volume also.Woooooo
Battery is way better now ,much better wifi. Tons of room in system for my apps. I control my phone now not Google Samsung Selinux Knox Enterprise NVM SSRM DVFS MPDCand all the others.
I have cool init.d setup i made with basically 7 init.d setups or profiles to choose from to exe at boot as well as 6 profiles you can run in realtime. Also 2 sysctl profiles to choose to boit from or exe in realtime.
Also i have tons of init.d settings for this tab i like.
Gettin tired of typing So i will be back with several How tos for you.
but here is something to play with
unlock hotplug
/sys/devices/system/cpu/hotplug/lock change to zero
This the current setup i have Though i think i need a few adjustments in load balancing
But it nice. Lets cpu idle and perform o cpu0 only but keeps a second core close to Help
Keeping the other 2 cores off until really needed
echo "0" > /sys/devices/system/cpu/hotplug/lock
echo "312000" > /sys/devices/system/cpu/hotplug/bound_freq
echo "10" > /sys/devices/system/cpu/hotplug/load_h0
echo "40" > /sys/devices/system/cpu/hotplug/load_h1
echo "70" > /sys/devices/system/cpu/hotplug/load_h2
echo "16" > /sys/devices/system/cpu/hotplug/load_l1
echo "35" > /sys/devices/system/cpu/hotplug/load_l2
echo "50" > /sys/devices/system/cpu/hotplug/load_l3
using this as Governor settings
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
#chmod 777 /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
#echo "990000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
chmod 777 /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
chmod 777 /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo "1" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
Aslo keeping the cores limited to 1066 mhz max.
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "1066000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
Alright going 10-7
Over
Anyone else try it out?? Just wondering if you really can remove all that, and everything work.
Sent from my SM-T230NU using XDA-Developers mobile app

Decreasing temperature, saving battery

Some people don't like how warm the phonne gets. This can be tweaked with the thermal-engine.conf located in system/etc (requires root). Just edit the file with a text editor.
Note: The thermal-engine might have a different name or there might be multiple engines, just look for these entries. Since I don't own the phone, I can't verify this. Since it uses the same SOC (Snapdragon 808) as the LG G4 and Nexus 5X, it should also work similarly.
This is the throttle temperature for the big cluster
Code:
[SS-SKIN-XO-THERM-PERF]
set_point [COLOR="RoyalBlue"][B]43[/B][/COLOR]000
set_point_clr [COLOR="royalblue"][B]37[/B][/COLOR]000
Hotplug CPU4
Code:
[CPU4_HOTPLUG_MONITOR]
thresholds [COLOR="RoyalBlue"][B]42[/B][/COLOR]000
thresholds_clr [B][COLOR="royalblue"]37[/COLOR][/B]000
CPU5
Code:
[CPU5_HOTPLUG_MONITOR]
thresholds [COLOR="royalblue"][B]45[/B][/COLOR]000
thresholds_clr [B][COLOR="royalblue"]40[/COLOR][/B]000
Little cluster
Code:
[SS-SKIN-XO-THERM-POWER]
set_point [COLOR="royalblue"][B]48[/B][/COLOR]000
set_point_clr [COLOR="royalblue"][B]40[/B][/COLOR]000
GPU
Code:
[GPU_management]
thresholds [COLOR="royalblue"][B]40[/B][/COLOR]000 [COLOR="royalblue"][B]43[/B][/COLOR]000 [COLOR="royalblue"][B]47[/B][/COLOR]000 [COLOR="royalblue"][B]50[/B][/COLOR]000
thresholds_clr [COLOR="royalblue"][B]37[/B][/COLOR]000 [COLOR="royalblue"][B]40[/B][/COLOR]000 [COLOR="royalblue"][B]43[/B][/COLOR]000 [COLOR="royalblue"][B]47[/B][/COLOR]000
battery, this reduces the charging current at the specified temperature
Code:
[MONITOR_QUIET_THERM_BATTERY]
thresholds [COLOR="royalblue"][B]38[/B][/COLOR]000 [COLOR="royalblue"][B]40[/B][/COLOR]000 [COLOR="royalblue"][B]42[/B][/COLOR]000 [COLOR="royalblue"][B]44[/B][/COLOR]000
thresholds_clr [COLOR="royalblue"][B]35[/B][/COLOR]000 [COLOR="royalblue"][B]38[/B][/COLOR]000 [COLOR="royalblue"][B]40[/B][/COLOR]000 [COLOR="royalblue"][B]42[/B][/COLOR]000
All other values I would leave at standard. I'm actually not quite sure what they do. Some influence sensor polling rate others something unknown.
If you think your phone gets too hot you can lower all the blue values by 2-4°C. This should be a good compromise between heat and performance. Once you are done, save the file and restart.
so insted of having 43000 in some values we set it at 38000 for instance? Did you do it and does it work?
geokor said:
so insted of having 43000 in some values we set it at 38000 for instance? Did you do it and does it work?
Click to expand...
Click to collapse
Sorry for the late reply, but I don't own the phone so I can't verify this. It works the same way on the LG G4 and Nexus 5X, though.

Categories

Resources