blob: 3d0a82f2d0d011df25a7688091b447a7bac8d184 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// file : core/timer.h
// project : Salis-VM
// author : Paul Oliver <contact@pauloliver.dev>
//
// Utilities to help measure time intervals and simulation speed.
#pragma once
struct Timer {
struct timespec time_start;
float time_delta;
};
struct TimerSPS {
struct Timer timer;
uint64_t step_start;
float steps_per_sec;
};
void timer_reset(struct Timer *timer);
void timer_measure(struct Timer *timer);
void timer_sps_reset(struct TimerSPS *timer_sps);
void timer_sps_measure(struct TimerSPS *timer_sps);
|