I have an android app, playing back HLS.
And I'm very curious about why Android Studio's CPU usage monitor shows so different loads:
AVD: Kernel: ~2% / User: ~0% :
My Sony Z3: Kernel: ~5% / User: ~30% :
And there are no other background services run to load my Z3 so badly, I assure you.
Yep, the only obvious difference I see - AVD uses software decoder OMX.google.aac.decoder, but Z3 uses OMX.qcom.audio.decoder.aac (hardware, I guess).
AVD uses the CPU of your computer which is much faster than your phone. So only a few percentage of CPU cycles are required by the AVD whereas more percentage is required in a phone.
Also the decoder's implementation makes the difference. But generally hardware decoder are faster than software decoders. So this should not be the case.
Related
I'm currently running two emulators on two different computers. Both emulators are running the same application.
Specs for Computer A:
Processor - Intel Core i5 3230M CPU # 2.60 GHz
RAM - 6.00 GB (5.89 GB)
System - 64 bit
This computer runs two servers EasyPHP, Openfire, and a web browser.
Specs for Computer B:
Processor - Intel Core i5 2320M CPU # 3.00 GHz
RAM - 6.00 GB (5.89 GB)
System - 64 bit
This computer does not run much, other than android studio and the emulator.
Computer A is extremely laggy and experiences high values of
Skipped 516 frames! The application may be doing too much work on its main thread.
Computer B on the other hand not only boots the emulator faster but the application performances smoothly. Computers B application has more View objects than Computer As. I have tried using TraceView, but the output does not give me anything useful concerning the application. It mostly outs long run time for O.S functions such as Android.os.MessageQueue.nativepollOnce, Android.view.ThreadedRenderer and the like.
If the problem is a code and or view issue then why is Computer B not experiencing poor performance? Is there another way, other than TraceView/sysTrace, that measures code performance? Does using AsyncTask hurt performance more than a normal thread does? (I've been hesitant on using normal threads due to manual thread management)
I am making an android app. When I run it on the emulator, which has 512 MiB RAM, a simple activity takes 3 seconds to complete. Will this time be lower on a real device, as 3 seconds is inacceptably long! If it will be lower then by what factor( an estimate will do)? Thanks.
It really depends on exactly what you're doing, but as a rule of the thumb, devices are much faster than emulators.
Emulators are slow because an entire ARM process architecture is emulated through software, which adds a (big) extra layer between the Android system and your computer's processor.
Trying using one of the x86 intel images for a faster emulator closer to device speeds.
However, no emulator will give you the same speed as a device.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Slow Android emulator
is it my computer's hardware limitation? it has 1024 megabytes of ram 2200 x 2 dual core amd cpu i can't develop any android. the emulators are heavy what can I do? i download old sdk and newer ones but it still the same.
You could try using the x86 (Atom) system image it's faster than the arm images
See this link for more info
I have much better PC than you and even I have difficulties with emulating some OpenGL ES applications that I develop for android.
You must understand that emulating a CPU which is different than current architecture is very hard to do and as such very hard to do very optimized. Running machine code for ARM on x86 must bring some delays in running it. Conversion and repacking back and forth.
I would rather try to use your own Android device for testing and debuging purposes instead of emulator. It runs in real time and it will be better for you if you don't want to upgrade your CPU and RAM.
1 gigabyte of ram isn't enough. Eclipse alone would take up almost a two-thirds of that
(mine takes up 900mb - tweaked in eclipse.ini), and a 2.2 Emulator on HomeScreen would take up about 200mb. Unless you don't open anything else while coding - firefox, chrome (that ram sucker of a browser), mail client, chat client, etc., you're only a pinch below the limit.
The best you can do outside of upgrading memory is to run emulator in QVGA (in AVD Manager, click on your virtual device, click edit, under Skin, change Built-in to QVGA. But it would only do so much - you need at least 4 gig to go smoothly with all other apps open.
What is the difference between iPhone Simulator and Android emulator? I have heard people saying that Emulator really emulates the target device which is not true in case of simulator.
I think Android emulator mimics the processing speed of the target device, the memory usage, but a simulator does not emulate the device.
Disclaimer: I'm only an iPhone developer, not an Android developer.
You are correct, the difference between emulators and simulators is that emulators mimic the software and hardware environments found on actual devices. Simulators, on the other hand, only mimic the software environment; they otherwise have access to all of the host system's hardware resources such as disk space, memory and processor speed.
Apple always harps on the importance of device testing because iPhone Simulator does not emulate an iPhone processor, disk drive, memory constraints and whatnot. You hardly ever get memory warnings unless your Mac is struggling to manage resources itself, unless you simulate (again) memory warnings from the Simulator's menu item.
In fact, if you go to Settings > General > About, you'll see that the Simulator's disk capacity is the same as the filesystem of the Mac it's installed on:
Though android emulator emulates the ARM processors and certain hardware, it still doesn't do a good job of matching the CPU performance.
Being an emulator it can match Memory consumption well, it can emulate certain simple devices well but fails when the devices gets complicated for example mobile GPU and HW media decoders. And as the emulation logic works on translating each ARM instruction to X86 instruction and executing its a performance hog and by design not cycle accurate.
With programming model being Java this design doesn't buy anything to the Application developer as the performance on emulator doesn't reflect performance on device (due to speed of emulation and due to missing HW devices) and more often is is an inconvenience as debug cycles are slow. The only advantage being Application complied for emulator work as it is on devices (no recompilation).
In the simulator model of iPhone Apple realized they are not going to match device perfectly, so they do not even try and in return give developers a fast cycle time and enhanced tool support to develop applications effectively.
I am working on a compute intensive app for Android. I do not have any device yet to test performance. However, the performance on emulator is a bit slower than expected.
I see an old question about some estimation of emulator vs device. What are your experiences while developing apps with recent SDK Froyo/2.2. Is performance observed on emulator is slower than actual device.
Please share your experience and the specs of your dev machine and mobile devices, both.
Note: To get virtual device's CPU speed one can run cat /proc/cpuinfo from adb shell. How is this comparable to actual device's CPU frequency?
Processor : ARM926EJ-S rev 5 (v5l)
BogoMIPS : 240.02
From a CPU standpoint, the emulator tends to be slower than actual hardware, presumably due to the overhead of converting ARM bytecodes to x86 ones on the fly.
From a graphics standpoint, the emulator tends to be dramatically slower than actual hardware, because the emulator lacks hardware graphics acceleration (regardless of the quality of the host computer's video card).
From a disk I/O standpoint, the emulator tends to be faster than actual hardware, particularly on write operations. Flash writes can be very slow, depending on a wide range of criteria (wear leveling, percentage of the flash storage that is in use, etc.). Brad Fitzpatrick covered this topic in his Writing zippy Android applications presentation at the 2010 Google I|O conference.
From a network standpoint, the emulator can be faster than actual hardware, because WiFi or wired Ethernet hooked up to broadband will typically be faster than a mobile data connection.
Yes true the emulator is slower than a real device. I have quite a decent development computer and it still is slower.
Here are my specs.
CPU: AMD Phenom X4 940BE (3GHz)
RAM: 8GB Corsair (800MHz)
GFX: Nvidia 9800 GTX+
MBD: Asus M3A78T
HDD: WesternDigital Velociraptor SATA2 (10k RPM)
OS: Ubuntu Lucid Lynx 64bit
And still it is quite slow compared to a real device.
Quick answer. I have found the emulator to be slower than real devices, even on my relatively fast PC.
if you install a SSD (solid State Drive) that will help a lot. i can see that you cpu and ram are decent but the simulator is pretty heavy (lots of rendering .. etc) and a faster Disk can be very helpful.