# SwappyStats

`#include <swappy_common.h>`

Swappy frame statistics, collected if toggled on with [SwappyGL_enableStats](https://developer.android.com/games/sdk/reference/frame-pacing/group/swappy-g-l-extra#group__swappy_g_l__extra_1ga1191b042d23c0e3d9da59afd94d3c4b9) or [SwappyVk_enableStats](https://developer.android.com/games/sdk/reference/frame-pacing/group/swappy-vk#group__swappy_vk_1gac1b42c5baf4f351955df0c027aba14c2).

## Summary

| ### Public attributes ||
|---|---|
| `https://developer.android.com/games/sdk/reference/frame-pacing/struct/swappy-stats#struct_swappy_stats_1ad35d26710572f96861be92e2f2354077[MAX_FRAME_BUCKETS]` | `uint64_t` Histogram of the number of screen refreshes a frame waited in the compositor queue after rendering was completed. |
| `https://developer.android.com/games/sdk/reference/frame-pacing/struct/swappy-stats#struct_swappy_stats_1aec9d505abf96ddb6de437a5cd3644ab0[MAX_FRAME_BUCKETS]` | `uint64_t` Histogram of the number of screen refreshes passed between the requested presentation time and the actual present time. |
| `https://developer.android.com/games/sdk/reference/frame-pacing/struct/swappy-stats#struct_swappy_stats_1abf14e6e4fc84901ac6de10430dfd7129[MAX_FRAME_BUCKETS]` | `uint64_t` Histogram of the number of screen refreshes passed between the call to Swappy_recordFrameStart and the actual present time. |
| `https://developer.android.com/games/sdk/reference/frame-pacing/struct/swappy-stats#struct_swappy_stats_1ae48fcd61da70878460cec21e868fd9d8[MAX_FRAME_BUCKETS]` | `uint64_t` Histogram of the number of screen refreshes passed between two consecutive frames. |
| `https://developer.android.com/games/sdk/reference/frame-pacing/struct/swappy-stats#struct_swappy_stats_1a70ee8980b34e1b8cdb0d9050d125093d` | `uint64_t` Total frames swapped by swappy. |

## Public attributes

### idleFrames

```transact-sql
uint64_t SwappyStats::idleFrames[MAX_FRAME_BUCKETS]
```
Histogram of the number of screen refreshes a frame waited in the compositor queue after rendering was completed.

For example: if a frame waited 2 refresh periods in the compositor queue after rendering was done, the frame will be counted in idleFrames\[2\]

### lateFrames

```transact-sql
uint64_t SwappyStats::lateFrames[MAX_FRAME_BUCKETS]
```
Histogram of the number of screen refreshes passed between the requested presentation time and the actual present time.

For example: if a frame was presented 2 refresh periods after the requested timestamp swappy set, the frame will be counted in lateFrames\[2\]

### latencyFrames

```transact-sql
uint64_t SwappyStats::latencyFrames[MAX_FRAME_BUCKETS]
```
Histogram of the number of screen refreshes passed between the call to Swappy_recordFrameStart and the actual present time.

For example: if a frame was presented 2 refresh periods after the call to `Swappy_recordFrameStart` the frame will be counted in latencyFrames\[2\]

### offsetFromPreviousFrame

```transact-sql
uint64_t SwappyStats::offsetFromPreviousFrame[MAX_FRAME_BUCKETS]
```
Histogram of the number of screen refreshes passed between two consecutive frames.

For example: if frame N was presented 2 refresh periods after frame N-1 frame N will be counted in offsetFromPreviousFrame\[2\]

### totalFrames

```scdoc
uint64_t SwappyStats::totalFrames
```
Total frames swapped by swappy.