Android Studio-模拟器配置文件和设备配置文件非常不同

时间:2018-07-31 22:12:25

标签: android performance android-studio android-emulator

我在问一个不同的问题时遇到了这个问题,为什么Android模拟器显示的性能配置文件与可比较的设备配置文件如此不同?

具体来说,设备会调用一个巨大的图形部分,而该部分在模拟器上不可见...这是有原因的吗?

设备-26api-48Mb device 26api

仿真器(Pixel2)-26api-24Mb-硬件图形 26api

仿真器(Pixel2)-26api-54Mb-软件图形 26api

设备-24api-52Mb device

仿真器(Pixel2)-24api-硬件图形-15Mb pixel2

仿真器(Pixel2)-24api-软件图形-40Mb pixel2 software

设备-22Api-50Mb device2

仿真器(Pixel2)-22api-硬件图形-14Mb pixel2 22

仿真器(Pixel2)-22api-软件图形-40Mb pixel2 22

1 个答案:

答案 0 :(得分:1)

这取决于您如何使用Emulator配置RAMHAXM

如果System.gc() Emulator大于RAM,则可以减少Device的应用性能。

但这不是唯一的事情,您可以配置HAXM加速HAXM acceleration Doc

说明

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.

说明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

所以您的Graphic use之所以成为0Mb的原因是因为Memory Profiler计算CPUGPU之间共享的内存不是专用于GPU

0Mb也是如此,因为我认为您使用的是hardware而不是software to emulate the GPU