Re: Make pg_stat_io view count IOs as bytes instead of blocks
Nazir Bilal Yavuz <byavuz81@gmail.com>
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, Melanie Plageman <melanieplageman@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-01-09T07:59:52Z
Lists: pgsql-hackers
Attachments
- v6-0001-Make-pg_stat_io-count-IOs-as-bytes-instead-of-blo.patch (text/x-patch) patch v6-0001
Hi,
On Thu, 9 Jan 2025 at 10:15, Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
>
> On Thu, 9 Jan 2025 at 05:59, Michael Paquier <michael@paquier.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
Commits
-
Rework macro pgstat_is_ioop_tracked_in_bytes()
- 7b6468cc9523 18.0 landed
-
Remove assertion in pgstat_count_io_op()
- d2181b321852 18.0 landed
-
Make pg_stat_io count IOs as bytes instead of blocks for some operations
- f92c854cf406 18.0 landed
-
Merge pgstat_count_io_op_n() and pgstat_count_io_op()
- f0bf7857befe 18.0 landed