如何测量在Android VRAM消费? [英] How to measure VRAM consumption on Android?

查看:291
本文介绍了如何测量在Android VRAM消费?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要获取Android设备VRAM大小。

I want to acquire Android Device VRAM size.

是否有从计划收购的方法?

Is there a method for acquisition from the program?

推荐答案

让我们通过做一些计算的Nexus One:

Let's do some calculation using Nexus One:

屏幕分辨率480x800的是。所以最低要求的显存大小为:结果
     400 * 800 * 4 =字节字节1536000

Screen resolution is 480x800. So minimum required video memory size would be:
400 * 800 * 4 bytes = 1536000 bytes

假设驱动程序可能(按理说应该)使用几个缓冲区,我们也应该期望像值:

Assuming that driver may (and normally should) use several buffers, we should also expect values like:

1536000 * 2字节= 3072000字节结果
1536000 * 3字节= 4608000字节结果
等等...

这将是不可思议有不在的1536000(或宽x高,一般×4)多个值。

It would be weird to have values that are not multiple of 1536000 (or W x H x 4 in general).

在Android上的内部一些搜索,我发现这个<一个href=\"http://www.netmite.com/android/mydroid/development/pdk/docs/display_drivers.html\">documentation

After some searches on Android internals I've found this documentation :

... Android的使司机的两个要求:可映射内存的线性地址空间,它可以写...直接通过调用在/ dev / fb0设备...

...Android makes two requirements of the driver: a linear address space of mappable memory that it can write to directly...accessing the driver by calling open on /dev/fb0...

所以,我想,采取的/ dev /图形/ FB0 文件的大小(我的设备上没有的/ dev / fb0设备)。

So I tried and take size of /dev/graphics/fb0 file (on my device there is no /dev/fb0).

但直接的方法是行不通的:

But a direct approach doesn't work:

 File file = new File("/dev/graphics/fb0");
 file.length(); // ==0, doesn't work, no read access

使用下一个技巧,你可以得到的 FB0 实际尺寸:结果
    &GT;亚洲开发银行拉的/ dev /图形/ FB0 结果
     1659 KB /秒(在2.712s 4608000字节)

视频内存4MB〜(歌Nexus One)。让我们来看看,如果这是的Nexus屏幕尺寸的多:

Video memory is ~4mb (Nexus One). Let's check if this is multiple of Nexus screen size:

一百五十三万六千分之四百六十万八千= 3

它看起来像一个正确的价值。而且我们也可以说,驱动程序使用的的屏幕缓冲。

It looks like a right value. And we also can say that driver uses three screen buffers.

所以,作为一个结论,你可以使用亚行检测显存大小,但不能在适当的文件访问限制运行时使用这种方法从你的Andr​​oid应用程序。

So, as a conclusion, you can detect video memory size using adb, but you can't use this approach from your android application in runtime due to file access restrictions.

这篇关于如何测量在Android VRAM消费?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆