public final class FrameMetrics extends Object
Supported metrics can be queried via their corresponding identifier.
Modifier and Type | Class and Description |
---|---|
static interface |
FrameMetrics.Metric
Identifiers for metrics available for each frame.
|
Modifier and Type | Field and Description |
---|---|
static int |
ANIMATION_DURATION
Metric identifier for animation callback duration.
|
static int |
COMMAND_ISSUE_DURATION
Metric identifier for command issue duration.
|
static int |
DRAW_DURATION
Metric identifier for draw duration.
|
static int |
FIRST_DRAW_FRAME
Metric identifier for a boolean value determining whether this frame was
the first to draw in a new Window layout.
|
static int |
INPUT_HANDLING_DURATION
Metric identifier for input handling duration.
|
static int |
LAYOUT_MEASURE_DURATION
Metric identifier for layout/measure duration.
|
static int |
SWAP_BUFFERS_DURATION
Metric identifier for swap buffers duration.
|
static int |
SYNC_DURATION
Metric identifier for sync duration.
|
static int |
TOTAL_DURATION
Metric identifier for total frame duration.
|
static int |
UNKNOWN_DELAY_DURATION
Metric identifier for unknown delay.
|
Constructor and Description |
---|
FrameMetrics(FrameMetrics other)
Constructs a FrameMetrics object as a copy.
|
Modifier and Type | Method and Description |
---|---|
long |
getMetric(int id)
Retrieves the value associated with Metric identifier
id
for this frame. |
public static final int UNKNOWN_DELAY_DURATION
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.
public static final int INPUT_HANDLING_DURATION
Represents the number of nanoseconds elapsed issuing input handling callbacks.
public static final int ANIMATION_DURATION
Represents the number of nanoseconds elapsed issuing animation callbacks.
public static final int LAYOUT_MEASURE_DURATION
Represents the number of nanoseconds elapsed measuring and laying out the invalidated pieces of the view hierarchy.
public static final int DRAW_DURATION
Represents the number of nanoseconds elapsed computing DisplayLists for transformations applied to the view hierarchy.
public static final int SYNC_DURATION
Represents the number of nanoseconds elapsed synchronizing the computed display lists with the render thread.
public static final int COMMAND_ISSUE_DURATION
Represents the number of nanoseconds elapsed issuing draw commands to the GPU.
public static final int SWAP_BUFFERS_DURATION
Represents the number of nanoseconds elapsed issuing the frame buffer for this frame to the display subsystem.
public static final int TOTAL_DURATION
Represents the total time in nanoseconds this frame took to render and be issued to the display subsystem.
Equal to the sum of the values of all other time-valued metric identifiers.
public static final int FIRST_DRAW_FRAME
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.
public FrameMetrics(FrameMetrics other)
Use this method to copy out metrics reported by
Window.OnFrameMetricsAvailableListener.onFrameMetricsAvailable(
Window, FrameMetrics, int)
other
- the FrameMetrics object to copy.public long getMetric(int id)
id
for this frame.
Boolean metrics are represented in [0,1], with 0 corresponding to false, and 1 corresponding to true.
id
- the metric to retrieve