Use os_tick_ns() monotonic timer and add compiler memory barriers
Some checks failed
Build / build-mac (push) Has been cancelled
Build / build-linux (push) Has been cancelled
Build / build-arm32 (push) Has been cancelled
Build / build-win (push) Has been cancelled
Build / build-freebsd (push) Has been cancelled
Build / build-musl (push) Has been cancelled
CodeQL Advanced / Analyze (c-cpp) (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled

This commit is contained in:
Andrea Mazzoleni 2026-10-02 10:45:30 +02:00
parent dcb3c7db37
commit 0ad0913ef2
2 changed files with 24 additions and 29 deletions

View file

@ -36,19 +36,19 @@ static int64_t diffgettimeofday(struct timeval *start, struct timeval *stop)
d = 1000000LL * (stop->tv_sec - start->tv_sec);
d += stop->tv_usec - start->tv_usec;
return d;
return d > 0 ? d : 0;
}
#define SPEED_START \
{ \
int speed_delta_ = delta; \
int64_t elapsed_ = 0; \
int64_t best_dt_ = INT64_MAX; \
do { \
struct timeval start; \
struct timeval stop; \
gettimeofday(&start, 0); \
for (int i_ = 0; i_ < speed_delta_; ++i_)
int speed_delta_ = delta; \
int64_t elapsed_ = 0; \
int64_t best_dt_ = INT64_MAX; \
do { \
struct timeval start; \
struct timeval stop; \
gettimeofday(&start, 0); \
for (int i_ = 0; i_ < speed_delta_; ++i_)
#define SPEED_STOP \
gettimeofday(&stop, 0); \