summaryrefslogtreecommitdiff
path: root/src/dged/timers.h
blob: ee2b14e67dec230bdf62abb3c1bcff92f0e52018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef _TIMERS_H
#define _TIMERS_H

#include <stdint.h>

struct timer;

void timers_init(void);
void timers_start_frame(void);

struct timer *timer_start(const char *name);
uint64_t timer_stop(struct timer *timer);
struct timer *timer_get(const char *name);
float timer_average(const struct timer *timer);
uint64_t timer_min(const struct timer *timer);
uint64_t timer_max(const struct timer *timer);
const char *timer_name(const struct timer *timer);

typedef void (*timer_callback)(const struct timer *timer, void *userdata);
void timers_for_each(timer_callback callback, void *userdata);

void timers_end_frame(void);
void timers_destroy(void);

uint64_t instant_ns(void);

#endif