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

2024-02-18

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

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

Device - 26api - 48Mb device 26api

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

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

Device - 24api - 52Mb device

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

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

Device - 22Api - 50Mb device2

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

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


这取决于你的配置方式Emulator如果你有很多RAM with HAXM.

这可以提高你的应用程序的性能System.gc() if Emulator RAM超过Device.

但这不是唯一的事情,你可以配置你的HAXM加速度HAXM加速文档 https://developer.android.com/studio/run/emulator-acceleration#accel-vm.

解释

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.)

使用 Memory Profiler Doc 查看 Java 堆和内存分配 https://developer.android.com/studio/profile/memory-profiler

那么为什么你的Graphic use is to 0Mb是因为Memory Profiler计算之间共享的内存CPU and GPU不致力于GPU.

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

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

随机推荐