aboutsummaryrefslogtreecommitdiffstats
path: root/tests/checkasm/checkasm.h
diff options
context:
space:
mode:
authorJ. Dekker <jdek@itanimul.li>2021-07-20 19:09:22 +0200
committerJ. Dekker <jdek@itanimul.li>2021-07-20 19:40:03 +0200
commit9a727235fd497c22f2370e48dd1443d1376953e7 (patch)
treeaa45dd828846649404001aea6b8e88de8d94bffc /tests/checkasm/checkasm.h
parent4f49fa6abe89e2fca2585cac4c63190315972cf0 (diff)
downloadffmpeg-9a727235fd497c22f2370e48dd1443d1376953e7.tar.gz
lavu/checkasm: add (private) kperf timing for macOS
Signed-off-by: J. Dekker <jdek@itanimul.li>
Diffstat (limited to 'tests/checkasm/checkasm.h')
-rw-r--r--tests/checkasm/checkasm.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 0593d0edac..b747ed1986 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -31,6 +31,8 @@
#include <sys/ioctl.h>
#include <asm/unistd.h>
#include <linux/perf_event.h>
+#elif CONFIG_MACOS_KPERF
+#include "libavutil/macos_kperf.h"
#endif
#include "libavutil/avstring.h"
@@ -225,7 +227,7 @@ typedef struct CheckasmPerf {
int iterations;
} CheckasmPerf;
-#if defined(AV_READ_TIME) || CONFIG_LINUX_PERF
+#if defined(AV_READ_TIME) || CONFIG_LINUX_PERF || CONFIG_MACOS_KPERF
#if CONFIG_LINUX_PERF
#define PERF_START(t) do { \
@@ -236,6 +238,9 @@ typedef struct CheckasmPerf {
ioctl(sysfd, PERF_EVENT_IOC_DISABLE, 0); \
read(sysfd, &t, sizeof(t)); \
} while (0)
+#elif CONFIG_MACOS_KPERF
+#define PERF_START(t) t = ff_kperf_cycles()
+#define PERF_STOP(t) t = ff_kperf_cycles() - t
#else
#define PERF_START(t) t = AV_READ_TIME()
#define PERF_STOP(t) t = AV_READ_TIME() - t