Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/app/jank/RelativeFrameTimeHistogram#pubctors) \| [Methods](https://developer.android.com/reference/android/app/jank/RelativeFrameTimeHistogram#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/jank/RelativeFrameTimeHistogram#inhmethods)

# RelativeFrameTimeHistogram

*** ** * ** ***

` public class RelativeFrameTimeHistogram `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.jank.RelativeFrameTimeHistogram |

<br />

*** ** * ** ***

A histogram of frame times relative to their deadline. This class aids in reporting `https://developer.android.com/reference/android/app/jank/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 `https://developer.android.com/reference/android/app/jank/RelativeFrameTimeHistogram#addRelativeFrameTimeMillis(int)` to a bucket by increasing the bucket's counter. The count of frames with a relative frame time between `https://developer.android.com/reference/android/app/jank/RelativeFrameTimeHistogram#getBucketEndpointsMillis()` `i` and `i+1` can be obtained through index `i` of `https://developer.android.com/reference/android/app/jank/RelativeFrameTimeHistogram#getBucketCounters()`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/jank/RelativeFrameTimeHistogram#RelativeFrameTimeHistogram()() ` Create a new instance of RelativeFrameTimeHistogram. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/app/jank/RelativeFrameTimeHistogram#addRelativeFrameTimeMillis(int)(int frameTimeMillis) ` Increases the count by one for the bucket representing the relative frame time. |
| ` int[]` | ` https://developer.android.com/reference/android/app/jank/RelativeFrameTimeHistogram#getBucketCounters()() ` Returns the counts for the all the relative frame time buckets. |
| ` int[]` | ` https://developer.android.com/reference/android/app/jank/RelativeFrameTimeHistogram#getBucketEndpointsMillis()() ` Returns the relative frame time endpoints for the histogram. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### RelativeFrameTimeHistogram

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public RelativeFrameTimeHistogram ()
```

Create a new instance of RelativeFrameTimeHistogram.

<br />

## Public methods

### addRelativeFrameTimeMillis

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addRelativeFrameTimeMillis (int frameTimeMillis)
```

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

<br />

| Parameters ||
|---|---|
| `frameTimeMillis` | `int`: relative frame time in millis, relative frame time is the difference between a frames deadline and when it was rendered. <br /> |

### getBucketCounters

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int[] getBucketCounters ()
```

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

<br />

| Returns ||
|---|---|
| `int[]` | an array of integers representing the counts of relative frame times. This value cannot be null. <br /> |

### getBucketEndpointsMillis

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int[] getBucketEndpointsMillis ()
```

Returns the relative frame time endpoints for the histogram.

Index `i` of `https://developer.android.com/reference/android/app/jank/RelativeFrameTimeHistogram#getBucketCounters()` contains the count of frames that had a relative frame time between `endpoints[i]` (inclusive) and `endpoints[i+1]` (exclusive).

<br />

| Returns ||
|---|---|
| `int[]` | array of integers representing the endpoints for the predefined histogram count buckets. This value cannot be null. <br /> |