Android Studio - Emulator Profile and Device Profile VERY different

天涯浪子 提交于 2019-12-10 10:48:51

问题


I came across this while asking a different question, why does the Android Emulator show such a different performance profile than a comparable device profile?

Specifically, the device calls a huge graphics section that is not visible on the emulator... is there a reason for this?

Device - 26api - 48Mb

Emulator (Pixel2) - 26api - 24Mb - Hardware Graphics

Emulator (Pixel2) - 26api - 54Mb - Software Graphics

Device - 24api - 52Mb

Emulator (Pixel2) - 24api - Hardware Graphics - 15Mb

Emulator (Pixel2) - 24api - Software Graphics - 40Mb

Device - 22Api - 50Mb

Emulator (Pixel2) - 22api - Hardware Graphics - 14Mb

Emulator (Pixel2) - 22api - Software Graphics - 40Mb


回答1:


This depend on how your configure Emulator if you a good amount of RAM with HAXM.

This can improve your performance app have less System.gc() if Emulator RAM is more than Device.

But is not the only things and you can configure your HAXM acceleration HAXM acceleration Doc.

Explaination

Without acceleration, the emulator takes the machine code from the VM and translates it block by block to conform to the architecture of the host computer. This process can be quite slow. But, if the VM and the architecture of the host computer match (such as x86 on x86), the emulator can skip translating the code and simply run it directly on the actual CPU using a hypervisor. In this case, the emulator can approach the speed of the host computer.

Explaination 2

When you create an Android Virtual Device (AVD) in the AVD Manager, you can specify that graphics acceleration occur in hardware or software to emulate the GPU of the virtual device. Hardware acceleration is typically faster. Software acceleration is useful if your computer uses graphics drivers that aren't compatible with the emulator, in which case hardware graphics rendering can be poor or cause the emulator to crash.

The default is to let the emulator decide if it should use hardware or software graphics acceleration based on your computer setup. If the GPU hardware and drivers are compatible, the emulator uses the GPU; otherwise, the emulator uses the CPU to simulate GPU processing.

Graphics: Memory used for graphics buffer queues to display pixels to the screen, including GL surfaces, GL textures, and so on. (Note that this is memory shared with the CPU, not dedicated GPU memory.)

View the Java heap and memory allocations with Memory Profiler Doc

So why your Graphic use is to 0Mb is because the Memory Profiler calculating the memory shared between CPU and GPU not dedicated to GPU.

So is 0Mb because you use hardware I think instead of software to emulate the GPU.



来源:https://stackoverflow.com/questions/51622841/android-studio-emulator-profile-and-device-profile-very-different

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