Android emulator performance on linux

2

I installed the android SDK and eclipse plugin on my laptop, but I was surprised to find out that the emulator eats up 100% of one of my cpu cores. I have exactly the same setup on a desktop machine that does not have this issue. Both computers are running arch linux and both were updated yesterday.

Granted, the desktop has better hardware than the laptop, but I was expecting to get closer to 50% cpu usage than 100% on the laptop.

Both android virtual devices have the same specs:

CPU: ARM
Target: Android 2.3.3 - API Level 10
Skin: WVGA800
SD Card: 512M
hw.lcd.density: 240
vm.heapSize: 24
hw.ramSize: 256

Laptop host has Intel Core 2 T7200 @ 2GHz cpu with 2Gb RAM.
Desktop host has AMD Phenom II X4 940 @ 3GHz cpu with 8Gb RAM.

The android emulator uses only 1 core and here are the CPU usage results:
Laptop:

Cpu0  : 22.8%us, 76.5%sy,  0.0%ni,  0.3%id,  0.0%wa,  0.0%hi,  0.3%si,  0.0%st
Cpu1  : 11.2%us,  2.4%sy,  0.0%ni, 86.4%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2055484k total,  1860304k used,   195180k free,     5276k buffers
Swap:  2000088k total,   106872k used,  1893216k free,   350780k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                       
 2026 xyz       20   0  396m 207m 7192 R  100 10.3   4:11.58 emulator-arm    

Desktop:

Cpu0  :  0.7%us,  0.0%sy,  0.0%ni, 99.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :  1.3%us,  0.0%sy,  0.0%ni, 98.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu2  :  5.0%us,  1.3%sy,  0.0%ni, 91.9%id,  1.7%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu3  :  0.3%us,  0.3%sy,  0.0%ni, 99.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   7666324k total,  6506808k used,  1159516k free,  1650960k buffers
Swap:  8988348k total,        0k used,  8988348k free,  2867300k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                            
 2811 xyz       20   0  392m 220m 6276 S    8  2.9   0:33.58 emulator-arm     

Is there any way I can improve the emulator performance on the laptop?

[UPDATE] I ran the emulator with the same settings, on the same laptop under Win7 and after starting up, it didn't use 100% of a CPU core unlike under linux. Also, I tried running the emulator from a terminal in Linux and I get this message when I don't get it under the desktop Linux host:

Could not configure '/dev/hpet' to have a 1024Hz timer. This is not a fatal error, but for better emulation accuracy type: 'echo 1024 > /proc/sys/dev/hpet/max-user-freq' as root.

I'm not really familiar with rtc or hpet, but it doesn't seem that max-user-freq setting does anything, I still get the same warning.

Rado

Posted 2012-02-13T03:39:03.447

Reputation: 509

Answers

1

Your AMD processor beats the Intel by more than you think, most likely. You can try emulating a smaller display size when running on the laptop, or you might consider running the emulator remotely on your desktop, using NX or similar.

There are also x86 ports of Android that supposedly run a lot faster (given that they run in a virtual machine, rather than being emulated), but I don't have any experience with using them.

jjlin

Posted 2012-02-13T03:39:03.447

Reputation: 12 964

It doesn't seem like a processor issue, but rather a kernel or system one. The emulator on the same processor does not always use 100% cpu under Win7 – Rado – 2012-02-14T13:50:23.497

1

There are many ways to increase performance of android emulator. The first and easiest way is increasing RAM as well as enable snapshot

Android AVD snapshot

You may also try lower the resolution when not doing something nonrelated to high resolution.

But the most effective method is downloading the Intel x86 image. If your CPU supports Virtualization (VT) then install Intel HAXM too, performance would be increased much more.

Android Intel x86 image

You can also try android x86 (tutorial here) in virtual machine and use adb connect IP command like debugging in a real device through wifi.

adb connect

adb connect term

phuclv

Posted 2012-02-13T03:39:03.447

Reputation: 14 930