Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc? - Mailing list pgsql-hackers

From Lukas Fittl
Subject Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Date
Msg-id CAP53Pkx1yrRShTzicUJ-+ZNqea45-_b+P34FZvueUUJuDk8ifA@mail.gmail.com
Whole thread Raw
In response to Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?  (John Naylor <johncnaylorls@gmail.com>)
Responses Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
List pgsql-hackers
Hi John,

On Mon, Mar 23, 2026 at 12:01 AM John Naylor <johncnaylorls@gmail.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

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Adding locks statistics
Next
From: Bertrand Drouvot
Date:
Subject: Re: Enable -Wstrict-prototypes and -Wold-style-definition by default