| Package | laya.utils |
| Class | public class Stat |
| Inheritance | Stat Object |
Stat 是一个性能统计面板,可以实时更新相关的性能参数。
参与统计的性能参数如下(所有参数都是每大约1秒进行更新): FPS(Canvas)/FPS(WebGL):Canvas 模式或者 WebGL 模式下的帧频,也就是每秒显示的帧数,值越高、越稳定,感觉越流畅; Sprite:统计所有渲染节点(包括容器)数量,它的大小会影响引擎进行节点遍历、数据组织和渲染的效率。其值越小,游戏运行效率越高; DrawCall:此值是决定性能的重要指标,其值越小,游戏运行效率越高。Canvas模式下表示每大约1秒的图像绘制次数;WebGL模式下表示每大约1秒的渲染提交批次,每次准备数据并通知GPU渲染绘制的过程称为1次DrawCall,在每次DrawCall中除了在通知GPU的渲染上比较耗时之外,切换材质与shader也是非常耗时的操作; CurMem:Canvas模式下,表示内存占用大小,值越小越好,过高会导致游戏闪退;WebGL模式下,表示内存与显存的占用,值越小越好; Shader:是 WebGL 模式独有的性能指标,表示每大约1秒 Shader 提交次数,值越小越好; Canvas:由三个数值组成,只有设置 CacheAs 后才会有值,默认为0/0/0。从左到右数值的意义分别为:每帧重绘的画布数量 / 缓存类型为"normal"类型的画布数量 / 缓存类型为"bitmap"类型的画布数量。
| Property | Defined By | ||
|---|---|---|---|
| canvasBitmap : int = 0 [static] 画布 canvas 使用位图渲染的次数。 | Stat | ||
| canvasNormal : int = 0 [static] 画布 canvas 使用标准渲染的次数。 | Stat | ||
| canvasReCache : int = 0 [static] 画布 canvas 缓冲区重绘次数。 | Stat | ||
| currentMemorySize : int [static] 资源管理器所管理资源的累计内存,以字节为单位。 | Stat | ||
| drawCall : int = 0 [static] 描绘次数。 | Stat | ||
| FPS : int = 0 [static] 每秒帧数。 | Stat | ||
| loopCount : int = 0 [static] 主舞台 Stage 渲染次数计数。 | Stat | ||
| onclick : Function [static] [write-only]
点击性能统计显示区域的处理函数。
| Stat | ||
| renderSlow : Boolean = false [static] 表示当前使用的是否为慢渲染模式。 | Stat | ||
| shaderCall : int = 0 [static] 着色器请求次数。 | Stat | ||
| spriteCount : int = 0 [static] 精灵Sprite 的数量。 | Stat | ||
| treeNodeCollision : int = 0 [static] 八叉树节点检测次数。 | Stat | ||
| treeSpriteCollision : int = 0 [static] 八叉树精灵碰撞检测次数。 | Stat | ||
| trianglesFaces : int = 0 [static] 三角形面数。 | Stat | ||
| Method | Defined By | ||
|---|---|---|---|
enable():void [static] 激活性能统计 | Stat | ||
hide():void [static]
隐藏性能统计信息。
| Stat | ||
show(x:Number = 0, y:Number = 0):void [static]
显示性能统计信息。
| Stat | ||
| canvasBitmap | property |
public static var canvasBitmap:int = 0画布 canvas 使用位图渲染的次数。
| canvasNormal | property |
public static var canvasNormal:int = 0画布 canvas 使用标准渲染的次数。
| canvasReCache | property |
public static var canvasReCache:int = 0画布 canvas 缓冲区重绘次数。
| currentMemorySize | property |
public static var currentMemorySize:int资源管理器所管理资源的累计内存,以字节为单位。
| drawCall | property |
public static var drawCall:int = 0描绘次数。
| FPS | property |
public static var FPS:int = 0每秒帧数。
| loopCount | property |
public static var loopCount:int = 0主舞台 Stage 渲染次数计数。
| onclick | property |
onclick:Function [write-only] 点击性能统计显示区域的处理函数。
public static function set onclick(value:Function):void| renderSlow | property |
public static var renderSlow:Boolean = false表示当前使用的是否为慢渲染模式。
| shaderCall | property |
public static var shaderCall:int = 0着色器请求次数。
| spriteCount | property |
public static var spriteCount:int = 0 精灵Sprite 的数量。
| treeNodeCollision | property |
public static var treeNodeCollision:int = 0八叉树节点检测次数。
| treeSpriteCollision | property |
public static var treeSpriteCollision:int = 0八叉树精灵碰撞检测次数。
| trianglesFaces | property |
public static var trianglesFaces:int = 0三角形面数。
| enable | () | method |
public static function enable():void激活性能统计
| hide | () | method |
public static function hide():void隐藏性能统计信息。
| show | () | method |
public static function show(x:Number = 0, y:Number = 0):void显示性能统计信息。
Parameters
x:Number (default = 0) — X轴显示位置。
| |
y:Number (default = 0) — Y轴显示位置。
|