Added in API level 24

FrameMetrics


class FrameMetrics
kotlin.Any
   ↳ android.view.FrameMetrics

Class containing timing data for various milestones in a frame lifecycle reported by the rendering subsystem.

Supported metrics can be queried via their corresponding identifier.

Summary

Constants
static Int

Metric identifier for animation callback duration.

static Int

Metric identifier for command issue duration.

static Int

Metric identifier for the total duration that was available to the app to produce a frame.

static Int

Metric identifier for draw duration.

static Int

Metric identifier for a boolean value determining whether this frame was the first to draw in a new Window layout.

static Int

Metric identifier for GPU duration.

static Int

Metric identifier for input handling duration.

static Int

Metric identifier for the timestamp of the intended vsync for this frame.

static Int

Metric identifier for layout/measure duration.

static Int

Metric identifier for swap buffers duration.

static Int

Metric identifier for sync duration.

static Int

Metric identifier for total frame duration.

static Int

Metric identifier for unknown delay.

static Int

Metric identifier for the timestamp of the actual vsync for this frame.

Public constructors

Constructs a FrameMetrics object as a copy.

Public methods
Long

Retrieves the value associated with Metric identifier id for this frame.

Constants

ANIMATION_DURATION

Added in API level 24
static val ANIMATION_DURATION: Int

Metric identifier for animation callback duration.

Represents the number of nanoseconds elapsed issuing animation callbacks.

Value: 2

COMMAND_ISSUE_DURATION

Added in API level 24
static val COMMAND_ISSUE_DURATION: Int

Metric identifier for command issue duration.

Represents the number of nanoseconds elapsed issuing draw commands to the GPU.

Value: 6

DEADLINE

Added in API level 31
static val DEADLINE: Int

Metric identifier for the total duration that was available to the app to produce a frame.

Represents the total time in nanoseconds the system allocated for the app to produce its frame. If FrameMetrics.TOTAL_DURATION < FrameMetrics.DEADLINE, the app hit its intended deadline and there was no jank visible to the user.

Value: 13

DRAW_DURATION

Added in API level 24
static val DRAW_DURATION: Int

Metric identifier for draw duration.

Represents the number of nanoseconds elapsed computing DisplayLists for transformations applied to the view hierarchy.

Value: 4

FIRST_DRAW_FRAME

Added in API level 24
static val FIRST_DRAW_FRAME: Int

Metric identifier for a boolean value determining whether this frame was the first to draw in a new Window layout.

getMetric(int) will return 0 for false, 1 for true.

First draw frames are expected to be slow and should usually be exempt from display jank calculations as they do not cause skips in animations and are usually hidden by window animations or other tricks.

Value: 9

GPU_DURATION

Added in API level 31
static val GPU_DURATION: Int

Metric identifier for GPU duration.

Represents the total time in nanoseconds this frame took to complete on the GPU.

Value: 12

INPUT_HANDLING_DURATION

Added in API level 24
static val INPUT_HANDLING_DURATION: Int

Metric identifier for input handling duration.

Represents the number of nanoseconds elapsed issuing input handling callbacks.

Value: 1

INTENDED_VSYNC_TIMESTAMP

Added in API level 26
static val INTENDED_VSYNC_TIMESTAMP: Int

Metric identifier for the timestamp of the intended vsync for this frame.

The intended start point for the frame. If this value is different from VSYNC_TIMESTAMP, there was work occurring on the UI thread that prevented it from responding to the vsync signal in a timely fashion.

Value: 10

LAYOUT_MEASURE_DURATION

Added in API level 24
static val LAYOUT_MEASURE_DURATION: Int

Metric identifier for layout/measure duration.

Represents the number of nanoseconds elapsed measuring and laying out the invalidated pieces of the view hierarchy.

Value: 3

SWAP_BUFFERS_DURATION

Added in API level 24
static val SWAP_BUFFERS_DURATION: Int

Metric identifier for swap buffers duration.

Represents the number of nanoseconds elapsed issuing the frame buffer for this frame to the display subsystem.

Value: 7

SYNC_DURATION

Added in API level 24
static val SYNC_DURATION: Int

Metric identifier for sync duration.

Represents the number of nanoseconds elapsed synchronizing the computed display lists with the render thread.

Value: 5

TOTAL_DURATION

Added in API level 24
static val TOTAL_DURATION: Int

Metric identifier for total frame duration.

Represents the total time in nanoseconds this frame took to render and be issued to the display subsystem.

The total duration is the difference in time between when the frame began and when it ended. This value may not be exactly equal to the sum of the values of all other time-valued metric identifiers because some stages may happen concurrently.

Value: 8

UNKNOWN_DELAY_DURATION

Added in API level 24
static val UNKNOWN_DELAY_DURATION: Int

Metric identifier for unknown delay.

Represents the number of nanoseconds elapsed waiting for the UI thread to become responsive and process the frame. This should be 0 most of the time.

Value: 0

VSYNC_TIMESTAMP

Added in API level 26
static val VSYNC_TIMESTAMP: Int

Metric identifier for the timestamp of the actual vsync for this frame.

The time value that was used in all the vsync listeners and drawing for the frame (Choreographer frame callbacks, animations, View#getDrawingTime(), etc.)

Value: 11

Public constructors

FrameMetrics

Added in API level 24
FrameMetrics(other: FrameMetrics!)

Constructs a FrameMetrics object as a copy.

Use this method to copy out metrics reported by Window.OnFrameMetricsAvailableListener#onFrameMetricsAvailable(

Parameters
other FrameMetrics!: the FrameMetrics object to copy.

Public methods