[FFmpeg-devel] [PATCH 3/3] lavu/timer.h: add Linux Perf API support

Carl Eugen Hoyos ceffmpeg at gmail.com
Sat Jan 20 23:57:24 EET 2018


2017-09-02 20:17 GMT+02:00 Clément Bœsch <u at pkh.me>:
> From: Clément Bœsch <cboesch at gopro.com>
>
> Refer to "checkasm: use perf API on Linux ARM*" commit for the
> rationale.
>
> The implementation is somehow duplicated with checkasm, but so is the
> current usage of AV_READ_TIME(). Until these implementations and
> heuristics are made consistent, I don't see a way of sharing that code.
>
> Note: when using libavutil/timer.h, it is now important to include
> before any other include due to the _GNU_SOURCE requirement.
> ---
>  libavutil/timer.h | 46 +++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 43 insertions(+), 3 deletions(-)
>
> diff --git a/libavutil/timer.h b/libavutil/timer.h
> index da0761b607..f7ab455df2 100644
> --- a/libavutil/timer.h
> +++ b/libavutil/timer.h
> @@ -26,12 +26,22 @@
>  #ifndef AVUTIL_TIMER_H
>  #define AVUTIL_TIMER_H
>
> +#include "config.h"
> +
> +#if CONFIG_LINUX_PERF
> +# ifndef _GNU_SOURCE
> +#  define _GNU_SOURCE
> +# endif
> +# include <unistd.h> // read(3)
> +# include <sys/ioctl.h>
> +# include <asm/unistd.h>
> +# include <linux/perf_event.h>

Not sure how relevant this is but this
patch broke compilation for Android 19
and earlier, still supported by ndk 16b.

Carl Eugen


More information about the ffmpeg-devel mailing list