Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/view/FrameStats#constants) \| [Ctors](https://developer.android.com/reference/android/view/FrameStats#pubctors) \| [Methods](https://developer.android.com/reference/android/view/FrameStats#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/view/FrameStats#inhmethods)

# FrameStats

*** ** * ** ***


`
public


abstract
class
FrameStats
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.view.FrameStats |

|---|
| Known direct subclasses [WindowAnimationFrameStats](https://developer.android.com/reference/android/view/WindowAnimationFrameStats), [WindowContentFrameStats](https://developer.android.com/reference/android/view/WindowContentFrameStats) |---|---| | [WindowAnimationFrameStats](https://developer.android.com/reference/android/view/WindowAnimationFrameStats) | *This class was deprecated in API level 34. Use Shared [FrameTimeline](https://perfetto.dev/docs/data-sources/frametimeline) jank metrics instead.* | | [WindowContentFrameStats](https://developer.android.com/reference/android/view/WindowContentFrameStats) | This class contains window content frame statistics. | |

<br />

*** ** * ** ***

This is the base class for frame statistics.

## Summary

| ### Constants ||
|---|---|
| `long` | `https://developer.android.com/reference/android/view/FrameStats#UNDEFINED_TIME_NANO` Undefined time. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/view/FrameStats#FrameStats()() ` |

| ### Public methods ||
|---|---|
| ` final long` | ` https://developer.android.com/reference/android/view/FrameStats#getEndTimeNano()() ` Gets the end time of the interval for which these statistics apply. |
| ` final int` | ` https://developer.android.com/reference/android/view/FrameStats#getFrameCount()() ` Gets the number of frames for which there is data. |
| ` final long` | ` https://developer.android.com/reference/android/view/FrameStats#getFramePresentedTimeNano(int)(int index) ` Get the time a frame at a given index was presented. |
| ` final long` | ` https://developer.android.com/reference/android/view/FrameStats#getRefreshPeriodNano()() ` Gets the refresh period of the display hosting the window(s) for which these statistics apply. |
| ` final long` | ` https://developer.android.com/reference/android/view/FrameStats#getStartTimeNano()() ` Gets the start time of the interval for which these statistics apply. |

| ### 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*. | ||

## Constants

### UNDEFINED_TIME_NANO

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

```
public static final long UNDEFINED_TIME_NANO
```

Undefined time.

<br />

Constant Value:

-1
(0xffffffffffffffff)


## Public constructors

### FrameStats

```
public FrameStats ()
```

<br />

<br />

## Public methods

### getEndTimeNano

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

```
public final long getEndTimeNano ()
```

Gets the end time of the interval for which these statistics
apply. The end interval is the time when the last frame was
presented.

<br />

| Returns ||
|---|---|
| `long` | The end time in nanoseconds or `https://developer.android.com/reference/android/view/FrameStats#UNDEFINED_TIME_NANO` if there is no frame data. <br /> |

### getFrameCount

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

```
public final int getFrameCount ()
```

Gets the number of frames for which there is data.

<br />

| Returns ||
|---|---|
| `int` | The number of frames. <br /> |

### getFramePresentedTimeNano

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

```
public final long getFramePresentedTimeNano (int index)
```

Get the time a frame at a given index was presented.

<br />

| Parameters ||
|---|---|
| `index` | `int`: The frame index. <br /> |

| Returns ||
|---|---|
| `long` | The presented time in nanoseconds or `https://developer.android.com/reference/android/view/FrameStats#UNDEFINED_TIME_NANO` if the frame is not presented yet. <br /> |

### getRefreshPeriodNano

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

```
public final long getRefreshPeriodNano ()
```

Gets the refresh period of the display hosting the window(s) for
which these statistics apply.

<br />

| Returns ||
|---|---|
| `long` | The refresh period in nanoseconds. <br /> |

### getStartTimeNano

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

```
public final long getStartTimeNano ()
```

Gets the start time of the interval for which these statistics
apply. The start interval is the time when the first frame was
presented.

<br />

| Returns ||
|---|---|
| `long` | The start time in nanoseconds or `https://developer.android.com/reference/android/view/FrameStats#UNDEFINED_TIME_NANO` if there is no frame data. <br /> |