13 #ifndef PGSTAT_INTERNAL_H
14 #define PGSTAT_INTERNAL_H
338 #define SLRU_NUM_ELEMENTS lengthof(slru_names)
582 #ifdef USE_ASSERT_CHECKING
585 #define pgstat_assert_is_up() ((void)true)
591 bool *created_entry);
690 bool create,
bool *created_entry);
818 return before_cc == after_cc;
838 memcpy(dst, src,
len);
854 const char *
key = (
const char *) d;
880 return ((
char *) (entry)) + off;
Datum idx(PG_FUNCTION_ARGS)
#define pg_read_barrier()
#define pg_write_barrier()
#define Assert(condition)
dsa_pointer dshash_table_handle
static uint32 fasthash32(const char *k, size_t len, uint64 seed)
#define BACKEND_NUM_TYPES
#define START_CRIT_SECTION()
#define CHECK_FOR_INTERRUPTS()
#define END_CRIT_SECTION()
static bool pgstat_is_kind_custom(PgStat_Kind kind)
#define PGSTAT_KIND_CUSTOM_MIN
#define PGSTAT_KIND_CUSTOM_SIZE
#define PGSTAT_KIND_BUILTIN_SIZE
bool pgstat_replslot_from_serialized_name_cb(const NameData *name, PgStat_HashKey *key)
void pgstat_flush_wal(bool nowait)
void pgstat_slru_snapshot_cb(void)
void pgstat_reset_entries_of_kind(PgStat_Kind kind, TimestampTz ts)
struct PgStatShared_Wal PgStatShared_Wal
void pgstat_archiver_init_shmem_cb(void *stats)
void pgstat_request_entry_refs_gc(void)
void pgstat_snapshot_fixed(PgStat_Kind kind)
struct PgStat_EntryRef PgStat_EntryRef
const PgStat_KindInfo * pgstat_get_kind_info(PgStat_Kind kind)
PgStatShared_Common * pgstat_init_entry(PgStat_Kind kind, PgStatShared_HashEntry *shhashent)
static void * pgstat_get_custom_snapshot_data(PgStat_Kind kind)
void pgstat_flush_io(bool nowait)
static void * pgstat_get_custom_shmem_data(PgStat_Kind kind)
static uint32 pgstat_hash_hash_key(const void *d, size_t size, void *arg)
struct PgStatShared_SLRU PgStatShared_SLRU
void pgstat_delete_pending_entry(PgStat_EntryRef *entry_ref)
bool pgstat_lock_entry_shared(PgStat_EntryRef *entry_ref, bool nowait)
void pgstat_attach_shmem(void)
static void pgstat_end_changecount_write(uint32 *cc)
static const char *const slru_names[]
static int pgstat_cmp_hash_key(const void *a, const void *b, size_t size, void *arg)
struct PgStat_KindInfo PgStat_KindInfo
void pgstat_database_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts)
struct PgStatShared_Function PgStatShared_Function
void pgstat_checkpointer_snapshot_cb(void)
bool pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
static void * pgstat_get_entry_data(PgStat_Kind kind, PgStatShared_Common *entry)
void pgstat_reset_entry(PgStat_Kind kind, Oid dboid, uint64 objid, TimestampTz ts)
bool pgstat_slru_flush_cb(bool nowait)
void pgstat_wal_reset_all_cb(TimestampTz ts)
struct PgStatShared_Subscription PgStatShared_Subscription
bool pgstat_io_have_pending_cb(void)
bool pgstat_io_flush_cb(bool nowait)
void AtPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state)
struct PgStatShared_IO PgStatShared_IO
void AtEOXact_PgStat_Database(bool isCommit, bool parallel)
#define pgstat_assert_is_up()
PGDLLIMPORT PgStat_LocalState pgStatLocal
void pgstat_archiver_reset_all_cb(TimestampTz ts)
void pgstat_checkpointer_init_shmem_cb(void *stats)
void pgstat_bgwriter_reset_all_cb(TimestampTz ts)
struct PgStat_HashKey PgStat_HashKey
struct PgStatShared_Archiver PgStatShared_Archiver
void pgstat_drop_transactional(PgStat_Kind kind, Oid dboid, uint64 objid)
void pgstat_replslot_to_serialized_name_cb(const PgStat_HashKey *key, const PgStatShared_Common *header, NameData *name)
bool pgstat_subscription_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
struct PgStatShared_HashEntry PgStatShared_HashEntry
struct PgStat_LocalState PgStat_LocalState
void pgstat_create_transactional(PgStat_Kind kind, Oid dboid, uint64 objid)
PgStat_EntryRef * pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create, bool *created_entry)
bool pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
void pgstat_wal_init_shmem_cb(void *stats)
void pgstat_io_reset_all_cb(TimestampTz ts)
static uint32 pgstat_begin_changecount_read(uint32 *cc)
void pgstat_update_dbstats(TimestampTz ts)
void pgstat_replslot_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts)
void pgstat_bgwriter_init_shmem_cb(void *stats)
void pgstat_reset_matching_entries(bool(*do_reset)(PgStatShared_HashEntry *, Datum), Datum match_data, TimestampTz ts)
void pgstat_slru_reset_all_cb(TimestampTz ts)
struct PgStat_SubXactStatus PgStat_SubXactStatus
void AtEOXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit)
void pgstat_wal_init_backend_cb(void)
struct PgStatShared_Relation PgStatShared_Relation
PgStat_StatDBEntry * pgstat_prep_database_pending(Oid dboid)
bool pgstat_wal_flush_cb(bool nowait)
void pgstat_drop_all_entries(void)
static bool pgstat_end_changecount_read(uint32 *cc, uint32 cc_before)
PgStat_EntryRef * pgstat_fetch_pending_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
void pgstat_bgwriter_snapshot_cb(void)
struct PgStatShared_Checkpointer PgStatShared_Checkpointer
void pgstat_unlock_entry(PgStat_EntryRef *entry_ref)
void pgstat_checkpointer_reset_all_cb(TimestampTz ts)
void pgstat_reset_database_timestamp(Oid dboid, TimestampTz ts)
static void pgstat_begin_changecount_write(uint32 *cc)
PgStat_SubXactStatus * pgstat_get_xact_stack_level(int nest_level)
bool pgstat_function_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
void * pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
void pgstat_report_disconnect(Oid dboid)
void pgstat_slru_init_shmem_cb(void *stats)
void PostPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state)
bool pgstat_database_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
struct PgStat_ShmemControl PgStat_ShmemControl
#define SLRU_NUM_ELEMENTS
bool pgstat_wal_have_pending_cb(void)
struct PgStatShared_Database PgStatShared_Database
void pgstat_wal_snapshot_cb(void)
static void pgstat_copy_changecounted_stats(void *dst, void *src, size_t len, uint32 *cc)
struct PgStatShared_BgWriter PgStatShared_BgWriter
PgStat_EntryRef * pgstat_get_entry_ref_locked(PgStat_Kind kind, Oid dboid, uint64 objid, bool nowait)
bool pgstat_slru_have_pending_cb(void)
void AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, int nestDepth)
void pgstat_register_kind(PgStat_Kind kind, const PgStat_KindInfo *kind_info)
void pgstat_io_snapshot_cb(void)
bool pgstat_lock_entry(PgStat_EntryRef *entry_ref, bool nowait)
static size_t pgstat_get_entry_len(PgStat_Kind kind)
PgStat_EntryRef * pgstat_prep_pending_entry(PgStat_Kind kind, Oid dboid, uint64 objid, bool *created_entry)
void pgstat_io_init_shmem_cb(void *stats)
struct PgStatShared_Common PgStatShared_Common
void pgstat_subscription_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts)
struct PgStatShared_ReplSlot PgStatShared_ReplSlot
void pgstat_archiver_snapshot_cb(void)
void pgstat_detach_shmem(void)
struct PgStat_Snapshot PgStat_Snapshot
void pgstat_relation_delete_pending_cb(PgStat_EntryRef *entry_ref)
static pg_noinline void Size size
PgStat_ArchiverStats reset_offset
PgStat_ArchiverStats stats
PgStat_BgWriterStats reset_offset
PgStat_BgWriterStats stats
PgStat_CheckpointerStats reset_offset
PgStat_CheckpointerStats stats
PgStatShared_Common header
PgStatShared_Common header
PgStat_StatFuncEntry stats
pg_atomic_uint32 refcount
pg_atomic_uint32 generation
LWLock locks[BACKEND_NUM_TYPES]
PgStatShared_Common header
PgStat_StatTabEntry stats
PgStatShared_Common header
PgStat_StatReplSlotEntry stats
PgStat_SLRUStats stats[SLRU_NUM_ELEMENTS]
PgStat_StatSubEntry stats
PgStatShared_Common header
PgStatShared_Common * shared_stats
PgStatShared_HashEntry * shared_entry
bool accessed_across_databases
bool(* have_fixed_pending_cb)(void)
void(* to_serialized_name)(const PgStat_HashKey *key, const PgStatShared_Common *header, NameData *name)
bool(* from_serialized_name)(const NameData *name, PgStat_HashKey *key)
bool(* flush_pending_cb)(PgStat_EntryRef *sr, bool nowait)
void(* reset_all_cb)(TimestampTz ts)
void(* init_backend_cb)(void)
void(* reset_timestamp_cb)(PgStatShared_Common *header, TimestampTz ts)
void(* init_shmem_cb)(void *stats)
void(* delete_pending_cb)(PgStat_EntryRef *sr)
void(* snapshot_cb)(void)
bool(* flush_fixed_cb)(bool nowait)
dshash_table * shared_hash
PgStat_ShmemControl * shmem
dshash_table_handle hash_handle
void * custom_data[PGSTAT_KIND_CUSTOM_SIZE]
pg_atomic_uint64 gc_request_count
PgStatShared_Archiver archiver
PgStatShared_Checkpointer checkpointer
PgStatShared_BgWriter bgwriter
PgStat_CheckpointerStats checkpointer
void * custom_data[PGSTAT_KIND_CUSTOM_SIZE]
TimestampTz snapshot_timestamp
bool custom_valid[PGSTAT_KIND_CUSTOM_SIZE]
PgStat_ArchiverStats archiver
PgStat_FetchConsistency mode
PgStat_SLRUStats slru[SLRU_NUM_ELEMENTS]
struct pgstat_snapshot_hash * stats
bool fixed_valid[PGSTAT_KIND_BUILTIN_SIZE]
PgStat_BgWriterStats bgwriter
PgStat_TableXactStatus * first
struct PgStat_SubXactStatus * prev
dclist_head pending_drops