summaryrefslogtreecommitdiff
path: root/libavutil/timer.h
diff options
context:
space:
mode:
authorJanne Grunau <j@jannau.net>2014-01-24 01:15:31 +0100
committerJanne Grunau <janne-libav@jannau.net>2014-03-09 00:45:34 +0100
commitc708b5403346255ea5adc776645616cc7c61f078 (patch)
treed36a7955d03532e3d4f1714793d4de5e7cc4a7e3 /libavutil/timer.h
parent634d9d8b398982647b3d7160641198744901d8d8 (diff)
downloadffmpeg-c708b5403346255ea5adc776645616cc7c61f078.tar.gz
timer: use mach_absolute_time as high resolution clock on darwin
Not guaranteed to be in nanosecond resolution. On iOS 7 the duration of one tick is 125/3 ns which is still more than an order of magnitude better then microseconds. Replace decicycles with the neutral UNITS. Decicycles is strange but tenths of a nanosecond and unspecific "deci"-ticks for mach_absolute_time is just silly.
Diffstat (limited to 'libavutil/timer.h')
-rw-r--r--libavutil/timer.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/libavutil/timer.h b/libavutil/timer.h
index d2c50019a6..0d93d7c0ef 100644
--- a/libavutil/timer.h
+++ b/libavutil/timer.h
@@ -32,6 +32,10 @@
#include "config.h"
+#if HAVE_MACH_MACH_TIME_H
+#include <mach/mach_time.h>
+#endif
+
#include "log.h"
#if ARCH_ARM
@@ -44,8 +48,12 @@
# include "x86/timer.h"
#endif
-#if !defined(AV_READ_TIME) && HAVE_GETHRTIME
-# define AV_READ_TIME gethrtime
+#if !defined(AV_READ_TIME)
+# if HAVE_GETHRTIME
+# define AV_READ_TIME gethrtime
+# elif HAVE_MACH_ABSOLUTE_TIME
+# define AV_READ_TIME mach_absolute_time
+# endif
#endif
#ifdef AV_READ_TIME
@@ -68,7 +76,7 @@
tskip_count++; \
if (((tcount + tskip_count) & (tcount + tskip_count - 1)) == 0) { \
av_log(NULL, AV_LOG_ERROR, \
- "%"PRIu64" decicycles in %s, %d runs, %d skips\n", \
+ "%"PRIu64" UNITS in %s, %d runs, %d skips\n", \
tsum * 10 / tcount, id, tcount, tskip_count); \
} \
}