Locking the CPU on android for app performance testing

前端 未结 1 435
南笙
南笙 2021-02-11 04:21

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

1条回答
  •  借酒劲吻你
    2021-02-11 05:05

    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.

    0 讨论(0)
提交回复
热议问题