#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>
# include <sys/ioctl.h>
# include <asm/unistd.h>
# include <linux/perf_event.h>
#endif
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#if CONFIG_MACOS_KPERF
#include "macos_kperf.h"
#elif HAVE_MACH_ABSOLUTE_TIME
#include <mach/mach_time.h>
#endif
#include "common.h"
#include "log.h"
#if ARCH_AARCH64
# include "aarch64/timer.h"
#elif ARCH_ARM
# include "arm/timer.h"
#elif ARCH_PPC
# include "ppc/timer.h"
#elif ARCH_RISCV
# include "riscv/timer.h"
#elif ARCH_X86
# include "x86/timer.h"
#elif ARCH_LOONGARCH
# include "loongarch/timer.h"
#endif
#if !defined(AV_READ_TIME)
# if HAVE_GETHRTIME
#define AV_READ_TIME …
# elif HAVE_MACH_ABSOLUTE_TIME
#define AV_READ_TIME …
# endif
#endif
#ifndef FF_TIMER_UNITS
#define FF_TIMER_UNITS …
#endif
#define TIMER_REPORT(id, tdiff) …
#if CONFIG_LINUX_PERF
#define START_TIMER …
#define STOP_TIMER …
#elif CONFIG_MACOS_KPERF
#define START_TIMER …
#define STOP_TIMER …
#elif defined(AV_READ_TIME)
#define START_TIMER … \
#define STOP_TIMER(id) …
#else
#define START_TIMER
#define STOP_TIMER …
#endif
#endif