[FFmpeg-devel] [PATCH 1/2] avutil/timer: define macos kperf as AV_READ_TIME

Martin Storsjö martin at martin.st
Mon Jun 17 14:22:33 EEST 2024


On Mon, 17 Jun 2024, Martin Storsjö wrote:

> On Wed, 12 Jun 2024, Zhao Zhili wrote:
>
>> From: Zhao Zhili <zhilizhao at tencent.com>
>> 
>> Firstly, make ff_kperf_cycles as an implementation of AV_READ_TIME
>> avoids code duplication.
>> 
>> Secondly, fix compilation error since 6a18c0bc87e when macos-kperf
>> is enabled. mach_time.h is included only when CONFIG_MACOS_KPERF
>> is 0. The error happened due to define mach_absolute_time as
>> AV_READ_TIME but missing include mach_time.h. Define macos kperf
>> as AV_READ_TIME fixed the issue.
>
> Can you elaborate on what your actual goal is here? We have relatively little 
> use of AV_READ_TIME (mostly START/STOP_TIMER), while most benchmarking these 
> days is done via checkasm. Do you have a real case where you want to do 
> benchmarking with this api, outside of checkasm?
>
> Or do you just want to fix the compilation error? In that case I guess it's 
> possible to fix differently by adding the missing includes.

Btw, in this case, the compilation error also went away when I pushed the 
patch that made it use inline assembly with cntvct_el0 on macOS too.

But as long as we do have the common AV_READ_TIME fallback to 
mach_absolute_time, we definitely should include the right header for that 
case anyway.

// Martin


More information about the ffmpeg-devel mailing list