mirror of
https://github.com/postgres/postgres.git
synced 2025-11-18 02:02:55 +03:00
Generate pgstat_count_slru*() functions for slru using macros
This change replaces seven functions definitions by macros, reducing a bit some repetitive patterns in the code. An interesting side effect is that this removes an inconsistency in the naming of SLRU increment functions with the field names. This change is similar to850f4b4c8c,8018ffbf58or83a1a1b566. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Discussion: https://postgr.es/m/aLHA//gr4dTpDHHC@ip-10-97-1-34.eu-west-3.compute.internal
This commit is contained in:
@@ -55,47 +55,33 @@ pgstat_reset_slru(const char *name)
|
||||
* SLRU statistics count accumulation functions --- called from slru.c
|
||||
*/
|
||||
|
||||
void
|
||||
pgstat_count_slru_page_zeroed(int slru_idx)
|
||||
{
|
||||
get_slru_entry(slru_idx)->blocks_zeroed += 1;
|
||||
#define PGSTAT_COUNT_SLRU(stat) \
|
||||
void \
|
||||
CppConcat(pgstat_count_slru_,stat)(int slru_idx) \
|
||||
{ \
|
||||
get_slru_entry(slru_idx)->stat += 1; \
|
||||
}
|
||||
|
||||
void
|
||||
pgstat_count_slru_page_hit(int slru_idx)
|
||||
{
|
||||
get_slru_entry(slru_idx)->blocks_hit += 1;
|
||||
}
|
||||
/* pgstat_count_slru_blocks_zeroed */
|
||||
PGSTAT_COUNT_SLRU(blocks_zeroed)
|
||||
|
||||
void
|
||||
pgstat_count_slru_page_exists(int slru_idx)
|
||||
{
|
||||
get_slru_entry(slru_idx)->blocks_exists += 1;
|
||||
}
|
||||
/* pgstat_count_slru_blocks_hit */
|
||||
PGSTAT_COUNT_SLRU(blocks_hit)
|
||||
|
||||
void
|
||||
pgstat_count_slru_page_read(int slru_idx)
|
||||
{
|
||||
get_slru_entry(slru_idx)->blocks_read += 1;
|
||||
}
|
||||
/* pgstat_count_slru_blocks_exists */
|
||||
PGSTAT_COUNT_SLRU(blocks_exists)
|
||||
|
||||
void
|
||||
pgstat_count_slru_page_written(int slru_idx)
|
||||
{
|
||||
get_slru_entry(slru_idx)->blocks_written += 1;
|
||||
}
|
||||
/* pgstat_count_slru_blocks_read */
|
||||
PGSTAT_COUNT_SLRU(blocks_read)
|
||||
|
||||
void
|
||||
pgstat_count_slru_flush(int slru_idx)
|
||||
{
|
||||
get_slru_entry(slru_idx)->flush += 1;
|
||||
}
|
||||
/* pgstat_count_slru_blocks_written */
|
||||
PGSTAT_COUNT_SLRU(blocks_written)
|
||||
|
||||
void
|
||||
pgstat_count_slru_truncate(int slru_idx)
|
||||
{
|
||||
get_slru_entry(slru_idx)->truncate += 1;
|
||||
}
|
||||
/* pgstat_count_slru_flush */
|
||||
PGSTAT_COUNT_SLRU(flush)
|
||||
|
||||
/* pgstat_count_slru_truncate */
|
||||
PGSTAT_COUNT_SLRU(truncate)
|
||||
|
||||
/*
|
||||
* Support function for the SQL-callable pgstat* functions. Returns
|
||||
|
||||
Reference in New Issue
Block a user