Hi,
On Mon, Aug 05, 2024 at 03:07:34PM -0500, Sami Imseih wrote:
>
> > yeah, we already have a few macros that access the .ticks, so maybe we could add
> > 2 new ones, say:
> >
> > 1. INSTR_TIME_ADD_MS(t1, msec)
> > 2. INSTR_TIME_IS_GREATER(t1, t2)
> >
> > I think the less operations is done in the while loop the better.
> >
>
> See v4. it includes 2 new instr_time.h macros to simplify the
> code insidethe while loop.
Thanks!
1 ===
+#define INSTR_TIME_IS_GREATER(x,y) \
+ ((bool) (x).ticks > (y).ticks)
Around parentheses are missing, that should be ((bool) ((x).ticks > (y).ticks)).
I did not pay attention to it initially but found it was the culprit of breaks
not occuring (while my test case produces some).
That said, I don't think the cast is necessary here and that we could get rid of
it.
2 ===
What about providing a quick comment about the 2 new macros in header of
instr_time.h? (like it is done for the others macros)
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com