| From: | Lukas Fittl <lukas(at)fittl(dot)com> |
|---|---|
| To: | John Naylor <johncnaylorls(at)gmail(dot)com> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, Hannu Krosing <hannuk(at)google(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, David Geier <geidav(dot)pg(at)gmail(dot)com> |
| Subject: | Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc? |
| Date: | 2026-03-24 07:16:07 |
| Message-ID: | CAP53Pkx1yrRShTzicUJ-+ZNqea45-_b+P34FZvueUUJuDk8ifA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi John,
On Mon, Mar 23, 2026 at 12:01 AM John Naylor <johncnaylorls(at)gmail(dot)com> wrote:
> It's not that bad that the hard-coded indexes are in two places, but
> it's also not necessary. I think "#define EAX 0 ...etc" is a fine,
> straightforward increase in readability compared to what we have now,
> and I don't see any downside. I suppose one argument in favor of the
> struct is that it avoids declaring variables of type
> array-of-4-unsigned in multiple places, but I think the array is fine,
> and adding a new typedef is additional cognitive friction.
Sounds good, lets do it that way - adjusted to use macros instead of a struct.
> Speaking of signedness, why is the array of ints sometimes signed and
> sometimes unsigned?
The signedness is a MSVC-ism - I think its reasonable for us to work
with unsigned integers in our code, and pass them by casting to
__cpuid/__cpuidex (the MSVC variants).
> + * Returns false if the CPUID leaf/subleaf is not supported.
>
> Okay, thanks. I'd suggest using "true if X is supported" or "true if X
> is supported, false otherwise" phrasing.
Yup, agreed, that reads better, adjusted.
See attached v13 with your feedback addressed in 0001 and 0005,
otherwise the same as before.
Thanks,
Lukas
--
Lukas Fittl
| Attachment | Content-Type | Size |
|---|---|---|
| v13-0001-Refactor-handling-of-x86-CPUID-instructions.patch | application/octet-stream | 3.8 KB |
| v13-0002-Check-for-HAVE__CPUIDEX-and-HAVE__GET_CPUID_COUN.patch | application/octet-stream | 6.2 KB |
| v13-0003-pg_test_timing-Reduce-per-loop-overhead.patch | application/octet-stream | 3.7 KB |
| v13-0004-instrumentation-Streamline-ticks-to-nanosecond-c.patch | application/octet-stream | 13.1 KB |
| v13-0005-instrumentation-Use-Time-Stamp-Counter-TSC-on-x8.patch | application/octet-stream | 38.2 KB |
| v13-0006-pg_test_timing-Also-test-RDTSC-RDTSCP-timing-and.patch | application/octet-stream | 6.2 KB |
| v13-0007-instrumentation-ARM-support-for-fast-time-measur.patch | application/octet-stream | 8.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bertrand Drouvot | 2026-03-24 07:16:47 | Re: Enable -Wstrict-prototypes and -Wold-style-definition by default |
| Previous Message | Michael Paquier | 2026-03-24 07:02:55 | Re: Adding locks statistics |