diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-09-15 02:23:15 +0200 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-09-29 20:48:58 +0000 |
commit | f338420fd2e9ed4851f10886f0153e40f4b39d6d (patch) | |
tree | f146f0279db1439ccaeb34e0ed9ffe02f3ae3dde | |
parent | 1a529ee1d55850a59e49f7cd72fdbb90364d0590 (diff) | |
download | mpv-f338420fd2e9ed4851f10886f0153e40f4b39d6d.tar.bz2 mpv-f338420fd2e9ed4851f10886f0153e40f4b39d6d.tar.xz |
timer: remove dead code
This is not a proper way to do unit tests or whatever that was.
-rw-r--r-- | osdep/timer.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/osdep/timer.c b/osdep/timer.c index 0e898fca73..2e184c3026 100644 --- a/osdep/timer.c +++ b/osdep/timer.c @@ -113,38 +113,3 @@ struct timespec mp_rel_time_to_timespec(double timeout_sec) { return mp_time_us_to_realtime(mp_add_timeout(mp_time_us(), timeout_sec)); } - -#if 0 -#include <stdio.h> -#include "threads.h" - -#define TEST_SLEEP 1 - -int main(void) { - int c = 2000000; - int64_t j, r, t = 0; - pthread_mutex_t mtx; - pthread_mutex_init(&mtx, NULL); - pthread_cond_t cnd; - pthread_cond_init(&cnd, NULL); - - mp_time_init(); - - for (int i = 0; i < c; i++) { - const int delay = rand() / (RAND_MAX / 1e5); - r = mp_time_us(); -#if TEST_SLEEP - mp_sleep_us(delay); -#else - struct timespec ts = mp_time_us_to_realtime(r + delay); - pthread_cond_timedwait(&cnd, &mtx, &ts); -#endif - j = (mp_time_us() - r) - delay; - printf("sleep time: t=%"PRId64" sleep=%8i err=%5i\n", r, delay, (int)j); - t += j; - } - fprintf(stderr, "average error:\t%i\n", (int)(t / c)); - - return 0; -} -#endif |