37 #define NumBackendStatSlots (MaxBackends + NUM_AUXILIARY_PROCS)
206 ptr = BackendSslStatusBuffer;
228 ptr = BackendGssStatusBuffer;
304 memset(&lsslstatus, 0,
sizeof(lsslstatus));
307 memset(&lgssstatus, 0,
sizeof(lgssstatus));
486 "Backend Status Snapshot",
510 TRACE_POSTGRESQL_STATEMENT_STATUS(cmd_str);
715 *localclienthostname,
741 localappname = (
char *)
744 localclienthostname = (
char *)
747 localactivity = (
char *)
765 localentry = localtable;
777 int before_changecount;
778 int after_changecount;
796 strcpy(localappname, (
char *) beentry->
st_appname);
908 int before_changecount;
909 int after_changecount;
929 return "<insufficient privilege>";
931 return "<command string not enabled>";
943 return "<backend information not available>";
983 const char *activity_last;
995 activity > activity_last)
999 if (activity[0] ==
'\0')
1107 key.proc_number = procNumber;
1181 rawlen = strlen(activity);
Datum idx(PG_FUNCTION_ARGS)
void ascii_safe_strlcpy(char *dest, const char *src, size_t destsiz)
void TimestampDifference(TimestampTz start_time, TimestampTz stop_time, long *secs, int *microsecs)
TimestampTz GetCurrentTimestamp(void)
@ PROGRESS_COMMAND_INVALID
#define NumBackendStatSlots
int pgstat_fetch_stat_numbackends(void)
PgBackendStatus * MyBEEntry
uint64 pgstat_get_my_query_id(void)
void pgstat_clear_backend_activity_snapshot(void)
static LocalPgBackendStatus * localBackendStatusTable
PgBackendStatus * pgstat_get_beentry_by_proc_number(ProcNumber procNumber)
static int localNumBackends
static void pgstat_beshutdown_hook(int code, Datum arg)
const char * pgstat_get_backend_current_activity(int pid, bool checkUser)
static char * BackendClientHostnameBuffer
static int cmp_lbestatus(const void *a, const void *b)
bool pgstat_track_activities
static MemoryContext backendStatusSnapContext
LocalPgBackendStatus * pgstat_get_local_beentry_by_index(int idx)
static char * BackendActivityBuffer
void BackendStatusShmemInit(void)
LocalPgBackendStatus * pgstat_get_local_beentry_by_proc_number(ProcNumber procNumber)
static void pgstat_setup_backend_status_context(void)
void pgstat_report_query_id(uint64 query_id, bool force)
static char * BackendAppnameBuffer
void pgstat_report_activity(BackendState state, const char *cmd_str)
void pgstat_report_xact_timestamp(TimestampTz tstamp)
const char * pgstat_get_crashed_backend_activity(int pid, char *buffer, int buflen)
static PgBackendStatus * BackendStatusArray
Size BackendStatusShmemSize(void)
void pgstat_report_appname(const char *appname)
static Size BackendActivityBufferSize
static void pgstat_read_current_status(void)
int pgstat_track_activity_query_size
void pgstat_bestart(void)
char * pgstat_clip_activity(const char *raw_activity)
@ STATE_IDLEINTRANSACTION_ABORTED
@ STATE_IDLEINTRANSACTION
#define pgstat_read_activity_complete(before_changecount, after_changecount)
#define PGSTAT_END_WRITE_ACTIVITY(beentry)
#define PGSTAT_BEGIN_WRITE_ACTIVITY(beentry)
#define pgstat_end_read_activity(beentry, after_changecount)
#define pgstat_begin_read_activity(beentry, before_changecount)
bool be_gssapi_get_auth(Port *port)
bool be_gssapi_get_enc(Port *port)
const char * be_gssapi_get_princ(Port *port)
bool be_gssapi_get_delegation(Port *port)
const char * be_tls_get_version(Port *port)
int be_tls_get_cipher_bits(Port *port)
void be_tls_get_peer_serial(Port *port, char *ptr, size_t len)
void be_tls_get_peer_issuer_name(Port *port, char *ptr, size_t len)
const char * be_tls_get_cipher(Port *port)
void be_tls_get_peer_subject_name(Port *port, char *ptr, size_t len)
#define unvolatize(underlying_type, expr)
#define Assert(condition)
#define MemSet(start, val, len)
TimestampTz MyStartTimestamp
void on_shmem_exit(pg_on_exit_callback function, Datum arg)
int pg_mbcliplen(const char *mbstr, int len, int limit)
static int cliplen(const char *str, int len, int limit)
char * pnstrdup(const char *in, Size len)
MemoryContext TopMemoryContext
void * MemoryContextAlloc(MemoryContext context, Size size)
void * MemoryContextAllocHuge(MemoryContext context, Size size)
void MemoryContextDelete(MemoryContext context)
#define AllocSetContextCreate
#define ALLOCSET_SMALL_SIZES
#define CHECK_FOR_INTERRUPTS()
Oid GetSessionUserId(void)
BackendType MyBackendType
#define pgstat_count_conn_txn_idle_time(n)
#define pgstat_count_conn_active_time(n)
size_t strlcpy(char *dst, const char *src, size_t siz)
void ProcNumberGetTransactionIds(ProcNumber procNumber, TransactionId *xid, TransactionId *xmin, int *nsubxid, bool *overflowed)
#define INVALID_PROC_NUMBER
Size add_size(Size s1, Size s2)
void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)
Size mul_size(Size s1, Size s2)
static pg_noinline void Size size
TransactionId backend_xid
PgBackendStatus backendStatus
int backend_subxact_count
TransactionId backend_xmin
bool backend_subxact_overflowed
char gss_princ[NAMEDATALEN]
char ssl_version[NAMEDATALEN]
char ssl_cipher[NAMEDATALEN]
char ssl_client_dn[NAMEDATALEN]
char ssl_client_serial[NAMEDATALEN]
char ssl_issuer_dn[NAMEDATALEN]
BackendType st_backendType
TimestampTz st_state_start_timestamp
TimestampTz st_proc_start_timestamp
PgBackendGSSStatus * st_gssstatus
TimestampTz st_activity_start_timestamp
ProgressCommandType st_progress_command
PgBackendSSLStatus * st_sslstatus
TimestampTz st_xact_start_timestamp
Oid st_progress_command_target
TimestampTz GetCurrentStatementStartTimestamp(void)