| From: | John Naylor <johncnaylorls(at)gmail(dot)com> |
|---|---|
| To: | Lukas Fittl <lukas(at)fittl(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-04-02 12:55:31 |
| Message-ID: | CANWCAZbJ4-Fjxkxj6FgWyEKTJhaLjVBMnw-87A-2Quc7ZHnSbA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Apr 2, 2026 at 3:50 PM Lukas Fittl <lukas(at)fittl(dot)com> wrote:
>
> On Wed, Apr 1, 2026 at 7:18 PM John Naylor <johncnaylorls(at)gmail(dot)com> wrote:
> > +AC_CACHE_CHECK([for __cpuidex], [pgac_cv__cpuidex],
> > +[AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifdef _MSC_VER
> > + #include <intrin.h>
> > + #else
> > + #include <cpuid.h>
> > + #endif],
> > + [[int exx[4] = {0, 0, 0, 0};
> > + __cpuidex(exx, 7, 0);
> > + ]])],
> > + [pgac_cv__cpuidex="yes"],
> > + [pgac_cv__cpuidex="no"])])
> > +if test x"$pgac_cv__cpuidex" = x"yes"; then
> > + AC_DEFINE(HAVE__CPUIDEX, 1, [Define to 1 if you have __cpuidex.])
> > fi
> >
> > MSVC doesn't use autoconf, so we can leave out the intrin.h and keep
> > using unsigned int.
>
> I think that might be a problem for Clang on Windows, which has MSVC
> compatibility headers, and will set _MSC_VER, see [0] and [1].
>
> It probably works in practice, but it seems better to match the
> autoconf checks to the actual code?
Hmm, the previous coding had <intrin.h>, and this is just adding
<cpuid.h> as well, so I left it alone.
The only change I made was to make the #include stanza in pg_cpu_x86.c
match its neighbors.
I thought to add a note to the commit message about the casts to
signed int, but only after pushing did I notice that the explanation
looks out of place since no new code uses __cpuidex yet, and warnings
don't matter for configure checks. Hope it's not too confusing.
--
John Naylor
Amazon Web Services
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrew Dunstan | 2026-04-02 13:10:57 | Re: Change default of jit to off |
| Previous Message | Ashutosh Bapat | 2026-04-02 12:55:23 | Re: Shared hash table allocations |