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

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, 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 08:55:34
Message-ID: CAN55FZ3fXzNhqMvPrDF_MPcyyO536j5xovTZKKZVn8dpCusYZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, 16 Jan 2025 at 10:12, Bertrand Drouvot
<bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>
> 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).

Thanks all!

I checked clang 4 as well on the link you sent and it also fixes the
warning there.

--
Regards,
Nazir Bilal Yavuz
Microsoft

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Vladlen Popolitov 2025-01-16 09:05:28 Re: Windows meson build
Previous Message vignesh C 2025-01-16 08:51:20 Re: Virtual generated columns