pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Generate pg_stat_get*() functions for databases using macros
Date: Wed, 07 Dec 2022 00:12:12 +0000
Message-ID: <E1p2i2l-002Id5-QF@gemulon.postgresql.org> (raw)

Generate pg_stat_get*() functions for databases using macros

The same code pattern is repeated 21 times for int64 counters (0 for
missing entry) and 5 times for doubles (0 for missing entry) on database
entries.  This code is switched to use macros for the basic code
instead, shaving a few hundred lines of originally-duplicated code
patterns.  The function names remain the same, but some fields of
PgStat_StatDBEntry have to be renamed to cope with the new style.

This is in the same spirit as 83a1a1b.

Author: Michael Paquier
Reviewed-by: Nathan Bossart, Bertrand Drouvot
Discussion: https://postgr.es/m/Y46stlxQ2LQE20Na@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8018ffbf5895ee16a1fd7117c4526b47ac42332e

Modified Files
--------------
src/backend/utils/activity/pgstat_database.c |  94 +++---
src/backend/utils/activity/pgstat_relation.c |  14 +-
src/backend/utils/adt/pgstatfuncs.c          | 454 ++++++---------------------
src/include/pgstat.h                         |  54 ++--
4 files changed, 169 insertions(+), 447 deletions(-)



view thread (2+ messages)

Message-ID: <E1p2i2l-002Id5-QF@gemulon.postgresql.org>
Permalink:  ../E1p2i2l-002Id5-QF@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1p2i2l-002Id5-QF@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Generate pg_stat_get*() functions for databases using macros
  In-Reply-To: <E1p2i2l-002Id5-QF@gemulon.postgresql.org>
  References: <E1p2i2l-002Id5-QF@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox