diff options
Diffstat (limited to 'src/include/pgstat.h')
-rw-r--r-- | src/include/pgstat.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 763c1ee2bdd..9d351e77145 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -11,6 +11,7 @@ #ifndef PGSTAT_H #define PGSTAT_H +#include "access/slru.h" #include "datatype/timestamp.h" #include "libpq/pqcomm.h" #include "miscadmin.h" @@ -55,11 +56,13 @@ typedef enum StatMsgType PGSTAT_MTYPE_RESETCOUNTER, PGSTAT_MTYPE_RESETSHAREDCOUNTER, PGSTAT_MTYPE_RESETSINGLECOUNTER, + PGSTAT_MTYPE_RESETSLRUCOUNTER, PGSTAT_MTYPE_AUTOVAC_START, PGSTAT_MTYPE_VACUUM, PGSTAT_MTYPE_ANALYZE, PGSTAT_MTYPE_ARCHIVER, PGSTAT_MTYPE_BGWRITER, + PGSTAT_MTYPE_SLRU, PGSTAT_MTYPE_FUNCSTAT, PGSTAT_MTYPE_FUNCPURGE, PGSTAT_MTYPE_RECOVERYCONFLICT, @@ -344,6 +347,17 @@ typedef struct PgStat_MsgResetsinglecounter } PgStat_MsgResetsinglecounter; /* ---------- + * PgStat_MsgResetslrucounter Sent by the backend to tell the collector + * to reset a SLRU counter + * ---------- + */ +typedef struct PgStat_MsgResetslrucounter +{ + PgStat_MsgHdr m_hdr; + int m_index; +} PgStat_MsgResetslrucounter; + +/* ---------- * PgStat_MsgAutovacStart Sent by the autovacuum daemon to signal * that a database is going to be processed * ---------- @@ -424,6 +438,23 @@ typedef struct PgStat_MsgBgWriter } PgStat_MsgBgWriter; /* ---------- + * PgStat_MsgSLRU Sent by the SLRU to update statistics. + * ---------- + */ +typedef struct PgStat_MsgSLRU +{ + PgStat_MsgHdr m_hdr; + PgStat_Counter m_index; + PgStat_Counter m_blocks_zeroed; + PgStat_Counter m_blocks_hit; + PgStat_Counter m_blocks_read; + PgStat_Counter m_blocks_written; + PgStat_Counter m_blocks_exists; + PgStat_Counter m_flush; + PgStat_Counter m_truncate; +} PgStat_MsgSLRU; + +/* ---------- * PgStat_MsgRecoveryConflict Sent by the backend upon recovery conflict * ---------- */ @@ -560,11 +591,13 @@ typedef union PgStat_Msg PgStat_MsgResetcounter msg_resetcounter; PgStat_MsgResetsharedcounter msg_resetsharedcounter; PgStat_MsgResetsinglecounter msg_resetsinglecounter; + PgStat_MsgResetslrucounter msg_resetslrucounter; PgStat_MsgAutovacStart msg_autovacuum_start; PgStat_MsgVacuum msg_vacuum; PgStat_MsgAnalyze msg_analyze; PgStat_MsgArchiver msg_archiver; PgStat_MsgBgWriter msg_bgwriter; + PgStat_MsgSLRU msg_slru; PgStat_MsgFuncstat msg_funcstat; PgStat_MsgFuncpurge msg_funcpurge; PgStat_MsgRecoveryConflict msg_recoveryconflict; @@ -713,6 +746,21 @@ typedef struct PgStat_GlobalStats TimestampTz stat_reset_timestamp; } PgStat_GlobalStats; +/* + * SLRU statistics kept in the stats collector + */ +typedef struct PgStat_SLRUStats +{ + PgStat_Counter blocks_zeroed; + PgStat_Counter blocks_hit; + PgStat_Counter blocks_read; + PgStat_Counter blocks_written; + PgStat_Counter blocks_exists; + PgStat_Counter flush; + PgStat_Counter truncate; + TimestampTz stat_reset_timestamp; +} PgStat_SLRUStats; + /* ---------- * Backend states @@ -1211,6 +1259,11 @@ extern char *pgstat_stat_filename; extern PgStat_MsgBgWriter BgWriterStats; /* + * SLRU statistics counters are updated directly by slru. + */ +extern PgStat_MsgSLRU SlruStats[]; + +/* * Updated by pgstat_count_buffer_*_time macros */ extern PgStat_Counter pgStatBlockReadTime; @@ -1247,6 +1300,7 @@ extern void pgstat_clear_snapshot(void); extern void pgstat_reset_counters(void); extern void pgstat_reset_shared_counters(const char *); extern void pgstat_reset_single_counter(Oid objectid, PgStat_Single_Reset_Type type); +extern void pgstat_reset_slru_counter(const char *); extern void pgstat_report_autovac(Oid dboid); extern void pgstat_report_vacuum(Oid tableoid, bool shared, @@ -1422,5 +1476,16 @@ extern PgStat_StatFuncEntry *pgstat_fetch_stat_funcentry(Oid funcid); extern int pgstat_fetch_stat_numbackends(void); extern PgStat_ArchiverStats *pgstat_fetch_stat_archiver(void); extern PgStat_GlobalStats *pgstat_fetch_global(void); +extern PgStat_SLRUStats *pgstat_fetch_slru(void); + +extern void pgstat_count_slru_page_zeroed(SlruCtl ctl); +extern void pgstat_count_slru_page_hit(SlruCtl ctl); +extern void pgstat_count_slru_page_read(SlruCtl ctl); +extern void pgstat_count_slru_page_written(SlruCtl ctl); +extern void pgstat_count_slru_page_exists(SlruCtl ctl); +extern void pgstat_count_slru_flush(SlruCtl ctl); +extern void pgstat_count_slru_truncate(SlruCtl ctl); +extern char *pgstat_slru_name(int idx); +extern int pgstat_slru_index(const char *name); #endif /* PGSTAT_H */ |