RelativeFrameTimeHistogram


public class RelativeFrameTimeHistogram
extends Object

java.lang.Object
   ↳ android.app.jank.RelativeFrameTimeHistogram


A histogram of frame times relative to their deadline. This class aids in reporting AppJankStats to the system and is designed for use by library widgets. It facilitates the recording of frame times in relation to the frame deadline. The class records the distribution of time remaining until a frame is considered janky or how janky the frame was.

A frame's relative frame time value indicates whether it was delivered early, on time, or late. A negative relative frame time value indicates the frame was delivered early, a value of zero indicates the frame was delivered on time and a positive value indicates the frame was delivered late. The values of the endpoints indicate how early or late a frame was delivered.

The relative frame times are recorded as a histogram: values are added to a bucket by increasing the bucket's counter. The count of frames with a relative frame time between bucket endpoints i and i+1 can be obtained through index i of getBucketCounters().

Summary

Public constructors

RelativeFrameTimeHistogram()

Create a new instance of RelativeFrameTimeHistogram.

Public methods

void addRelativeFrameTimeMillis(int frameTimeMillis)

Increases the count by one for the bucket representing the relative frame time.

int[] getBucketCounters()

Returns the counts for the all the relative frame time buckets.

int[] getBucketEndpointsMillis()

Returns the relative frame time endpoints for the histogram.

Inherited methods

Public constructors

RelativeFrameTimeHistogram

public RelativeFrameTimeHistogram ()

Create a new instance of RelativeFrameTimeHistogram.

Public methods

addRelativeFrameTimeMillis

public void addRelativeFrameTimeMillis (int frameTimeMillis)

Increases the count by one for the bucket representing the relative frame time.

Parameters
frameTimeMillis int: relative frame time in millis, relative frame time is the difference between a frames deadline and when it was rendered.

getBucketCounters

public int[] getBucketCounters ()

Returns the counts for the all the relative frame time buckets.

Returns
int[] an array of integers representing the counts of relative frame times. This value cannot be null.

getBucketEndpointsMillis

public int[] getBucketEndpointsMillis ()

Returns the relative frame time endpoints for the histogram.

Index i of getBucketCounters() contains the count of frames that had a relative frame time between endpoints[i] (inclusive) and endpoints[i+1] (exclusive).

Returns
int[] array of integers representing the endpoints for the predefined histogram count buckets. This value cannot be null.