UiDebugSnapshot
Read-only per-frame timings, render counts, and texture-cache metrics.
Overview
Obtain UiDebugSnapshot from UIContext#debugCounters().snapshot(). The snapshot belongs to one captured frame and contains sanitized frame timing, command and batch counts, plus texture-cache activity. GPU timing can be -1 when the active backend cannot measure it; other counters and timings are non-negative.
Read frame metrics
UiDebugSnapshot snapshot = context.debugCounters().snapshot();
if (snapshot.frameGpuMillis() >= 0.0f) {
logGpuTime(snapshot.frameGpuMillis());
}
logRenderLoad(snapshot.drawCommandCount(), snapshot.batchCount());
API
Frame
| Method | Description |
|---|---|
frameIndex() |
Returns the frame index represented by this snapshot. |
UiDebugSnapshot::frameIndex()
frameIndex()
Returns the frame index represented by this snapshot.
Returns long: Captured frame index.
Frame Timing
| Method | Description |
|---|---|
framesPerSecond() |
Returns measured frames per second, or zero when unavailable. |
frameTotalMillis() |
Returns total wall-clock time for the frame. |
frameGpuMillis() |
Returns GPU frame time when the backend exposes it. |
UiDebugSnapshot::framesPerSecond()
framesPerSecond()
Returns measured frames per second, or zero when unavailable.
Returns float: Non-negative frames-per-second value.
UiDebugSnapshot::frameTotalMillis()
frameTotalMillis()
Returns total wall-clock time for the frame.
Returns float: Non-negative duration in milliseconds.
UiDebugSnapshot::frameGpuMillis()
frameGpuMillis()
Returns GPU frame time when the backend exposes it.
Returns float: GPU duration in milliseconds, or -1 when unavailable.
Render Work
| Method | Description |
|---|---|
drawCommandCount() |
Returns the number of draw-list commands recorded for the frame. |
batchCount() |
Returns the number of backend batches recorded for the frame. |
UiDebugSnapshot::drawCommandCount()
drawCommandCount()
Returns the number of draw-list commands recorded for the frame.
Returns int: Non-negative draw-command count.
UiDebugSnapshot::batchCount()
batchCount()
Returns the number of backend batches recorded for the frame.
Returns int: Non-negative batch count.
Texture Cache
| Method | Description |
|---|---|
lastTextureCacheMissReason() |
Returns the latest normalized texture-cache miss reason. |
UiDebugSnapshot::lastTextureCacheMissReason()
lastTextureCacheMissReason()
Returns the latest normalized texture-cache miss reason.
Returns String: Miss reason, or NONE when no reason is available.