# legacy::FPSCounter

<a id="fpscounter"></a>

# FPSCounter

```cpp
#include <icy/av/fpscounter.h>

struct FPSCounter
```

[Defined in src/av/include/icy/av/fpscounter.h:86](https://github.com/auscaster/icey/blob/main/src/av/include/icy/av/fpscounter.h#L86)

Legacy frames-per-second counter.

## Public Attributes

| Return | Name | Description |
|--------|------|-------------|
| `clock_t` | [`start`](#start-17)  |  |
| `clock_t` | [`end`](#end-3)  |  |
| `int64_t` | [`frames`](#frames)  |  |
| `double` | [`total`](#total)  |  |
| `double` | [`fps`](#fps-1)  |  |

---

<a id="start-17"></a>

### start

```cpp
clock_t start
```

[Defined in src/av/include/icy/av/fpscounter.h:88](https://github.com/auscaster/icey/blob/main/src/av/include/icy/av/fpscounter.h#L88)

---

<a id="end-3"></a>

### end

```cpp
clock_t end
```

[Defined in src/av/include/icy/av/fpscounter.h:89](https://github.com/auscaster/icey/blob/main/src/av/include/icy/av/fpscounter.h#L89)

---

<a id="frames"></a>

### frames

```cpp
int64_t frames
```

[Defined in src/av/include/icy/av/fpscounter.h:90](https://github.com/auscaster/icey/blob/main/src/av/include/icy/av/fpscounter.h#L90)

---

<a id="total"></a>

### total

```cpp
double total
```

[Defined in src/av/include/icy/av/fpscounter.h:91](https://github.com/auscaster/icey/blob/main/src/av/include/icy/av/fpscounter.h#L91)

---

<a id="fps-1"></a>

### fps

```cpp
double fps
```

[Defined in src/av/include/icy/av/fpscounter.h:92](https://github.com/auscaster/icey/blob/main/src/av/include/icy/av/fpscounter.h#L92)

## Public Methods

| Return | Name | Description |
|--------|------|-------------|
|  | [`FPSCounter`](#fpscounter-1) `inline` |  |
| `void` | [`tick`](#tick) `inline` | Begin a new timing cycle (calls [endFrame()](#endframe) first if already started). |
| `void` | [`reset`](#reset-9) `inline` | Reset all counters to zero. |
| `bool` | [`started`](#started) `inline` |  |
| `void` | [`startFrame`](#startframe) `inline` | Record the frame start time. |
| `double` | [`endFrame`](#endframe) `inline` | Record the frame end time and update the cumulative FPS average. |

---

<a id="fpscounter-1"></a>

### FPSCounter

`inline`

```cpp
inline FPSCounter()
```

[Defined in src/av/include/icy/av/fpscounter.h:94](https://github.com/auscaster/icey/blob/main/src/av/include/icy/av/fpscounter.h#L94)

---

<a id="tick"></a>

### tick

`inline`

```cpp
inline void tick()
```

[Defined in src/av/include/icy/av/fpscounter.h:100](https://github.com/auscaster/icey/blob/main/src/av/include/icy/av/fpscounter.h#L100)

Begin a new timing cycle (calls [endFrame()](#endframe) first if already started).

---

<a id="reset-9"></a>

### reset

`inline`

```cpp
inline void reset()
```

[Defined in src/av/include/icy/av/fpscounter.h:108](https://github.com/auscaster/icey/blob/main/src/av/include/icy/av/fpscounter.h#L108)

Reset all counters to zero.

---

<a id="started"></a>

### started

`inline`

```cpp
inline bool started()
```

[Defined in src/av/include/icy/av/fpscounter.h:118](https://github.com/auscaster/icey/blob/main/src/av/include/icy/av/fpscounter.h#L118)

#### Returns
True if [startFrame()](#startframe) has been called and the timer is running.

---

<a id="startframe"></a>

### startFrame

`inline`

```cpp
inline void startFrame()
```

[Defined in src/av/include/icy/av/fpscounter.h:124](https://github.com/auscaster/icey/blob/main/src/av/include/icy/av/fpscounter.h#L124)

Record the frame start time.

---

<a id="endframe"></a>

### endFrame

`inline`

```cpp
inline double endFrame()
```

[Defined in src/av/include/icy/av/fpscounter.h:131](https://github.com/auscaster/icey/blob/main/src/av/include/icy/av/fpscounter.h#L131)

Record the frame end time and update the cumulative FPS average. 
#### Returns
The updated FPS value.
