Tracks actual tick work duration and idle/sleep time separately from tick rate, via zero-arg begin/end pairs (skele_clock_tick_begin/end, skele_clock_idle_begin/end) rather than passed timestamps, since the prior interval-between-calls approach just measured the fixed tick period, not real processing cost.
27 lines
532 B
C
27 lines
532 B
C
#ifndef SKELE_CLOCK_H
|
|
#define SKELE_CLOCK_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
extern float skele_tps;
|
|
extern uint64_t skele_tick_time_ns;
|
|
extern uint64_t skele_tick_idle_ns;
|
|
|
|
void skele_clock_init(void (*on_signal)(void));
|
|
uint64_t skele_time_ns(void);
|
|
void skele_sleep_ns(uint64_t ns);
|
|
void skele_clock_tick_begin(void);
|
|
void skele_clock_tick_end(void);
|
|
void skele_clock_idle_begin(void);
|
|
void skele_clock_idle_end(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* SKELE_CLOCK_H */
|