diff options
author | Michael Paquier <michael@paquier.xyz> | 2025-01-10 09:57:27 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2025-01-10 09:57:27 +0900 |
commit | f0bf7857befefa3ff00c7d2ac5c611c525f5cd3e (patch) | |
tree | cafe2bc6eb0000f1d346031bf7ab1b0fa5e82106 /src/backend/storage | |
parent | 2c14037bb57c091b9f0bcbd36fa62138601beb55 (diff) | |
download | postgresql-f0bf7857befefa3ff00c7d2ac5c611c525f5cd3e.tar.gz postgresql-f0bf7857befefa3ff00c7d2ac5c611c525f5cd3e.zip |
Merge pgstat_count_io_op_n() and pgstat_count_io_op()
The pgstat_count_io_op() function, which counts a single I/O operation,
wraps pgstat_count_io_op_n() with a counter value of 1. The latter is
declared in pgstat.h and used nowhere in the code, so let's remove it in
favor of the former.
This change makes also the code more symmetric with
pgstat_count_io_op_time(), that already uses a similar set of arguments,
except that it counts also the I/O time. This will ease a bit the
integration of a follow-up patch that adds byte-level tracking in
pg_stat_io for some of its attributes, lifting the current restriction
based on BLCKSZ as all I/O operations are assumed to be block-based.
Author: Nazir Bilal Yavuz
Reviewed-by: Bertrand Drouvot
Discussion: https://postgr.es/m/CAN55FZ32ze812=yjyZg1QeXhKvACUM_Nu0_gyPQcUKKuVHL5xA@mail.gmail.com
Diffstat (limited to 'src/backend/storage')
-rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 4 | ||||
-rw-r--r-- | src/backend/storage/buffer/localbuf.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 5008641baff..7a07c9c1ebd 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1165,7 +1165,7 @@ PinBufferForBlock(Relation rel, } if (*foundPtr) { - pgstat_count_io_op(io_object, io_context, IOOP_HIT); + pgstat_count_io_op(io_object, io_context, IOOP_HIT, 1); if (VacuumCostActive) VacuumCostBalance += VacuumCostPageHit; @@ -2073,7 +2073,7 @@ again: * pinners or erroring out. */ pgstat_count_io_op(IOOBJECT_RELATION, io_context, - from_ring ? IOOP_REUSE : IOOP_EVICT); + from_ring ? IOOP_REUSE : IOOP_EVICT, 1); } /* diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c index 80b7fc7efcc..cdb9da7e651 100644 --- a/src/backend/storage/buffer/localbuf.c +++ b/src/backend/storage/buffer/localbuf.c @@ -279,7 +279,7 @@ GetLocalVictimBuffer(void) ClearBufferTag(&bufHdr->tag); buf_state &= ~(BUF_FLAG_MASK | BUF_USAGECOUNT_MASK); pg_atomic_unlocked_write_u32(&bufHdr->state, buf_state); - pgstat_count_io_op(IOOBJECT_TEMP_RELATION, IOCONTEXT_NORMAL, IOOP_EVICT); + pgstat_count_io_op(IOOBJECT_TEMP_RELATION, IOCONTEXT_NORMAL, IOOP_EVICT, 1); } return BufferDescriptorGetBuffer(bufHdr); |