[FFmpeg-devel] [PATCH 2/6] checkasm: use pointers for start/stop functions
Lynne
dev at lynne.ee
Wed Jul 19 23:34:37 EEST 2023
Jul 19, 2023, 21:56 by remi at remlab.net:
> Linux and MacOS kernel performance APIs are not always available.
> This introduces function pointers so that we can fall back to other
> timing functions (in later changesets).
>
> If AV_READ_TIME is the only configured timer, then this sticks to
> inline assembler since there will be nothing to fall back to (or from),
> and some people are concerned than an indirect function call is too
> much overhead.
> ---
> tests/checkasm/checkasm.c | 25 +++++++++++++++++++++++--
> tests/checkasm/checkasm.h | 24 ++++++------------------
> 2 files changed, 29 insertions(+), 20 deletions(-)
>
> diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
> index 63141e1f7a..933d85bac3 100644
> --- a/tests/checkasm/checkasm.c
> +++ b/tests/checkasm/checkasm.c
> @@ -57,6 +57,14 @@
> #if HAVE_UNISTD_H
> #include <unistd.h>
> #endif
> +#if CONFIG_LINUX_PERF
> +#include <sys/ioctl.h>
> +#include <asm/unistd.h>
> +#include <linux/perf_event.h>
> +#endif
> +#if CONFIG_MACOS_KPERF
> +#include "libavutil/macos_kperf.h"
> +#endif
>
> #if !HAVE_ISATTY
> #define isatty(fd) 1
> @@ -313,6 +321,8 @@ static struct {
> /* perf */
> int nop_time;
> int sysfd;
> + uint64_t (*start)(void);
> + uint64_t (*stop)(void);
>
Could these be ifdef's and macro'd out on x86/arm?
Perhaps behind a CONFIG_CPU_TIMERS, which would
be disabled if linux perf is active.
More information about the ffmpeg-devel
mailing list