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

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(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-09 07:59:52
Message-ID: CAN55FZ1Br+JzuVuaNyv3acsZ6tmBmUNKBf0oiNEUjta4Os0XLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, 9 Jan 2025 at 10:15, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com> wrote:
>
> On Thu, 9 Jan 2025 at 05:59, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> >
> >
> > +static inline bool
> > +is_ioop_tracked_in_bytes(IOOp io_op)
> > +{
> > + Assert((unsigned int) io_op < IOOP_NUM_TYPES);
> > + return io_op >= IOOP_EXTEND;
> > +}
> >
> > This is only used in an assertion of pgstat_count_io_op_n() in
> > pgstat_io.c. Let's also keep it this routine local to the file. The
> > assert to make sure that the callers don't assign bytes to the
> > operations that don't support the counters is a good idea.
>
> Makes sense, done.
>
> v5 is attached.

I missed a compilation error. Since the is_ioop_tracked_in_bytes() is
only used in the assert and the asserts are disabled in the production
builds, CompilerWarnings task gives -Wunused-function error:

pgstat_io.c:28:1: error: unused function 'is_ioop_tracked_in_bytes'
[-Werror,-Wunused-function]

pg_attribute_unused() is added to the function to silence that. v6 is attached.

--
Regards,
Nazir Bilal Yavuz
Microsoft

Attachment Content-Type Size
v6-0001-Make-pg_stat_io-count-IOs-as-bytes-instead-of-blo.patch text/x-patch 23.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-01-09 08:05:26 Re: Reorder shutdown sequence, to flush pgstats later
Previous Message Peter Eisentraut 2025-01-09 07:55:29 Re: pure parsers and reentrant scanners