Re: Make pg_stat_io view count IOs as bytes instead of blocks

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Make pg_stat_io view count IOs as bytes instead of blocks
Date: 2025-01-16 07:12:34
Message-ID: Z4ixYkLGjh2ycUD5@ip-10-97-1-34.eu-west-3.compute.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Jan 16, 2025 at 12:47:17AM -0500, Tom Lane wrote:
> Michael Paquier <michael(at)paquier(dot)xyz> writes:
> > Not completely sure about the number of parenthesis, but I hope that
> > this should be enough (extra set around io_op):
> > +#define pgstat_is_ioop_tracked_in_bytes(io_op) \
> > + (((unsigned int) (io_op)) < IOOP_NUM_TYPES && \
> > + ((unsigned int) (io_op)) >= IOOP_EXTEND)
>
> Yeah, that's safe parenthesis-wise. Whether it'll silence
> the warning from those old clangs remains to be seen.

Thanks for the report and the proposed "fix".

From what I can see, the above proposal does (at least) silent the warning
here (clang 5.0.1 and same as demoiselle): https://godbolt.org/z/cGosfzGne (we
can see the warning by using the current define and that the warning is gone
with the new define).

Let's see on the BF.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2025-01-16 07:21:13 Re: XMLDocument (SQL/XML X030)
Previous Message Shinya Kato 2025-01-16 07:09:44 Re: [PATCH] New predefined role pg_manage_extensions