PostgreSQL Source Code
git master
|
#include "datatype/timestamp.h"
#include "portability/instr_time.h"
#include "postmaster/pgarch.h"
#include "utils/backend_progress.h"
#include "utils/backend_status.h"
#include "utils/relcache.h"
#include "utils/wait_event.h"
Go to the source code of this file.
Data Structures | |
struct | PgStat_FunctionCounts |
struct | PgStat_BackendFunctionEntry |
struct | PgStat_FunctionCallUsage |
struct | PgStat_BackendSubEntry |
struct | PgStat_TableCounts |
struct | PgStat_TableStatus |
struct | PgStat_TableXactStatus |
struct | PgStat_ArchiverStats |
struct | PgStat_BgWriterStats |
struct | PgStat_CheckpointerStats |
struct | PgStat_StatDBEntry |
struct | PgStat_StatFuncEntry |
struct | PgStat_StatReplSlotEntry |
struct | PgStat_SLRUStats |
struct | PgStat_StatSubEntry |
struct | PgStat_StatTabEntry |
struct | PgStat_WalStats |
Macros | |
#define | PGSTAT_STAT_PERMANENT_DIRECTORY "pg_stat" |
#define | PGSTAT_STAT_PERMANENT_FILENAME "pg_stat/pgstat.stat" |
#define | PGSTAT_STAT_PERMANENT_TMPFILE "pg_stat/pgstat.tmp" |
#define | PG_STAT_TMP_DIR "pg_stat_tmp" |
#define | PGSTAT_KIND_FIRST_VALID PGSTAT_KIND_DATABASE |
#define | PGSTAT_KIND_LAST PGSTAT_KIND_WAL |
#define | PGSTAT_NUM_KINDS (PGSTAT_KIND_LAST + 1) |
#define | PGSTAT_FILE_FORMAT_ID 0x01A5BCA7 |
#define | pgstat_count_buffer_read_time(n) (pgStatBlockReadTime += (n)) |
#define | pgstat_count_buffer_write_time(n) (pgStatBlockWriteTime += (n)) |
#define | pgstat_count_conn_active_time(n) (pgStatActiveTime += (n)) |
#define | pgstat_count_conn_txn_idle_time(n) (pgStatTransactionIdleTime += (n)) |
#define | pgstat_should_count_relation(rel) |
#define | pgstat_count_heap_scan(rel) |
#define | pgstat_count_heap_getnext(rel) |
#define | pgstat_count_heap_fetch(rel) |
#define | pgstat_count_index_scan(rel) |
#define | pgstat_count_index_tuples(rel, n) |
#define | pgstat_count_buffer_read(rel) |
#define | pgstat_count_buffer_hit(rel) |
#define pgstat_count_buffer_hit | ( | rel | ) |
#define pgstat_count_buffer_read | ( | rel | ) |
#define pgstat_count_buffer_read_time | ( | n | ) | (pgStatBlockReadTime += (n)) |
#define pgstat_count_buffer_write_time | ( | n | ) | (pgStatBlockWriteTime += (n)) |
#define pgstat_count_conn_active_time | ( | n | ) | (pgStatActiveTime += (n)) |
#define pgstat_count_conn_txn_idle_time | ( | n | ) | (pgStatTransactionIdleTime += (n)) |
#define pgstat_count_heap_fetch | ( | rel | ) |
#define pgstat_count_heap_getnext | ( | rel | ) |
#define pgstat_count_heap_scan | ( | rel | ) |
#define pgstat_count_index_scan | ( | rel | ) |
#define pgstat_count_index_tuples | ( | rel, | |
n | |||
) |
#define PGSTAT_KIND_FIRST_VALID PGSTAT_KIND_DATABASE |
#define PGSTAT_KIND_LAST PGSTAT_KIND_WAL |
#define PGSTAT_NUM_KINDS (PGSTAT_KIND_LAST + 1) |
#define pgstat_should_count_relation | ( | rel | ) |
#define PGSTAT_STAT_PERMANENT_FILENAME "pg_stat/pgstat.stat" |
typedef struct PgStat_ArchiverStats PgStat_ArchiverStats |
typedef struct PgStat_BackendFunctionEntry PgStat_BackendFunctionEntry |
typedef struct PgStat_BackendSubEntry PgStat_BackendSubEntry |
typedef struct PgStat_BgWriterStats PgStat_BgWriterStats |
typedef struct PgStat_CheckpointerStats PgStat_CheckpointerStats |
typedef int64 PgStat_Counter |
typedef enum PgStat_FetchConsistency PgStat_FetchConsistency |
typedef struct PgStat_FunctionCallUsage PgStat_FunctionCallUsage |
typedef struct PgStat_FunctionCounts PgStat_FunctionCounts |
typedef enum PgStat_Kind PgStat_Kind |
typedef struct PgStat_SLRUStats PgStat_SLRUStats |
typedef struct PgStat_StatDBEntry PgStat_StatDBEntry |
typedef struct PgStat_StatFuncEntry PgStat_StatFuncEntry |
typedef struct PgStat_StatReplSlotEntry PgStat_StatReplSlotEntry |
typedef struct PgStat_StatSubEntry PgStat_StatSubEntry |
typedef struct PgStat_StatTabEntry PgStat_StatTabEntry |
typedef struct PgStat_TableCounts PgStat_TableCounts |
typedef struct PgStat_TableStatus PgStat_TableStatus |
typedef struct PgStat_TableXactStatus PgStat_TableXactStatus |
typedef struct PgStat_WalStats PgStat_WalStats |
typedef enum SessionEndType SessionEndType |
typedef enum TrackFunctionsLevel TrackFunctionsLevel |
enum PgStat_Kind |
enum SessionEndType |
enum TrackFunctionsLevel |
void AtEOSubXact_PgStat | ( | bool | isCommit, |
int | nestDepth | ||
) |
Definition at line 117 of file pgstat_xact.c.
References AtEOSubXact_PgStat_DroppedStats(), AtEOSubXact_PgStat_Relations(), PgStat_SubXactStatus::nest_level, pfree(), pgStatXactStack, and PgStat_SubXactStatus::prev.
Referenced by AbortSubTransaction(), and CommitSubTransaction().
Definition at line 41 of file pgstat_xact.c.
References Assert(), AtEOXact_PgStat_Database(), AtEOXact_PgStat_DroppedStats(), AtEOXact_PgStat_Relations(), PgStat_SubXactStatus::nest_level, pgstat_clear_snapshot(), pgStatXactStack, and PgStat_SubXactStatus::prev.
Referenced by AbortTransaction(), CommitTransaction(), and FinishPreparedTransaction().
void AtPrepare_PgStat | ( | void | ) |
Definition at line 196 of file pgstat_xact.c.
References Assert(), AtPrepare_PgStat_Relations(), PgStat_SubXactStatus::nest_level, pgStatXactStack, and PgStat_SubXactStatus::prev.
Referenced by PrepareTransaction().
PgStat_BackendFunctionEntry* find_funcstat_entry | ( | Oid | func_id | ) |
Definition at line 223 of file pgstat_function.c.
References MyDatabaseId, PgStat_EntryRef::pending, pgstat_fetch_pending_entry(), and PGSTAT_KIND_FUNCTION.
Referenced by pg_stat_get_xact_function_calls(), pg_stat_get_xact_function_self_time(), and pg_stat_get_xact_function_total_time().
PgStat_TableStatus* find_tabstat_entry | ( | Oid | rel_id | ) |
Definition at line 475 of file pgstat_relation.c.
References InvalidOid, MyDatabaseId, PgStat_EntryRef::pending, pgstat_fetch_pending_entry(), and PGSTAT_KIND_RELATION.
Referenced by pg_stat_get_xact_blocks_fetched(), pg_stat_get_xact_blocks_hit(), pg_stat_get_xact_numscans(), pg_stat_get_xact_tuples_deleted(), pg_stat_get_xact_tuples_fetched(), pg_stat_get_xact_tuples_hot_updated(), pg_stat_get_xact_tuples_inserted(), pg_stat_get_xact_tuples_returned(), and pg_stat_get_xact_tuples_updated().
void pgstat_acquire_replslot | ( | struct ReplicationSlot * | slot | ) |
Definition at line 136 of file pgstat_replslot.c.
References ReplicationSlot::data, if(), InvalidOid, ReplicationSlotPersistentData::name, NameStr, namestrcmp(), namestrcpy(), pgstat_get_entry_ref_locked(), PGSTAT_KIND_REPLSLOT, pgstat_unlock_entry(), ReplicationSlotIndex(), PgStat_EntryRef::shared_stats, PgStat_StatReplSlotEntry::slotname, and PgStatShared_ReplSlot::stats.
Referenced by ReplicationSlotAcquire().
void pgstat_assoc_relation | ( | Relation | rel | ) |
Definition at line 132 of file pgstat_relation.c.
References Assert(), RelationData::pgstat_enabled, RelationData::pgstat_info, pgstat_prep_relation_pending(), RelationData::rd_rel, PgStat_TableStatus::relation, and RelationGetRelid.
void pgstat_before_server_shutdown | ( | int | code, |
Datum | arg | ||
) |
Definition at line 448 of file pgstat.c.
References Assert(), PgStat_ShmemControl::is_shutdown, pgstat_report_stat(), pgstat_write_statsfile(), pgStatLocal, and PgStat_LocalState::shmem.
Referenced by CheckpointerMain(), and InitPostgres().
void pgstat_clear_snapshot | ( | void | ) |
Definition at line 752 of file pgstat.c.
References PgStat_Snapshot::context, PgStat_Snapshot::fixed_valid, MemoryContextDelete(), PgStat_Snapshot::mode, pgstat_assert_is_up, pgstat_clear_backend_activity_snapshot(), PGSTAT_FETCH_CONSISTENCY_NONE, pgStatLocal, PgStat_LocalState::snapshot, and PgStat_Snapshot::stats.
Referenced by AtEOXact_PgStat(), pg_stat_clear_snapshot(), and PostPrepare_PgStat().
Definition at line 58 of file pgstat_relation.c.
References InvalidOid, MyDatabaseId, pgstat_fetch_stat_tabentry_ext(), pgstat_get_entry_ref_locked(), PGSTAT_KIND_RELATION, pgstat_unlock_entry(), RelationData::rd_rel, RelationGetRelid, PgStat_EntryRef::shared_stats, and PgStatShared_Relation::stats.
Referenced by index_concurrently_swap().
void pgstat_count_heap_delete | ( | Relation | rel | ) |
Definition at line 383 of file pgstat_relation.c.
References ensure_tabstat_xact_level(), RelationData::pgstat_info, pgstat_should_count_relation, PgStat_TableStatus::trans, and PgStat_TableXactStatus::tuples_deleted.
Referenced by heap_abort_speculative(), and heap_delete().
void pgstat_count_heap_insert | ( | Relation | rel, |
PgStat_Counter | n | ||
) |
Definition at line 349 of file pgstat_relation.c.
References ensure_tabstat_xact_level(), RelationData::pgstat_info, pgstat_should_count_relation, PgStat_TableStatus::trans, and PgStat_TableXactStatus::tuples_inserted.
Referenced by ExecRefreshMatView(), heap_insert(), and heap_multi_insert().
Definition at line 364 of file pgstat_relation.c.
References ensure_tabstat_xact_level(), RelationData::pgstat_info, pgstat_should_count_relation, PgStat_TableStatus::t_counts, PgStat_TableCounts::t_tuples_hot_updated, PgStat_TableStatus::trans, and PgStat_TableXactStatus::tuples_updated.
Referenced by heap_update().
void pgstat_count_slru_flush | ( | int | slru_idx | ) |
Definition at line 89 of file pgstat_slru.c.
References PgStat_SLRUStats::flush, and get_slru_entry().
Referenced by SimpleLruWriteAll().
void pgstat_count_slru_page_exists | ( | int | slru_idx | ) |
Definition at line 71 of file pgstat_slru.c.
References PgStat_SLRUStats::blocks_exists, and get_slru_entry().
Referenced by SimpleLruDoesPhysicalPageExist().
void pgstat_count_slru_page_hit | ( | int | slru_idx | ) |
Definition at line 65 of file pgstat_slru.c.
References PgStat_SLRUStats::blocks_hit, and get_slru_entry().
Referenced by SimpleLruReadPage(), and SimpleLruReadPage_ReadOnly().
void pgstat_count_slru_page_read | ( | int | slru_idx | ) |
Definition at line 77 of file pgstat_slru.c.
References PgStat_SLRUStats::blocks_read, and get_slru_entry().
Referenced by SimpleLruReadPage().
void pgstat_count_slru_page_written | ( | int | slru_idx | ) |
Definition at line 83 of file pgstat_slru.c.
References PgStat_SLRUStats::blocks_written, and get_slru_entry().
Referenced by SlruPhysicalWritePage().
void pgstat_count_slru_page_zeroed | ( | int | slru_idx | ) |
Definition at line 59 of file pgstat_slru.c.
References PgStat_SLRUStats::blocks_zeroed, and get_slru_entry().
Referenced by SimpleLruZeroPage().
void pgstat_count_slru_truncate | ( | int | slru_idx | ) |
Definition at line 95 of file pgstat_slru.c.
References get_slru_entry(), and PgStat_SLRUStats::truncate.
Referenced by SimpleLruTruncate().
void pgstat_count_truncate | ( | Relation | rel | ) |
Definition at line 398 of file pgstat_relation.c.
References ensure_tabstat_xact_level(), RelationData::pgstat_info, pgstat_should_count_relation, save_truncdrop_counters(), PgStat_TableStatus::trans, PgStat_TableXactStatus::tuples_deleted, PgStat_TableXactStatus::tuples_inserted, and PgStat_TableXactStatus::tuples_updated.
Referenced by ExecRefreshMatView(), and ExecuteTruncateGuts().
void pgstat_create_function | ( | Oid | proid | ) |
Definition at line 45 of file pgstat_function.c.
References MyDatabaseId, pgstat_create_transactional(), and PGSTAT_KIND_FUNCTION.
Referenced by ProcedureCreate().
void pgstat_create_relation | ( | Relation | rel | ) |
Definition at line 169 of file pgstat_relation.c.
References InvalidOid, MyDatabaseId, pgstat_create_transactional(), PGSTAT_KIND_RELATION, RelationData::rd_rel, and RelationGetRelid.
Referenced by heap_create_with_catalog().
void pgstat_create_replslot | ( | struct ReplicationSlot * | slot | ) |
Definition at line 113 of file pgstat_replslot.c.
References ReplicationSlot::data, InvalidOid, ReplicationSlotPersistentData::name, NameStr, namestrcpy(), pgstat_get_entry_ref_locked(), PGSTAT_KIND_REPLSLOT, pgstat_unlock_entry(), ReplicationSlotIndex(), PgStat_EntryRef::shared_stats, PgStat_StatReplSlotEntry::slotname, and PgStatShared_ReplSlot::stats.
Referenced by ReplicationSlotCreate().
void pgstat_create_subscription | ( | Oid | subid | ) |
Definition at line 48 of file pgstat_subscription.c.
References InvalidOid, pgstat_create_transactional(), and PGSTAT_KIND_SUBSCRIPTION.
Referenced by CreateSubscription().
void pgstat_discard_stats | ( | void | ) |
Definition at line 405 of file pgstat.c.
References DEBUG2, elog, ereport, errcode_for_file_access(), errmsg(), LOG, pgstat_reset_after_failure(), and PGSTAT_STAT_PERMANENT_FILENAME.
Referenced by StartupXLOG().
void pgstat_drop_database | ( | Oid | databaseid | ) |
Definition at line 44 of file pgstat_database.c.
References InvalidOid, pgstat_drop_transactional(), and PGSTAT_KIND_DATABASE.
Referenced by dropdb().
void pgstat_drop_function | ( | Oid | proid | ) |
Definition at line 60 of file pgstat_function.c.
References MyDatabaseId, pgstat_drop_transactional(), and PGSTAT_KIND_FUNCTION.
Referenced by RemoveFunctionById().
void pgstat_drop_relation | ( | Relation | rel | ) |
Definition at line 180 of file pgstat_relation.c.
References GetCurrentTransactionNestLevel(), InvalidOid, MyDatabaseId, PgStat_TableXactStatus::nest_level, pgstat_drop_transactional(), RelationData::pgstat_info, PGSTAT_KIND_RELATION, pgstat_should_count_relation, RelationData::rd_rel, RelationGetRelid, save_truncdrop_counters(), PgStat_TableStatus::trans, PgStat_TableXactStatus::tuples_deleted, PgStat_TableXactStatus::tuples_inserted, and PgStat_TableXactStatus::tuples_updated.
Referenced by heap_drop_with_catalog().
void pgstat_drop_replslot | ( | struct ReplicationSlot * | slot | ) |
Definition at line 165 of file pgstat_replslot.c.
References InvalidOid, pgstat_drop_entry(), PGSTAT_KIND_REPLSLOT, and ReplicationSlotIndex().
Referenced by ReplicationSlotDropPtr().
void pgstat_drop_subscription | ( | Oid | subid | ) |
Definition at line 60 of file pgstat_subscription.c.
References InvalidOid, pgstat_drop_transactional(), and PGSTAT_KIND_SUBSCRIPTION.
Referenced by DropSubscription().
void pgstat_end_function_usage | ( | PgStat_FunctionCallUsage * | fcu, |
bool | finalize | ||
) |
Definition at line 146 of file pgstat_function.c.
References PgStat_FunctionCounts::f_numcalls, PgStat_FunctionCounts::f_self_time, PgStat_FunctionCallUsage::f_start, PgStat_FunctionCounts::f_total_time, PgStat_FunctionCallUsage::fs, INSTR_TIME_ADD, INSTR_TIME_SET_CURRENT, INSTR_TIME_SUBTRACT, PgStat_FunctionCallUsage::save_f_total_time, PgStat_FunctionCallUsage::save_total, and total_func_time.
Referenced by call_pltcl_start_proc(), EventTriggerInvoke(), ExecCallTriggerFunc(), ExecEvalFuncExprFusage(), ExecEvalFuncExprStrictFusage(), ExecMakeFunctionResultSet(), ExecMakeTableFunctionResult(), ExecuteCallStmt(), and fmgr_security_definer().
void pgstat_execute_transactional_drops | ( | int | ndrops, |
struct xl_xact_stats_item * | items, | ||
bool | is_redo | ||
) |
Definition at line 320 of file pgstat_xact.c.
References xl_xact_stats_item::dboid, i, xl_xact_stats_item::kind, xl_xact_stats_item::objoid, pgstat_drop_entry(), and pgstat_request_entry_refs_gc().
Referenced by FinishPreparedTransaction(), xact_redo_abort(), and xact_redo_commit().
PgStat_StatReplSlotEntry* pgstat_fetch_replslot | ( | NameData | slotname | ) |
Definition at line 176 of file pgstat_replslot.c.
References get_replslot_index(), idx(), InvalidOid, NameStr, pgstat_fetch_entry(), and PGSTAT_KIND_REPLSLOT.
Referenced by pg_stat_get_replication_slot().
PgStat_SLRUStats* pgstat_fetch_slru | ( | void | ) |
Definition at line 105 of file pgstat_slru.c.
References PGSTAT_KIND_SLRU, pgstat_snapshot_fixed(), pgStatLocal, PgStat_Snapshot::slru, and PgStat_LocalState::snapshot.
Referenced by pg_stat_get_slru().
PgStat_ArchiverStats* pgstat_fetch_stat_archiver | ( | void | ) |
Definition at line 58 of file pgstat_archiver.c.
References PgStat_Snapshot::archiver, PGSTAT_KIND_ARCHIVER, pgstat_snapshot_fixed(), pgStatLocal, and PgStat_LocalState::snapshot.
Referenced by pg_stat_get_archiver().
PgStat_BgWriterStats* pgstat_fetch_stat_bgwriter | ( | void | ) |
Definition at line 66 of file pgstat_bgwriter.c.
References PgStat_Snapshot::bgwriter, PGSTAT_KIND_BGWRITER, pgstat_snapshot_fixed(), pgStatLocal, and PgStat_LocalState::snapshot.
Referenced by pg_stat_get_bgwriter_buf_written_clean(), pg_stat_get_bgwriter_maxwritten_clean(), pg_stat_get_bgwriter_stat_reset_time(), and pg_stat_get_buf_alloc().
PgStat_CheckpointerStats* pgstat_fetch_stat_checkpointer | ( | void | ) |
Definition at line 74 of file pgstat_checkpointer.c.
References PgStat_Snapshot::checkpointer, PGSTAT_KIND_CHECKPOINTER, pgstat_snapshot_fixed(), pgStatLocal, and PgStat_LocalState::snapshot.
Referenced by pg_stat_get_bgwriter_buf_written_checkpoints(), pg_stat_get_bgwriter_requested_checkpoints(), pg_stat_get_bgwriter_timed_checkpoints(), pg_stat_get_buf_fsync_backend(), pg_stat_get_buf_written_backend(), pg_stat_get_checkpoint_sync_time(), and pg_stat_get_checkpoint_write_time().
PgStat_StatDBEntry* pgstat_fetch_stat_dbentry | ( | Oid | dbid | ) |
Definition at line 239 of file pgstat_database.c.
References InvalidOid, pgstat_fetch_entry(), and PGSTAT_KIND_DATABASE.
Referenced by do_start_worker(), pg_stat_get_db_active_time(), pg_stat_get_db_blk_read_time(), pg_stat_get_db_blk_write_time(), pg_stat_get_db_blocks_fetched(), pg_stat_get_db_blocks_hit(), pg_stat_get_db_checksum_failures(), pg_stat_get_db_checksum_last_failure(), pg_stat_get_db_conflict_all(), pg_stat_get_db_conflict_bufferpin(), pg_stat_get_db_conflict_lock(), pg_stat_get_db_conflict_snapshot(), pg_stat_get_db_conflict_startup_deadlock(), pg_stat_get_db_conflict_tablespace(), pg_stat_get_db_deadlocks(), pg_stat_get_db_idle_in_transaction_time(), pg_stat_get_db_session_time(), pg_stat_get_db_sessions(), pg_stat_get_db_sessions_abandoned(), pg_stat_get_db_sessions_fatal(), pg_stat_get_db_sessions_killed(), pg_stat_get_db_stat_reset_time(), pg_stat_get_db_temp_bytes(), pg_stat_get_db_temp_files(), pg_stat_get_db_tuples_deleted(), pg_stat_get_db_tuples_fetched(), pg_stat_get_db_tuples_inserted(), pg_stat_get_db_tuples_returned(), pg_stat_get_db_tuples_updated(), pg_stat_get_db_xact_commit(), pg_stat_get_db_xact_rollback(), and rebuild_database_list().
PgStat_StatFuncEntry* pgstat_fetch_stat_funcentry | ( | Oid | funcid | ) |
Definition at line 239 of file pgstat_function.c.
References MyDatabaseId, pgstat_fetch_entry(), and PGSTAT_KIND_FUNCTION.
Referenced by pg_stat_get_function_calls(), pg_stat_get_function_self_time(), and pg_stat_get_function_total_time().
PgStat_StatSubEntry* pgstat_fetch_stat_subscription | ( | Oid | subid | ) |
Definition at line 71 of file pgstat_subscription.c.
References InvalidOid, pgstat_fetch_entry(), and PGSTAT_KIND_SUBSCRIPTION.
Referenced by pg_stat_get_subscription_stats().
PgStat_StatTabEntry* pgstat_fetch_stat_tabentry | ( | Oid | relid | ) |
Definition at line 438 of file pgstat_relation.c.
References pgstat_fetch_stat_tabentry_ext().
Referenced by pg_stat_get_analyze_count(), pg_stat_get_autoanalyze_count(), pg_stat_get_autovacuum_count(), pg_stat_get_blocks_fetched(), pg_stat_get_blocks_hit(), pg_stat_get_dead_tuples(), pg_stat_get_ins_since_vacuum(), pg_stat_get_last_analyze_time(), pg_stat_get_last_autoanalyze_time(), pg_stat_get_last_autovacuum_time(), pg_stat_get_last_vacuum_time(), pg_stat_get_live_tuples(), pg_stat_get_mod_since_analyze(), pg_stat_get_numscans(), pg_stat_get_tuples_deleted(), pg_stat_get_tuples_fetched(), pg_stat_get_tuples_hot_updated(), pg_stat_get_tuples_inserted(), pg_stat_get_tuples_returned(), pg_stat_get_tuples_updated(), and pg_stat_get_vacuum_count().
PgStat_StatTabEntry* pgstat_fetch_stat_tabentry_ext | ( | bool | shared, |
Oid | relid | ||
) |
Definition at line 458 of file pgstat_relation.c.
References InvalidOid, MyDatabaseId, pgstat_fetch_entry(), and PGSTAT_KIND_RELATION.
Referenced by do_autovacuum(), pgstat_copy_relation_stats(), pgstat_fetch_stat_tabentry(), and recheck_relation_needs_vacanalyze().
PgStat_WalStats* pgstat_fetch_stat_wal | ( | void | ) |
Definition at line 53 of file pgstat_wal.c.
References PGSTAT_KIND_WAL, pgstat_snapshot_fixed(), pgStatLocal, PgStat_LocalState::snapshot, and PgStat_Snapshot::wal.
Referenced by pg_stat_get_wal().
void pgstat_force_next_flush | ( | void | ) |
Definition at line 665 of file pgstat.c.
References pgStatForceNextFlush.
Referenced by pg_stat_force_next_flush().
PgStat_Kind pgstat_get_kind_from_str | ( | char * | kind_str | ) |
Definition at line 1190 of file pgstat.c.
References ereport, errcode(), errmsg(), ERROR, name, pg_strcasecmp(), PGSTAT_KIND_DATABASE, PGSTAT_KIND_FIRST_VALID, pgstat_kind_infos, and PGSTAT_KIND_LAST.
Referenced by pg_stat_have_stats().
int pgstat_get_slru_index | ( | const char * | name | ) |
Definition at line 132 of file pgstat_slru.c.
References i, name, slru_names, and SLRU_NUM_ELEMENTS.
Referenced by pgstat_reset_slru(), and SimpleLruInit().
const char* pgstat_get_slru_name | ( | int | slru_idx | ) |
Definition at line 118 of file pgstat_slru.c.
References slru_names, and SLRU_NUM_ELEMENTS.
Referenced by pg_stat_get_slru().
TimestampTz pgstat_get_stat_snapshot_timestamp | ( | bool * | have_snapshot | ) |
Definition at line 869 of file pgstat.c.
References PgStat_Snapshot::mode, PGSTAT_FETCH_CONSISTENCY_SNAPSHOT, pgStatLocal, PgStat_LocalState::snapshot, and PgStat_Snapshot::snapshot_timestamp.
Referenced by pg_stat_get_snapshot_timestamp().
int pgstat_get_transactional_drops | ( | bool | isCommit, |
struct xl_xact_stats_item ** | items | ||
) |
Definition at line 278 of file pgstat_xact.c.
References Assert(), dlist_iter::cur, dlist_container, dlist_foreach, PgStat_PendingDroppedStatsItem::is_create, PgStat_PendingDroppedStatsItem::item, PgStat_SubXactStatus::nest_level, palloc(), PgStat_SubXactStatus::pending_drops, PgStat_SubXactStatus::pending_drops_count, pgStatXactStack, and PgStat_SubXactStatus::prev.
Referenced by RecordTransactionAbort(), RecordTransactionCommit(), and StartPrepare().
bool pgstat_have_entry | ( | PgStat_Kind | kind, |
Oid | dboid, | ||
Oid | objoid | ||
) |
Definition at line 883 of file pgstat.c.
References pgstat_get_entry_ref(), and pgstat_get_kind_info().
Referenced by pg_stat_have_stats().
void pgstat_init_function_usage | ( | struct FunctionCallInfoBaseData * | fcinfo, |
PgStat_FunctionCallUsage * | fcu | ||
) |
void pgstat_init_relation | ( | Relation | rel | ) |
Definition at line 92 of file pgstat_relation.c.
References RelationData::pgstat_enabled, RelationData::pgstat_info, pgstat_track_counts, pgstat_unlink_relation(), and RelationData::rd_rel.
Referenced by relation_open(), and try_relation_open().
void pgstat_initialize | ( | void | ) |
Definition at line 523 of file pgstat.c.
References Assert(), before_shmem_exit(), pgstat_attach_shmem(), pgstat_init_wal(), and pgstat_shutdown_hook().
Referenced by BaseInit().
void pgstat_report_analyze | ( | Relation | rel, |
PgStat_Counter | livetuples, | ||
PgStat_Counter | deadtuples, | ||
bool | resetcounter | ||
) |
Definition at line 269 of file pgstat_relation.c.
References PgStat_StatTabEntry::analyze_count, PgStat_StatTabEntry::analyze_timestamp, Assert(), PgStat_StatTabEntry::autovac_analyze_count, PgStat_StatTabEntry::autovac_analyze_timestamp, PgStat_StatTabEntry::changes_since_analyze, GetCurrentTimestamp(), if(), InvalidOid, IsAutoVacuumWorkerProcess(), Max, MyDatabaseId, PgStat_StatTabEntry::n_dead_tuples, PgStat_StatTabEntry::n_live_tuples, pgstat_get_entry_ref_locked(), RelationData::pgstat_info, PGSTAT_KIND_RELATION, pgstat_should_count_relation, pgstat_track_counts, pgstat_unlock_entry(), RelationData::rd_rel, RelationGetRelid, PgStat_EntryRef::shared_stats, PgStatShared_Relation::stats, PgStat_TableStatus::t_counts, PgStat_TableCounts::t_delta_dead_tuples, PgStat_TableStatus::trans, and trans.
Referenced by do_analyze_rel().
void pgstat_report_archiver | ( | const char * | xlog, |
bool | failed | ||
) |
Definition at line 28 of file pgstat_archiver.c.
References PgStat_ArchiverStats::archived_count, PgStat_ShmemControl::archiver, PgStatShared_Archiver::changecount, PgStat_ArchiverStats::failed_count, GetCurrentTimestamp(), PgStat_ArchiverStats::last_archived_timestamp, PgStat_ArchiverStats::last_archived_wal, PgStat_ArchiverStats::last_failed_timestamp, PgStat_ArchiverStats::last_failed_wal, now(), pgstat_begin_changecount_write(), pgstat_end_changecount_write(), pgStatLocal, PgStat_LocalState::shmem, and PgStatShared_Archiver::stats.
Referenced by pgarch_ArchiverCopyLoop().
void pgstat_report_autovac | ( | Oid | dboid | ) |
Definition at line 55 of file pgstat_database.c.
References Assert(), GetCurrentTimestamp(), InvalidOid, IsUnderPostmaster, PgStat_StatDBEntry::last_autovac_time, pgstat_get_entry_ref_locked(), PGSTAT_KIND_DATABASE, pgstat_unlock_entry(), PgStat_EntryRef::shared_stats, and PgStatShared_Database::stats.
Referenced by AutoVacWorkerMain().
void pgstat_report_bgwriter | ( | void | ) |
Definition at line 30 of file pgstat_bgwriter.c.
References Assert(), PgStat_ShmemControl::bgwriter, BGWRITER_ACC, PgStatShared_BgWriter::changecount, PgStat_ShmemControl::is_shutdown, MemSet, PendingBgWriterStats, pgstat_assert_is_up, pgstat_begin_changecount_write(), pgstat_end_changecount_write(), pgStatLocal, and PgStat_LocalState::shmem.
Referenced by BackgroundWriterMain().
void pgstat_report_checkpointer | ( | void | ) |
Definition at line 30 of file pgstat_checkpointer.c.
References Assert(), PgStatShared_Checkpointer::changecount, PgStat_ShmemControl::checkpointer, CHECKPOINTER_ACC, PgStat_ShmemControl::is_shutdown, MemSet, PendingCheckpointerStats, pgstat_assert_is_up, pgstat_begin_changecount_write(), pgstat_end_changecount_write(), pgStatLocal, and PgStat_LocalState::shmem.
Referenced by CheckpointerMain(), CheckpointWriteDelay(), and HandleCheckpointerInterrupts().
void pgstat_report_checksum_failure | ( | void | ) |
Definition at line 163 of file pgstat_database.c.
References MyDatabaseId, and pgstat_report_checksum_failures_in_db().
Referenced by PageIsVerifiedExtended().
void pgstat_report_checksum_failures_in_db | ( | Oid | dboid, |
int | failurecount | ||
) |
Definition at line 137 of file pgstat_database.c.
References GetCurrentTimestamp(), InvalidOid, PgStat_StatDBEntry::last_checksum_failure, PgStat_StatDBEntry::n_checksum_failures, pgstat_get_entry_ref_locked(), PGSTAT_KIND_DATABASE, pgstat_track_counts, pgstat_unlock_entry(), PgStat_EntryRef::shared_stats, and PgStatShared_Database::stats.
Referenced by pgstat_report_checksum_failure(), and sendFile().
void pgstat_report_connect | ( | Oid | dboid | ) |
Definition at line 188 of file pgstat_database.c.
References MyDatabaseId, MyStartTimestamp, PgStat_StatDBEntry::n_sessions, pgLastSessionReportTime, pgstat_prep_database_pending(), and pgstat_should_report_connstat().
Referenced by PostgresMain().
void pgstat_report_deadlock | ( | void | ) |
Definition at line 122 of file pgstat_database.c.
References MyDatabaseId, PgStat_StatDBEntry::n_deadlocks, pgstat_prep_database_pending(), and pgstat_track_counts.
Referenced by DeadLockReport().
void pgstat_report_recovery_conflict | ( | int | reason | ) |
Definition at line 81 of file pgstat_database.c.
References Assert(), IsUnderPostmaster, MyDatabaseId, PgStat_StatDBEntry::n_conflict_bufferpin, PgStat_StatDBEntry::n_conflict_lock, PgStat_StatDBEntry::n_conflict_snapshot, PgStat_StatDBEntry::n_conflict_startup_deadlock, PgStat_StatDBEntry::n_conflict_tablespace, pgstat_prep_database_pending(), pgstat_track_counts, PROCSIG_RECOVERY_CONFLICT_BUFFERPIN, PROCSIG_RECOVERY_CONFLICT_DATABASE, PROCSIG_RECOVERY_CONFLICT_LOCK, PROCSIG_RECOVERY_CONFLICT_SNAPSHOT, PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK, and PROCSIG_RECOVERY_CONFLICT_TABLESPACE.
Referenced by ProcessInterrupts().
void pgstat_report_replslot | ( | struct ReplicationSlot * | slot, |
const PgStat_StatReplSlotEntry * | repSlotStat | ||
) |
Definition at line 74 of file pgstat_replslot.c.
References Assert(), ReplicationSlot::data, InvalidOid, ReplicationSlotPersistentData::name, NameStr, namestrcmp(), pgstat_get_entry_ref_locked(), PGSTAT_KIND_REPLSLOT, pgstat_unlock_entry(), ReplicationSlotIndex(), REPLSLOT_ACC, PgStat_EntryRef::shared_stats, PgStat_StatReplSlotEntry::slotname, and PgStatShared_ReplSlot::stats.
Referenced by UpdateDecodingStats().
long pgstat_report_stat | ( | bool | force | ) |
Definition at line 565 of file pgstat.c.
References Assert(), dlist_is_empty(), GetCurrentTransactionStopTimestamp(), have_slrustats, PgStat_ShmemControl::is_shutdown, IsTransactionBlock(), now(), pgstat_assert_is_up, pgstat_flush_pending_entries(), pgstat_flush_wal(), pgstat_have_pending_wal(), PGSTAT_IDLE_INTERVAL, PGSTAT_MAX_INTERVAL, PGSTAT_MIN_INTERVAL, pgstat_slru_flush(), pgstat_update_dbstats(), pgStatForceNextFlush, pgStatLocal, pgStatPending, PgStat_LocalState::shmem, and TimestampDifferenceExceeds().
Referenced by AllTablesyncsReady(), apply_handle_commit_internal(), apply_handle_commit_prepared(), apply_handle_prepare(), apply_handle_rollback_prepared(), apply_handle_stream_prepare(), LogicalRepApplyLoop(), LogicalRepSyncTableStart(), pg_attribute_noreturn(), pgstat_before_server_shutdown(), pgstat_shutdown_hook(), PostgresMain(), process_syncing_tables_for_apply(), and ProcessInterrupts().
Definition at line 27 of file pgstat_subscription.c.
References PgStat_BackendSubEntry::apply_error_count, InvalidOid, PgStat_EntryRef::pending, PGSTAT_KIND_SUBSCRIPTION, pgstat_prep_pending_entry(), and PgStat_BackendSubEntry::sync_error_count.
Referenced by DisableSubscriptionAndExit(), start_apply(), and start_table_sync().
void pgstat_report_vacuum | ( | Oid | tableoid, |
bool | shared, | ||
PgStat_Counter | livetuples, | ||
PgStat_Counter | deadtuples | ||
) |
Definition at line 211 of file pgstat_relation.c.
References PgStat_StatTabEntry::autovac_vacuum_count, PgStat_StatTabEntry::autovac_vacuum_timestamp, GetCurrentTimestamp(), if(), PgStat_StatTabEntry::inserts_since_vacuum, InvalidOid, IsAutoVacuumWorkerProcess(), MyDatabaseId, PgStat_StatTabEntry::n_dead_tuples, PgStat_StatTabEntry::n_live_tuples, pgstat_get_entry_ref_locked(), PGSTAT_KIND_RELATION, pgstat_track_counts, pgstat_unlock_entry(), PgStat_EntryRef::shared_stats, PgStatShared_Relation::stats, PgStat_StatTabEntry::vacuum_count, and PgStat_StatTabEntry::vacuum_timestamp.
Referenced by heap_vacuum_rel().
void pgstat_report_wal | ( | bool | force | ) |
Definition at line 43 of file pgstat_wal.c.
References pgstat_flush_wal().
Referenced by CheckpointerMain(), HandleCheckpointerInterrupts(), HandleWalWriterInterrupts(), and WalWriterMain().
void pgstat_reset | ( | PgStat_Kind | kind, |
Oid | dboid, | ||
Oid | objectid | ||
) |
Definition at line 705 of file pgstat.c.
References PgStat_KindInfo::accessed_across_databases, Assert(), GetCurrentTimestamp(), pgstat_get_kind_info(), pgstat_reset_database_timestamp(), and pgstat_reset_entry().
Referenced by pg_stat_reset_single_function_counters(), pg_stat_reset_single_table_counters(), pg_stat_reset_subscription_stats(), pgstat_create_transactional(), and pgstat_reset_replslot().
void pgstat_reset_counters | ( | void | ) |
Definition at line 686 of file pgstat.c.
References GetCurrentTimestamp(), match_db_entries(), MyDatabaseId, ObjectIdGetDatum, and pgstat_reset_matching_entries().
Referenced by pg_stat_reset().
void pgstat_reset_of_kind | ( | PgStat_Kind | kind | ) |
Definition at line 727 of file pgstat.c.
References PgStat_KindInfo::fixed_amount, GetCurrentTimestamp(), pgstat_get_kind_info(), pgstat_reset_entries_of_kind(), and PgStat_KindInfo::reset_all_cb.
Referenced by pg_stat_reset_replication_slot(), pg_stat_reset_shared(), pg_stat_reset_slru(), and pg_stat_reset_subscription_stats().
void pgstat_reset_replslot | ( | const char * | name | ) |
Definition at line 43 of file pgstat_replslot.c.
References AssertArg, ereport, errcode(), errmsg(), ERROR, InvalidOid, name, PGSTAT_KIND_REPLSLOT, pgstat_reset(), ReplicationSlotIndex(), SearchNamedReplicationSlot(), and SlotIsPhysical.
Referenced by pg_stat_reset_replication_slot().
void pgstat_reset_slru | ( | const char * | name | ) |
Definition at line 45 of file pgstat_slru.c.
References AssertArg, GetCurrentTimestamp(), name, pgstat_get_slru_index(), and pgstat_reset_slru_counter_internal().
Referenced by pg_stat_reset_slru().
void pgstat_restore_stats | ( | void | ) |
Definition at line 393 of file pgstat.c.
References pgstat_read_statsfile().
Referenced by StartupXLOG().
void pgstat_twophase_postabort | ( | TransactionId | xid, |
uint16 | info, | ||
void * | recdata, | ||
uint32 | len | ||
) |
Definition at line 729 of file pgstat_relation.c.
References TwoPhasePgStatRecord::deleted_pre_truncdrop, TwoPhasePgStatRecord::inserted_pre_truncdrop, pgstat_prep_relation_pending(), PgStat_TableStatus::t_counts, PgStat_TableCounts::t_delta_dead_tuples, TwoPhasePgStatRecord::t_id, TwoPhasePgStatRecord::t_shared, TwoPhasePgStatRecord::t_truncdropped, PgStat_TableCounts::t_tuples_deleted, PgStat_TableCounts::t_tuples_inserted, PgStat_TableCounts::t_tuples_updated, TwoPhasePgStatRecord::tuples_deleted, TwoPhasePgStatRecord::tuples_inserted, TwoPhasePgStatRecord::tuples_updated, and TwoPhasePgStatRecord::updated_pre_truncdrop.
void pgstat_twophase_postcommit | ( | TransactionId | xid, |
uint16 | info, | ||
void * | recdata, | ||
uint32 | len | ||
) |
Definition at line 693 of file pgstat_relation.c.
References pgstat_prep_relation_pending(), PgStat_TableCounts::t_changed_tuples, PgStat_TableStatus::t_counts, PgStat_TableCounts::t_delta_dead_tuples, PgStat_TableCounts::t_delta_live_tuples, TwoPhasePgStatRecord::t_id, TwoPhasePgStatRecord::t_shared, TwoPhasePgStatRecord::t_truncdropped, PgStat_TableCounts::t_truncdropped, PgStat_TableCounts::t_tuples_deleted, PgStat_TableCounts::t_tuples_inserted, PgStat_TableCounts::t_tuples_updated, TwoPhasePgStatRecord::tuples_deleted, TwoPhasePgStatRecord::tuples_inserted, and TwoPhasePgStatRecord::tuples_updated.
void pgstat_unlink_relation | ( | Relation | rel | ) |
Definition at line 153 of file pgstat_relation.c.
References Assert(), RelationData::pgstat_info, and PgStat_TableStatus::relation.
Referenced by pgstat_init_relation(), pgstat_relation_delete_pending_cb(), and RelationDestroyRelation().
void pgstat_update_heap_dead_tuples | ( | Relation | rel, |
int | delta | ||
) |
Definition at line 421 of file pgstat_relation.c.
References RelationData::pgstat_info, pgstat_should_count_relation, PgStat_TableStatus::t_counts, and PgStat_TableCounts::t_delta_dead_tuples.
Referenced by heap_page_prune_opt().
void PostPrepare_PgStat | ( | void | ) |
Definition at line 216 of file pgstat_xact.c.
References Assert(), PgStat_SubXactStatus::nest_level, pgstat_clear_snapshot(), pgStatXactStack, PostPrepare_PgStat_Relations(), and PgStat_SubXactStatus::prev.
Referenced by PrepareTransaction().
void StatsShmemInit | ( | void | ) |
Definition at line 140 of file pgstat_shmem.c.
References PgStat_ShmemControl::archiver, Assert(), PgStat_ShmemControl::bgwriter, PgStat_ShmemControl::checkpointer, dsa_create_in_place(), dsa_detach(), dsa_pin(), dsa_set_size_limit(), dsh_params, dshash_create(), dshash_detach(), dshash_get_hash_table_handle(), PgStat_ShmemControl::gc_request_count, PgStat_ShmemControl::hash_handle, IsUnderPostmaster, PgStatShared_Archiver::lock, PgStatShared_BgWriter::lock, PgStatShared_Checkpointer::lock, PgStatShared_SLRU::lock, PgStatShared_Wal::lock, LWLockInitialize(), LWTRANCHE_PGSTATS_DATA, LWTRANCHE_PGSTATS_DSA, MAXALIGN, pg_atomic_init_u64(), pgstat_dsa_init_size(), pgStatLocal, PgStat_ShmemControl::raw_dsa_area, PgStat_LocalState::shmem, ShmemInitStruct(), PgStat_ShmemControl::slru, StatsShmemSize(), and PgStat_ShmemControl::wal.
Referenced by CreateSharedMemoryAndSemaphores().
Size StatsShmemSize | ( | void | ) |
Definition at line 126 of file pgstat_shmem.c.
References add_size(), MAXALIGN, and pgstat_dsa_init_size().
Referenced by CalculateShmemSize(), and StatsShmemInit().
|
extern |
Definition at line 23 of file pgstat_bgwriter.c.
Referenced by BgBufferSync(), and pgstat_report_bgwriter().
|
extern |
Definition at line 23 of file pgstat_checkpointer.c.
Referenced by AbsorbSyncRequests(), BufferSync(), CheckpointerMain(), HandleCheckpointerInterrupts(), LogCheckpointEnd(), and pgstat_report_checkpointer().
|
extern |
Definition at line 24 of file pgstat_wal.c.
Referenced by AdvanceXLInsertBuffer(), issue_xlog_fsync(), pgstat_flush_wal(), pgstat_have_pending_wal(), and XLogWrite().
|
extern |
Definition at line 187 of file pgstat.c.
Referenced by pgstat_build_snapshot(), pgstat_build_snapshot_fixed(), pgstat_fetch_entry(), pgstat_prep_snapshot(), pgstat_snapshot_fixed(), and pgstat_write_statsfile().
|
extern |
Definition at line 186 of file pgstat.c.
Referenced by autovac_init(), AutoVacuumingActive(), pgstat_init_relation(), pgstat_report_analyze(), pgstat_report_checksum_failures_in_db(), pgstat_report_deadlock(), pgstat_report_recovery_conflict(), pgstat_report_tempfile(), and pgstat_report_vacuum().
|
extern |
Definition at line 30 of file pgstat_function.c.
|
extern |
Definition at line 30 of file pgstat_database.c.
Referenced by pgstat_update_dbstats().
|
extern |
Definition at line 28 of file pgstat_database.c.
Referenced by do_analyze_rel(), heap_vacuum_rel(), and pgstat_update_dbstats().
|
extern |
Definition at line 29 of file pgstat_database.c.
Referenced by do_analyze_rel(), heap_vacuum_rel(), and pgstat_update_dbstats().
|
extern |
Definition at line 32 of file pgstat_database.c.
Referenced by die(), errfinish(), pgstat_report_disconnect(), and PostgresMain().
|
extern |
Definition at line 31 of file pgstat_database.c.
Referenced by pgstat_update_dbstats().