| From: | Andres Freund <andres(at)anarazel(dot)de> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: pg_test_timing: Show additional TSC clock source debug info |
| Date: | 2026-05-16 16:12:58 |
| Message-ID: | E1wOHdK-000o2D-0E@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
pg_test_timing: Show additional TSC clock source debug info
In some cases its necessary to understand whether TSC frequency data was
sourced from CPUID, and which of the registers. Show this debug info at
the end of pg_test_timing, and rework TSC functions to support that.
This would have helped debug the buildfarm report fixed in 7fc36c5db550
and is likely going to aid in any TSC-related issues reported during the
beta period or later.
Additionally, emit a warning if TSC frequency from calibration differs
by more than 10% from the TSC frequency in use, and suggest the use
of timing_clock_source = 'system'.
In passing, add an explicit early return in the output function if the
loop count is zero. This can't happen in practice, but coverity complained
because we unconditionally call output for the fast TSC measurement.
Author: Lukas Fittl <lukas(at)fittl(dot)com>
Suggested-by: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Haibo Yan <tristan(dot)yim(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> (coverity fix only)
Discussion: https://postgr.es/m/CAP53Pkw3Gzb+KTF5pu_o7tzbfZ7+qm2m6uDWuGtTJjZpV9yNpg@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5ba34f6dc838a1bc4415dc179be5bb2cf3b6d549
Modified Files
--------------
doc/src/sgml/ref/pgtesttiming.sgml | 2 ++
src/bin/pg_test_timing/pg_test_timing.c | 55 ++++++++++++++++++++++++------
src/common/instr_time.c | 60 ++++++++++++++++++++++++++++++---
src/include/port/pg_cpu.h | 2 +-
src/include/portability/instr_time.h | 10 +++++-
src/port/pg_cpu_x86.c | 31 +++++++++++++++--
src/tools/pgindent/typedefs.list | 1 +
7 files changed, 142 insertions(+), 19 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-05-16 22:39:04 | pgsql: doc: Fix example of pg_restore_extended_stats() |
| Previous Message | Etsuro Fujita | 2026-05-16 08:56:21 | pgsql: postgres_fdw: Replace buffers in RemoteAttributeMapping with poi |