gavl: Software timer

gavl

Typedefs | Functions
Software timer
Time

## Typedefs
typedef struct gavl_timer_s | gavl_timer_t
| Opaque timer structure.

## Functions
GAVL_PUBLIC gavl_timer_t * | gavl_timer_create (void)
| Create a timer.
GAVL_PUBLIC void | gavl_timer_destroy (gavl_timer_t *timer)
| Destroy a timer.
GAVL_PUBLIC void | gavl_timer_start (gavl_timer_t *timer)
| Start a timer.
GAVL_PUBLIC void | gavl_timer_stop (gavl_timer_t *timer)
| Stop a timer.
GAVL_PUBLIC gavl_time_t | gavl_timer_get (gavl_timer_t *timer)
| Get the current time of the timer.
GAVL_PUBLIC int | gavl_timer_is_running (gavl_timer_t *timer)
| Check if a timer is running.
GAVL_PUBLIC void | gavl_timer_set (gavl_timer_t *timer, gavl_time_t t)
| Set the current time of the timer.
GAVL_PUBLIC uint64_t | gavl_benchmark_get_time (int flags)
| Get the current time for benchmarking.
GAVL_PUBLIC const char * | gavl_benchmark_get_desc (int flags)
| Get a description about the value returned by gavl_benchmark_get_time.

## Detailed Description

This is a simple software timer, which can be used for synchronization purposes for cases wherer there is no synchronization with hardware devices available.

## Typedef Documentation

## ◆ gavl_timer_t

typedef struct gavl_timer_s gavl_timer_t

Opaque timer structure.

You don't want to know what's inside.

## Function Documentation

## ◆ gavl_timer_create()

GAVL_PUBLIC gavl_timer_t * gavl_timer_create | ( | void |  | ) |

Create a timer.

Returns
  A newly allocated timer

## ◆ gavl_timer_destroy()

GAVL_PUBLIC void gavl_timer_destroy | ( | gavl_timer_t * | timer | ) |

Destroy a timer.

Parameters

  Software timer | A timer

Destroys a timer and frees all associated memory

## ◆ gavl_timer_start()

GAVL_PUBLIC void gavl_timer_start | ( | gavl_timer_t * | timer | ) |

Start a timer.

Parameters

  Software timer | A timer

## ◆ gavl_timer_stop()

GAVL_PUBLIC void gavl_timer_stop | ( | gavl_timer_t * | timer | ) |

Stop a timer.

Parameters

  Software timer | A timer

## ◆ gavl_timer_get()

GAVL_PUBLIC gavl_time_t gavl_timer_get | ( | gavl_timer_t * | timer | ) |

Get the current time of the timer.

Parameters

  Software timer | A timer

Returns
  Current time

## ◆ gavl_timer_is_running()

GAVL_PUBLIC int gavl_timer_is_running | ( | gavl_timer_t * | timer | ) |

Check if a timer is running.

Parameters

  Software timer | A timer

Returns
  1 if the timer is running, 0 else

## ◆ gavl_timer_set()

GAVL_PUBLIC void gavl_timer_set | ( | gavl_timer_t * | timer,
|  | gavl_time_t | t )

Set the current time of the timer.

Parameters

  Software timer | A timer
  t | New time

## ◆ gavl_benchmark_get_time()

GAVL_PUBLIC uint64_t gavl_benchmark_get_time | ( | int | flags | ) |

Get the current time for benchmarking.

Parameters

  flags | Flags returned by gavl_accel_supported

Returns
  The time in arbitrary units

The returned value itself is meaningless since the timescale depends on the system. Use this only for relative comparisons for benchmarks. A textual description on how the values can be interpreted can be obtained with gavl_benchmark_get_desc

## ◆ gavl_benchmark_get_desc()

GAVL_PUBLIC const char * gavl_benchmark_get_desc | ( | int | flags | ) |

Get a description about the value returned by gavl_benchmark_get_time.

Parameters

  flags | Flags returned by gavl_accel_supported

Returns
  A string describing what the time value means