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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, 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-16 05:43:43
Message-ID: Z4icj-1JW4BE9cwu@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 16, 2025 at 12:18:38AM -0500, Tom Lane wrote:
> However, the macro does provide a convenient place to hang the
> warning comment about keeping it sync'd with the enum.
> Personally I'd keep the macro but move it to pgstat.h, close
> to the enum declaration, so that there's more than epsilon
> chance of someone who's changing the enum noticing they need
> to update it.

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)
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-01-16 05:47:17 Re: Make pg_stat_io view count IOs as bytes instead of blocks
Previous Message Peter Smith 2025-01-16 05:38:19 Re: TOAST versus toast