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.
Asked
Active
Viewed 4,948 times
3
-
on a device or the emulator? – JRsz Sep 18 '14 at 11:43
-
Hi..sorry on an actual android device – user3312054 Sep 18 '14 at 11:47
-
You can try my answer, I tried in Nexus 4, and it works fine. – PageNotFound Sep 18 '14 at 11:59
-
Does my answer work? – PageNotFound Sep 19 '14 at 06:51
-
yes it did..another thing please, is the anyway to "programatically" load the CPU and make it very busy? – user3312054 Sep 19 '14 at 12:31
-
1Just do some calculation. For multi cores, just start multi threads. I think you should ask another question for this. – PageNotFound Sep 19 '14 at 12:43
1 Answers
7
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.

PageNotFound
- 2,320
- 2
- 23
- 34
-
Ok will try that and report back. Also do i send thede commands through adb shell?? – user3312054 Sep 18 '14 at 12:02
-
3Yes, through `adb shell`, first `adb shell`, then `su`, and follow my steps – PageNotFound Sep 18 '14 at 12:03
-
yes this is certainly the correct answer..thank you for the link also..very nice – user3312054 Sep 19 '14 at 12:30
-
can you please edit step 4 of your answer, it should be scaling_governor without an s @PageNotFound – user3312054 Sep 20 '14 at 10:28