FrameMetrics
public
final
class
FrameMetrics
extends Object
java.lang.Object | |
↳ | 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 | |
---|---|
int |
ANIMATION_DURATION
Metric identifier for animation callback duration. |
int |
COMMAND_ISSUE_DURATION
Metric identifier for command issue duration. |
int |
DEADLINE
Metric identifier for the total duration that was available to the app to produce a frame. |
int |
DRAW_DURATION
Metric identifier for draw duration. |
int |
FIRST_DRAW_FRAME
Metric identifier for a boolean value determining whether this frame was the first to draw in a new Window layout. |
int |
GPU_DURATION
Metric identifier for GPU duration. |
int |
INPUT_HANDLING_DURATION
Metric identifier for input handling duration. |
int |
INTENDED_VSYNC_TIMESTAMP
Metric identifier for the timestamp of the intended vsync for this frame. |
int |
LAYOUT_MEASURE_DURATION
Metric identifier for layout/measure duration. |
int |
SWAP_BUFFERS_DURATION
Metric identifier for swap buffers duration. |
int |
SYNC_DURATION
Metric identifier for sync duration. |
int |
TOTAL_DURATION
Metric identifier for total frame duration. |
int |
UNKNOWN_DELAY_DURATION
Metric identifier for unknown delay. |
int |
VSYNC_TIMESTAMP
Metric identifier for the timestamp of the actual vsync for this frame. |
Public constructors | |
---|---|
FrameMetrics(FrameMetrics other)
Constructs a FrameMetrics object as a copy. |
Public methods | |
---|---|
long
|
getMetric(int id)
Retrieves the value associated with Metric identifier |
Inherited methods | |
---|---|
Constants
ANIMATION_DURATION
public static final int ANIMATION_DURATION
Metric identifier for animation callback duration.
Represents the number of nanoseconds elapsed issuing animation callbacks.
Constant Value: 2 (0x00000002)
COMMAND_ISSUE_DURATION
public static final int COMMAND_ISSUE_DURATION
Metric identifier for command issue duration.
Represents the number of nanoseconds elapsed issuing draw commands to the GPU.
Constant Value: 6 (0x00000006)
DEADLINE
public static final int DEADLINE
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.
Constant Value: 13 (0x0000000d)
DRAW_DURATION
public static final int DRAW_DURATION
Metric identifier for draw duration.
Represents the number of nanoseconds elapsed computing DisplayLists for transformations applied to the view hierarchy.
Constant Value: 4 (0x00000004)
FIRST_DRAW_FRAME
public static final int FIRST_DRAW_FRAME
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.
Constant Value: 9 (0x00000009)
GPU_DURATION
public static final int GPU_DURATION
Metric identifier for GPU duration.
Represents the total time in nanoseconds this frame took to complete on the GPU.
Constant Value: 12 (0x0000000c)
INPUT_HANDLING_DURATION
public static final int INPUT_HANDLING_DURATION
Metric identifier for input handling duration.
Represents the number of nanoseconds elapsed issuing input handling callbacks.
Constant Value: 1 (0x00000001)
INTENDED_VSYNC_TIMESTAMP
public static final int INTENDED_VSYNC_TIMESTAMP
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.
Constant Value: 10 (0x0000000a)
LAYOUT_MEASURE_DURATION
public static final int LAYOUT_MEASURE_DURATION
Metric identifier for layout/measure duration.
Represents the number of nanoseconds elapsed measuring and laying out the invalidated pieces of the view hierarchy.
Constant Value: 3 (0x00000003)
SWAP_BUFFERS_DURATION
public static final int SWAP_BUFFERS_DURATION
Metric identifier for swap buffers duration.
Represents the number of nanoseconds elapsed issuing the frame buffer for this frame to the display subsystem.
Constant Value: 7 (0x00000007)
SYNC_DURATION
public static final int SYNC_DURATION
Metric identifier for sync duration.
Represents the number of nanoseconds elapsed synchronizing the computed display lists with the render thread.
Constant Value: 5 (0x00000005)
TOTAL_DURATION
public static final int TOTAL_DURATION
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.
Constant Value: 8 (0x00000008)
UNKNOWN_DELAY_DURATION
public static final int UNKNOWN_DELAY_DURATION
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.
Constant Value: 0 (0x00000000)
VSYNC_TIMESTAMP
public static final int VSYNC_TIMESTAMP
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.)
Constant Value: 11 (0x0000000b)
Public constructors
FrameMetrics
public FrameMetrics (FrameMetrics other)
Constructs a FrameMetrics object as a copy.
Use this method to copy out metrics reported by
Window.OnFrameMetricsAvailableListener#onFrameMetricsAvailable(
Window, FrameMetrics, int)
Parameters | |
---|---|
other |
FrameMetrics : the FrameMetrics object to copy. |
Public methods
getMetric
public long getMetric (int id)
Retrieves the value associated with Metric identifier id
for this frame.
Boolean metrics are represented in [0,1], with 0 corresponding to false, and 1 corresponding to true.
Parameters | |
---|---|
id |
int : the metric to retrieve
Value is UNKNOWN_DELAY_DURATION , INPUT_HANDLING_DURATION , ANIMATION_DURATION , LAYOUT_MEASURE_DURATION , DRAW_DURATION , SYNC_DURATION , COMMAND_ISSUE_DURATION , SWAP_BUFFERS_DURATION , TOTAL_DURATION , FIRST_DRAW_FRAME , INTENDED_VSYNC_TIMESTAMP , VSYNC_TIMESTAMP , GPU_DURATION , or DEADLINE |
Returns | |
---|---|
long |
the value of the metric or -1 if it is not available. |