Locking the CPU on android for app performance testing

与世无争的帅哥 提交于 2019-12-04 14:26:19

问题


I'm trying to test an app's performance on android at different CPU states. So i will like to lock the CPU at say 1000Mhz and take readings and then overload the CPU and take readings. My question is: Is there anyway to lock the CPU and possibly the RAM at certain lock/freeze rates?? Any link to documentations on this will be highly appreciated.


回答1:


Follow these steps(all steps with root privilege):
1. stop mpdecision
2. In /sys/devices/system/cpu you can see how many cores in your device, if dual core, you will see cpu0 and cpu1 two folders.
3. write 0 or 1 to disable or enable core

echo "0" > /sys/devices/system/cpu/cpu1/online # disable core
echo "1" > /sys/devices/system/cpu/cpu1/online # enable core

4. change governor of CPU

echo "userspace" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

5. set frequency

echo "1000000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

remember to check /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq to see what frequency you can set in step 5.

For step 4 and 5, you can set frequency through this app(need root privilege).

For more details, you can see this.



来源:https://stackoverflow.com/questions/25911722/locking-the-cpu-on-android-for-app-performance-testing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!