Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf0bf785

Browse files
committed
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 isdeclared in pgstat.h and used nowhere in the code, so let's remove it infavor of the former.This change makes also the code more symmetric withpgstat_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 theintegration of a follow-up patch that adds byte-level tracking inpg_stat_io for some of its attributes, lifting the current restrictionbased on BLCKSZ as all I/O operations are assumed to be block-based.Author: Nazir Bilal YavuzReviewed-by: Bertrand DrouvotDiscussion:https://postgr.es/m/CAN55FZ32ze812=yjyZg1QeXhKvACUM_Nu0_gyPQcUKKuVHL5xA@mail.gmail.com
1 parent2c14037 commitf0bf785

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ PinBufferForBlock(Relation rel,
11651165
}
11661166
if (*foundPtr)
11671167
{
1168-
pgstat_count_io_op(io_object,io_context,IOOP_HIT);
1168+
pgstat_count_io_op(io_object,io_context,IOOP_HIT,1);
11691169
if (VacuumCostActive)
11701170
VacuumCostBalance+=VacuumCostPageHit;
11711171

@@ -2073,7 +2073,7 @@ GetVictimBuffer(BufferAccessStrategy strategy, IOContext io_context)
20732073
* pinners or erroring out.
20742074
*/
20752075
pgstat_count_io_op(IOOBJECT_RELATION,io_context,
2076-
from_ring ?IOOP_REUSE :IOOP_EVICT);
2076+
from_ring ?IOOP_REUSE :IOOP_EVICT,1);
20772077
}
20782078

20792079
/*

‎src/backend/storage/buffer/localbuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ GetLocalVictimBuffer(void)
279279
ClearBufferTag(&bufHdr->tag);
280280
buf_state &= ~(BUF_FLAG_MASK |BUF_USAGECOUNT_MASK);
281281
pg_atomic_unlocked_write_u32(&bufHdr->state,buf_state);
282-
pgstat_count_io_op(IOOBJECT_TEMP_RELATION,IOCONTEXT_NORMAL,IOOP_EVICT);
282+
pgstat_count_io_op(IOOBJECT_TEMP_RELATION,IOCONTEXT_NORMAL,IOOP_EVICT,1);
283283
}
284284

285285
returnBufferDescriptorGetBuffer(bufHdr);

‎src/backend/utils/activity/pgstat_io.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,7 @@ pgstat_bktype_io_stats_valid(PgStat_BktypeIO *backend_io,
6666
}
6767

6868
void
69-
pgstat_count_io_op(IOObjectio_object,IOContextio_context,IOOpio_op)
70-
{
71-
pgstat_count_io_op_n(io_object,io_context,io_op,1);
72-
}
73-
74-
void
75-
pgstat_count_io_op_n(IOObjectio_object,IOContextio_context,IOOpio_op,uint32cnt)
69+
pgstat_count_io_op(IOObjectio_object,IOContextio_context,IOOpio_op,uint32cnt)
7670
{
7771
Assert((unsignedint)io_object<IOOBJECT_NUM_TYPES);
7872
Assert((unsignedint)io_context<IOCONTEXT_NUM_TYPES);
@@ -116,7 +110,7 @@ pgstat_prepare_io_time(bool track_io_guc)
116110
}
117111

118112
/*
119-
* Likepgstat_count_io_op_n() except it also accumulates time.
113+
* Likepgstat_count_io_op() except it also accumulates time.
120114
*/
121115
void
122116
pgstat_count_io_op_time(IOObjectio_object,IOContextio_context,IOOpio_op,
@@ -159,7 +153,7 @@ pgstat_count_io_op_time(IOObject io_object, IOContext io_context, IOOp io_op,
159153
}
160154
}
161155

162-
pgstat_count_io_op_n(io_object,io_context,io_op,cnt);
156+
pgstat_count_io_op(io_object,io_context,io_op,cnt);
163157
}
164158

165159
PgStat_IO*

‎src/include/pgstat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,8 @@ extern PgStat_CheckpointerStats *pgstat_fetch_stat_checkpointer(void);
603603

604604
externboolpgstat_bktype_io_stats_valid(PgStat_BktypeIO*backend_io,
605605
BackendTypebktype);
606-
externvoidpgstat_count_io_op(IOObjectio_object,IOContextio_context,IOOpio_op);
607-
externvoidpgstat_count_io_op_n(IOObjectio_object,IOContextio_context,IOOpio_op,uint32cnt);
606+
externvoidpgstat_count_io_op(IOObjectio_object,IOContextio_context,
607+
IOOpio_op,uint32cnt);
608608
externinstr_timepgstat_prepare_io_time(booltrack_io_guc);
609609
externvoidpgstat_count_io_op_time(IOObjectio_object,IOContextio_context,
610610
IOOpio_op,instr_timestart_time,uint32cnt);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp