v9-0003-instrumentation-Rename-INSTR_TIME_LT-macro-to-INS.patch

application/octet-stream

Filename: v9-0003-instrumentation-Rename-INSTR_TIME_LT-macro-to-INS.patch
Type: application/octet-stream
Part: 2
Message: Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v9-0003
Subject: instrumentation: Rename INSTR_TIME_LT macro to INSTR_TIME_GT
File+
src/backend/executor/instrument.c 1 1
src/include/portability/instr_time.h 3 1
From 9524f28a0eef111ae00fbd154bbad5b1c04e6178 Mon Sep 17 00:00:00 2001
From: Lukas Fittl <lukas@fittl.com>
Date: Sun, 22 Feb 2026 16:36:54 -0800
Subject: [PATCH v9 3/7] instrumentation: Rename INSTR_TIME_LT macro to
 INSTR_TIME_GT

This was incorrectly named "LT" for "larger than" in e5a5e0a90750d66, but
that is against existing conventions, where "LT" means "less than".
Clarify by using "GT" for "greater than" in macro name, and add a missing
comment at the top of instr_time.h to note the macro's existence.

Reported by: Peter Smith <smithpb2250@gmail.com>
Author: Lukas Fittl <lukas@fittl.com>
Reviewed-by:
Discussion: https://www.postgresql.org/message-id/flat/CAHut%2BPut94CTpjQsqOJHdHkgJ2ZXq%2BqVSfMEcmDKLiWLW-hPfA%40mail.gmail.com#0690d99bebc6dd9b035724f66d9986c1
---
 src/backend/executor/instrument.c    | 2 +-
 src/include/portability/instr_time.h | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/backend/executor/instrument.c b/src/backend/executor/instrument.c
index 332fbc6be03..a40610bc252 100644
--- a/src/backend/executor/instrument.c
+++ b/src/backend/executor/instrument.c
@@ -174,7 +174,7 @@ InstrAggNode(Instrumentation *dst, Instrumentation *add)
 		dst->firsttuple = add->firsttuple;
 	}
 	else if (dst->running && add->running &&
-			 INSTR_TIME_LT(dst->firsttuple, add->firsttuple))
+			 INSTR_TIME_GT(dst->firsttuple, add->firsttuple))
 		dst->firsttuple = add->firsttuple;
 
 	INSTR_TIME_ADD(dst->counter, add->counter);
diff --git a/src/include/portability/instr_time.h b/src/include/portability/instr_time.h
index dbd989cc002..8b6baeffd3e 100644
--- a/src/include/portability/instr_time.h
+++ b/src/include/portability/instr_time.h
@@ -26,6 +26,8 @@
  *
  * INSTR_TIME_ACCUM_DIFF(x, y, z)	x += (y - z)
  *
+ * INSTR_TIME_GT(x, y)				x > y
+ *
  * INSTR_TIME_GET_DOUBLE(t)			convert t to double (in seconds)
  *
  * INSTR_TIME_GET_MILLISEC(t)		convert t to double (in milliseconds)
@@ -178,7 +180,7 @@ GetTimerFrequency(void)
 #define INSTR_TIME_ACCUM_DIFF(x,y,z) \
 	((x).ticks += (y).ticks - (z).ticks)
 
-#define INSTR_TIME_LT(x,y) \
+#define INSTR_TIME_GT(x,y) \
 	((x).ticks > (y).ticks)
 
 #define INSTR_TIME_GET_DOUBLE(t) \
-- 
2.47.1