Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available
Дата
Msg-id afgs3gi3loplgnpta6nsdaemb5i3vox5356zdp2mkorjls7zxq@mp7vop4w5l36
обсуждение исходный текст
Ответ на Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

On 2025-07-16 18:24:33 -0400, Tom Lane wrote:
> ... BTW, another resource worth looking at is src/bin/pg_test_timing/
> which we just improved a few days ago [1].  What I see on two different
> Linux-on-Intel boxes is that the loop time that that reports is 16 ns
> and change, and the clock readings appear accurate to full nanosecond
> precision.  Changing instr_time.h to use CLOCK_MONOTONIC_COARSE, the
> loop time drops to a bit over 5 ns, which would certainly be a nice
> win if it were cost-free.  But the clock precision degrades to 1 ms.

FWIW, switching to using rtscp for timestamp acqusition substantially reduces
timing overhead, albeit not quite as low as 5ns, without loosing any
meaningful precision.  The patch from [1] needs to be rebased unfortunately.

Separately, the amount of work we're now doing for each loop iteration in
test_timing() got to start having some effect, no?

Greetings,

Andres

[1] https://postgr.es/m/CAP53PkzO2KpscD-tgFW_V-4WS%2BvkniH4-B00eM-e0bsBF-xUxg%40mail.gmail.com



В списке pgsql-hackers по дате отправления: