PostgreSQL Source Code  git master
wait_event.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PG_WAIT_LWLOCK   0x01000000U
 
#define PG_WAIT_LOCK   0x03000000U
 
#define PG_WAIT_BUFFER_PIN   0x04000000U
 
#define PG_WAIT_ACTIVITY   0x05000000U
 
#define PG_WAIT_CLIENT   0x06000000U
 
#define PG_WAIT_EXTENSION   0x07000000U
 
#define PG_WAIT_IPC   0x08000000U
 
#define PG_WAIT_TIMEOUT   0x09000000U
 
#define PG_WAIT_IO   0x0A000000U
 

Enumerations

enum  WaitEventActivity {
  WAIT_EVENT_ARCHIVER_MAIN = PG_WAIT_ACTIVITY, WAIT_EVENT_AUTOVACUUM_MAIN, WAIT_EVENT_BGWRITER_HIBERNATE, WAIT_EVENT_BGWRITER_MAIN,
  WAIT_EVENT_CHECKPOINTER_MAIN, WAIT_EVENT_LOGICAL_APPLY_MAIN, WAIT_EVENT_LOGICAL_LAUNCHER_MAIN, WAIT_EVENT_PGSTAT_MAIN,
  WAIT_EVENT_RECOVERY_WAL_STREAM, WAIT_EVENT_SYSLOGGER_MAIN, WAIT_EVENT_WAL_RECEIVER_MAIN, WAIT_EVENT_WAL_SENDER_MAIN,
  WAIT_EVENT_WAL_WRITER_MAIN
}
 
enum  WaitEventClient {
  WAIT_EVENT_CLIENT_READ = PG_WAIT_CLIENT, WAIT_EVENT_CLIENT_WRITE, WAIT_EVENT_GSS_OPEN_SERVER, WAIT_EVENT_LIBPQWALRECEIVER_CONNECT,
  WAIT_EVENT_LIBPQWALRECEIVER_RECEIVE, WAIT_EVENT_SSL_OPEN_SERVER, WAIT_EVENT_WAL_SENDER_WAIT_WAL, WAIT_EVENT_WAL_SENDER_WRITE_DATA
}
 
enum  WaitEventIPC {
  WAIT_EVENT_APPEND_READY = PG_WAIT_IPC, WAIT_EVENT_BACKEND_TERMINATION, WAIT_EVENT_BACKUP_WAIT_WAL_ARCHIVE, WAIT_EVENT_BGWORKER_SHUTDOWN,
  WAIT_EVENT_BGWORKER_STARTUP, WAIT_EVENT_BTREE_PAGE, WAIT_EVENT_BUFFER_IO, WAIT_EVENT_CHECKPOINT_DONE,
  WAIT_EVENT_CHECKPOINT_START, WAIT_EVENT_EXECUTE_GATHER, WAIT_EVENT_HASH_BATCH_ALLOCATE, WAIT_EVENT_HASH_BATCH_ELECT,
  WAIT_EVENT_HASH_BATCH_LOAD, WAIT_EVENT_HASH_BUILD_ALLOCATE, WAIT_EVENT_HASH_BUILD_ELECT, WAIT_EVENT_HASH_BUILD_HASH_INNER,
  WAIT_EVENT_HASH_BUILD_HASH_OUTER, WAIT_EVENT_HASH_GROW_BATCHES_ALLOCATE, WAIT_EVENT_HASH_GROW_BATCHES_DECIDE, WAIT_EVENT_HASH_GROW_BATCHES_ELECT,
  WAIT_EVENT_HASH_GROW_BATCHES_FINISH, WAIT_EVENT_HASH_GROW_BATCHES_REPARTITION, WAIT_EVENT_HASH_GROW_BUCKETS_ALLOCATE, WAIT_EVENT_HASH_GROW_BUCKETS_ELECT,
  WAIT_EVENT_HASH_GROW_BUCKETS_REINSERT, WAIT_EVENT_LOGICAL_SYNC_DATA, WAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE, WAIT_EVENT_MQ_INTERNAL,
  WAIT_EVENT_MQ_PUT_MESSAGE, WAIT_EVENT_MQ_RECEIVE, WAIT_EVENT_MQ_SEND, WAIT_EVENT_PARALLEL_BITMAP_SCAN,
  WAIT_EVENT_PARALLEL_CREATE_INDEX_SCAN, WAIT_EVENT_PARALLEL_FINISH, WAIT_EVENT_PROCARRAY_GROUP_UPDATE, WAIT_EVENT_PROC_SIGNAL_BARRIER,
  WAIT_EVENT_PROMOTE, WAIT_EVENT_RECOVERY_CONFLICT_SNAPSHOT, WAIT_EVENT_RECOVERY_CONFLICT_TABLESPACE, WAIT_EVENT_RECOVERY_PAUSE,
  WAIT_EVENT_REPLICATION_ORIGIN_DROP, WAIT_EVENT_REPLICATION_SLOT_DROP, WAIT_EVENT_SAFE_SNAPSHOT, WAIT_EVENT_SYNC_REP,
  WAIT_EVENT_WAL_RECEIVER_EXIT, WAIT_EVENT_WAL_RECEIVER_WAIT_START, WAIT_EVENT_XACT_GROUP_UPDATE
}
 
enum  WaitEventTimeout {
  WAIT_EVENT_BASE_BACKUP_THROTTLE = PG_WAIT_TIMEOUT, WAIT_EVENT_PG_SLEEP, WAIT_EVENT_RECOVERY_APPLY_DELAY, WAIT_EVENT_RECOVERY_RETRIEVE_RETRY_INTERVAL,
  WAIT_EVENT_VACUUM_DELAY
}
 
enum  WaitEventIO {
  WAIT_EVENT_BASEBACKUP_READ = PG_WAIT_IO, WAIT_EVENT_BUFFILE_READ, WAIT_EVENT_BUFFILE_WRITE, WAIT_EVENT_BUFFILE_TRUNCATE,
  WAIT_EVENT_CONTROL_FILE_READ, WAIT_EVENT_CONTROL_FILE_SYNC, WAIT_EVENT_CONTROL_FILE_SYNC_UPDATE, WAIT_EVENT_CONTROL_FILE_WRITE,
  WAIT_EVENT_CONTROL_FILE_WRITE_UPDATE, WAIT_EVENT_COPY_FILE_READ, WAIT_EVENT_COPY_FILE_WRITE, WAIT_EVENT_DATA_FILE_EXTEND,
  WAIT_EVENT_DATA_FILE_FLUSH, WAIT_EVENT_DATA_FILE_IMMEDIATE_SYNC, WAIT_EVENT_DATA_FILE_PREFETCH, WAIT_EVENT_DATA_FILE_READ,
  WAIT_EVENT_DATA_FILE_SYNC, WAIT_EVENT_DATA_FILE_TRUNCATE, WAIT_EVENT_DATA_FILE_WRITE, WAIT_EVENT_DSM_FILL_ZERO_WRITE,
  WAIT_EVENT_LOCK_FILE_ADDTODATADIR_READ, WAIT_EVENT_LOCK_FILE_ADDTODATADIR_SYNC, WAIT_EVENT_LOCK_FILE_ADDTODATADIR_WRITE, WAIT_EVENT_LOCK_FILE_CREATE_READ,
  WAIT_EVENT_LOCK_FILE_CREATE_SYNC, WAIT_EVENT_LOCK_FILE_CREATE_WRITE, WAIT_EVENT_LOCK_FILE_RECHECKDATADIR_READ, WAIT_EVENT_LOGICAL_REWRITE_CHECKPOINT_SYNC,
  WAIT_EVENT_LOGICAL_REWRITE_MAPPING_SYNC, WAIT_EVENT_LOGICAL_REWRITE_MAPPING_WRITE, WAIT_EVENT_LOGICAL_REWRITE_SYNC, WAIT_EVENT_LOGICAL_REWRITE_TRUNCATE,
  WAIT_EVENT_LOGICAL_REWRITE_WRITE, WAIT_EVENT_RELATION_MAP_READ, WAIT_EVENT_RELATION_MAP_SYNC, WAIT_EVENT_RELATION_MAP_WRITE,
  WAIT_EVENT_REORDER_BUFFER_READ, WAIT_EVENT_REORDER_BUFFER_WRITE, WAIT_EVENT_REORDER_LOGICAL_MAPPING_READ, WAIT_EVENT_REPLICATION_SLOT_READ,
  WAIT_EVENT_REPLICATION_SLOT_RESTORE_SYNC, WAIT_EVENT_REPLICATION_SLOT_SYNC, WAIT_EVENT_REPLICATION_SLOT_WRITE, WAIT_EVENT_SLRU_FLUSH_SYNC,
  WAIT_EVENT_SLRU_READ, WAIT_EVENT_SLRU_SYNC, WAIT_EVENT_SLRU_WRITE, WAIT_EVENT_SNAPBUILD_READ,
  WAIT_EVENT_SNAPBUILD_SYNC, WAIT_EVENT_SNAPBUILD_WRITE, WAIT_EVENT_TIMELINE_HISTORY_FILE_SYNC, WAIT_EVENT_TIMELINE_HISTORY_FILE_WRITE,
  WAIT_EVENT_TIMELINE_HISTORY_READ, WAIT_EVENT_TIMELINE_HISTORY_SYNC, WAIT_EVENT_TIMELINE_HISTORY_WRITE, WAIT_EVENT_TWOPHASE_FILE_READ,
  WAIT_EVENT_TWOPHASE_FILE_SYNC, WAIT_EVENT_TWOPHASE_FILE_WRITE, WAIT_EVENT_WALSENDER_TIMELINE_HISTORY_READ, WAIT_EVENT_WAL_BOOTSTRAP_SYNC,
  WAIT_EVENT_WAL_BOOTSTRAP_WRITE, WAIT_EVENT_WAL_COPY_READ, WAIT_EVENT_WAL_COPY_SYNC, WAIT_EVENT_WAL_COPY_WRITE,
  WAIT_EVENT_WAL_INIT_SYNC, WAIT_EVENT_WAL_INIT_WRITE, WAIT_EVENT_WAL_READ, WAIT_EVENT_WAL_SYNC,
  WAIT_EVENT_WAL_SYNC_METHOD_ASSIGN, WAIT_EVENT_WAL_WRITE, WAIT_EVENT_LOGICAL_CHANGES_READ, WAIT_EVENT_LOGICAL_CHANGES_WRITE,
  WAIT_EVENT_LOGICAL_SUBXACT_READ, WAIT_EVENT_LOGICAL_SUBXACT_WRITE
}
 

Functions

const char * pgstat_get_wait_event (uint32 wait_event_info)
 
const char * pgstat_get_wait_event_type (uint32 wait_event_info)
 
static void pgstat_report_wait_start (uint32 wait_event_info)
 
static void pgstat_report_wait_end (void)
 
void pgstat_set_wait_event_storage (uint32 *wait_event_info)
 
void pgstat_reset_wait_event_storage (void)
 

Variables

PGDLLIMPORT uint32my_wait_event_info
 

Macro Definition Documentation

◆ PG_WAIT_ACTIVITY

#define PG_WAIT_ACTIVITY   0x05000000U

Definition at line 21 of file wait_event.h.

Referenced by pgstat_get_wait_event(), and pgstat_get_wait_event_type().

◆ PG_WAIT_BUFFER_PIN

#define PG_WAIT_BUFFER_PIN   0x04000000U

◆ PG_WAIT_CLIENT

#define PG_WAIT_CLIENT   0x06000000U

Definition at line 22 of file wait_event.h.

Referenced by pgstat_get_wait_event(), and pgstat_get_wait_event_type().

◆ PG_WAIT_EXTENSION

◆ PG_WAIT_IO

#define PG_WAIT_IO   0x0A000000U

Definition at line 26 of file wait_event.h.

Referenced by pgstat_get_wait_event(), and pgstat_get_wait_event_type().

◆ PG_WAIT_IPC

#define PG_WAIT_IPC   0x08000000U

Definition at line 24 of file wait_event.h.

Referenced by pgstat_get_wait_event(), and pgstat_get_wait_event_type().

◆ PG_WAIT_LOCK

#define PG_WAIT_LOCK   0x03000000U

◆ PG_WAIT_LWLOCK

#define PG_WAIT_LWLOCK   0x01000000U

◆ PG_WAIT_TIMEOUT

#define PG_WAIT_TIMEOUT   0x09000000U

Definition at line 25 of file wait_event.h.

Referenced by pgstat_get_wait_event(), and pgstat_get_wait_event_type().

Enumeration Type Documentation

◆ WaitEventActivity

Enumerator
WAIT_EVENT_ARCHIVER_MAIN 
WAIT_EVENT_AUTOVACUUM_MAIN 
WAIT_EVENT_BGWRITER_HIBERNATE 
WAIT_EVENT_BGWRITER_MAIN 
WAIT_EVENT_CHECKPOINTER_MAIN 
WAIT_EVENT_LOGICAL_APPLY_MAIN 
WAIT_EVENT_LOGICAL_LAUNCHER_MAIN 
WAIT_EVENT_PGSTAT_MAIN 
WAIT_EVENT_RECOVERY_WAL_STREAM 
WAIT_EVENT_SYSLOGGER_MAIN 
WAIT_EVENT_WAL_RECEIVER_MAIN 
WAIT_EVENT_WAL_SENDER_MAIN 
WAIT_EVENT_WAL_WRITER_MAIN 

Definition at line 36 of file wait_event.h.

◆ WaitEventClient

Enumerator
WAIT_EVENT_CLIENT_READ 
WAIT_EVENT_CLIENT_WRITE 
WAIT_EVENT_GSS_OPEN_SERVER 
WAIT_EVENT_LIBPQWALRECEIVER_CONNECT 
WAIT_EVENT_LIBPQWALRECEIVER_RECEIVE 
WAIT_EVENT_SSL_OPEN_SERVER 
WAIT_EVENT_WAL_SENDER_WAIT_WAL 
WAIT_EVENT_WAL_SENDER_WRITE_DATA 

Definition at line 61 of file wait_event.h.

◆ WaitEventIO

Enumerator
WAIT_EVENT_BASEBACKUP_READ 
WAIT_EVENT_BUFFILE_READ 
WAIT_EVENT_BUFFILE_WRITE 
WAIT_EVENT_BUFFILE_TRUNCATE 
WAIT_EVENT_CONTROL_FILE_READ 
WAIT_EVENT_CONTROL_FILE_SYNC 
WAIT_EVENT_CONTROL_FILE_SYNC_UPDATE 
WAIT_EVENT_CONTROL_FILE_WRITE 
WAIT_EVENT_CONTROL_FILE_WRITE_UPDATE 
WAIT_EVENT_COPY_FILE_READ 
WAIT_EVENT_COPY_FILE_WRITE 
WAIT_EVENT_DATA_FILE_EXTEND 
WAIT_EVENT_DATA_FILE_FLUSH 
WAIT_EVENT_DATA_FILE_IMMEDIATE_SYNC 
WAIT_EVENT_DATA_FILE_PREFETCH 
WAIT_EVENT_DATA_FILE_READ 
WAIT_EVENT_DATA_FILE_SYNC 
WAIT_EVENT_DATA_FILE_TRUNCATE 
WAIT_EVENT_DATA_FILE_WRITE 
WAIT_EVENT_DSM_FILL_ZERO_WRITE 
WAIT_EVENT_LOCK_FILE_ADDTODATADIR_READ 
WAIT_EVENT_LOCK_FILE_ADDTODATADIR_SYNC 
WAIT_EVENT_LOCK_FILE_ADDTODATADIR_WRITE 
WAIT_EVENT_LOCK_FILE_CREATE_READ 
WAIT_EVENT_LOCK_FILE_CREATE_SYNC 
WAIT_EVENT_LOCK_FILE_CREATE_WRITE 
WAIT_EVENT_LOCK_FILE_RECHECKDATADIR_READ 
WAIT_EVENT_LOGICAL_REWRITE_CHECKPOINT_SYNC 
WAIT_EVENT_LOGICAL_REWRITE_MAPPING_SYNC 
WAIT_EVENT_LOGICAL_REWRITE_MAPPING_WRITE 
WAIT_EVENT_LOGICAL_REWRITE_SYNC 
WAIT_EVENT_LOGICAL_REWRITE_TRUNCATE 
WAIT_EVENT_LOGICAL_REWRITE_WRITE 
WAIT_EVENT_RELATION_MAP_READ 
WAIT_EVENT_RELATION_MAP_SYNC 
WAIT_EVENT_RELATION_MAP_WRITE 
WAIT_EVENT_REORDER_BUFFER_READ 
WAIT_EVENT_REORDER_BUFFER_WRITE 
WAIT_EVENT_REORDER_LOGICAL_MAPPING_READ 
WAIT_EVENT_REPLICATION_SLOT_READ 
WAIT_EVENT_REPLICATION_SLOT_RESTORE_SYNC 
WAIT_EVENT_REPLICATION_SLOT_SYNC 
WAIT_EVENT_REPLICATION_SLOT_WRITE 
WAIT_EVENT_SLRU_FLUSH_SYNC 
WAIT_EVENT_SLRU_READ 
WAIT_EVENT_SLRU_SYNC 
WAIT_EVENT_SLRU_WRITE 
WAIT_EVENT_SNAPBUILD_READ 
WAIT_EVENT_SNAPBUILD_SYNC 
WAIT_EVENT_SNAPBUILD_WRITE 
WAIT_EVENT_TIMELINE_HISTORY_FILE_SYNC 
WAIT_EVENT_TIMELINE_HISTORY_FILE_WRITE 
WAIT_EVENT_TIMELINE_HISTORY_READ 
WAIT_EVENT_TIMELINE_HISTORY_SYNC 
WAIT_EVENT_TIMELINE_HISTORY_WRITE 
WAIT_EVENT_TWOPHASE_FILE_READ 
WAIT_EVENT_TWOPHASE_FILE_SYNC 
WAIT_EVENT_TWOPHASE_FILE_WRITE 
WAIT_EVENT_WALSENDER_TIMELINE_HISTORY_READ 
WAIT_EVENT_WAL_BOOTSTRAP_SYNC 
WAIT_EVENT_WAL_BOOTSTRAP_WRITE 
WAIT_EVENT_WAL_COPY_READ 
WAIT_EVENT_WAL_COPY_SYNC 
WAIT_EVENT_WAL_COPY_WRITE 
WAIT_EVENT_WAL_INIT_SYNC 
WAIT_EVENT_WAL_INIT_WRITE 
WAIT_EVENT_WAL_READ 
WAIT_EVENT_WAL_SYNC 
WAIT_EVENT_WAL_SYNC_METHOD_ASSIGN 
WAIT_EVENT_WAL_WRITE 
WAIT_EVENT_LOGICAL_CHANGES_READ 
WAIT_EVENT_LOGICAL_CHANGES_WRITE 
WAIT_EVENT_LOGICAL_SUBXACT_READ 
WAIT_EVENT_LOGICAL_SUBXACT_WRITE 

Definition at line 152 of file wait_event.h.

153 {
228 } WaitEventIO;
#define PG_WAIT_IO
Definition: wait_event.h:26
WaitEventIO
Definition: wait_event.h:152

◆ WaitEventIPC

Enumerator
WAIT_EVENT_APPEND_READY 
WAIT_EVENT_BACKEND_TERMINATION 
WAIT_EVENT_BACKUP_WAIT_WAL_ARCHIVE 
WAIT_EVENT_BGWORKER_SHUTDOWN 
WAIT_EVENT_BGWORKER_STARTUP 
WAIT_EVENT_BTREE_PAGE 
WAIT_EVENT_BUFFER_IO 
WAIT_EVENT_CHECKPOINT_DONE 
WAIT_EVENT_CHECKPOINT_START 
WAIT_EVENT_EXECUTE_GATHER 
WAIT_EVENT_HASH_BATCH_ALLOCATE 
WAIT_EVENT_HASH_BATCH_ELECT 
WAIT_EVENT_HASH_BATCH_LOAD 
WAIT_EVENT_HASH_BUILD_ALLOCATE 
WAIT_EVENT_HASH_BUILD_ELECT 
WAIT_EVENT_HASH_BUILD_HASH_INNER 
WAIT_EVENT_HASH_BUILD_HASH_OUTER 
WAIT_EVENT_HASH_GROW_BATCHES_ALLOCATE 
WAIT_EVENT_HASH_GROW_BATCHES_DECIDE 
WAIT_EVENT_HASH_GROW_BATCHES_ELECT 
WAIT_EVENT_HASH_GROW_BATCHES_FINISH 
WAIT_EVENT_HASH_GROW_BATCHES_REPARTITION 
WAIT_EVENT_HASH_GROW_BUCKETS_ALLOCATE 
WAIT_EVENT_HASH_GROW_BUCKETS_ELECT 
WAIT_EVENT_HASH_GROW_BUCKETS_REINSERT 
WAIT_EVENT_LOGICAL_SYNC_DATA 
WAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE 
WAIT_EVENT_MQ_INTERNAL 
WAIT_EVENT_MQ_PUT_MESSAGE 
WAIT_EVENT_MQ_RECEIVE 
WAIT_EVENT_MQ_SEND 
WAIT_EVENT_PARALLEL_BITMAP_SCAN 
WAIT_EVENT_PARALLEL_CREATE_INDEX_SCAN 
WAIT_EVENT_PARALLEL_FINISH 
WAIT_EVENT_PROCARRAY_GROUP_UPDATE 
WAIT_EVENT_PROC_SIGNAL_BARRIER 
WAIT_EVENT_PROMOTE 
WAIT_EVENT_RECOVERY_CONFLICT_SNAPSHOT 
WAIT_EVENT_RECOVERY_CONFLICT_TABLESPACE 
WAIT_EVENT_RECOVERY_PAUSE 
WAIT_EVENT_REPLICATION_ORIGIN_DROP 
WAIT_EVENT_REPLICATION_SLOT_DROP 
WAIT_EVENT_SAFE_SNAPSHOT 
WAIT_EVENT_SYNC_REP 
WAIT_EVENT_WAL_RECEIVER_EXIT 
WAIT_EVENT_WAL_RECEIVER_WAIT_START 
WAIT_EVENT_XACT_GROUP_UPDATE 

Definition at line 80 of file wait_event.h.

81 {
129 } WaitEventIPC;
WaitEventIPC
Definition: wait_event.h:80
#define PG_WAIT_IPC
Definition: wait_event.h:24

◆ WaitEventTimeout

Enumerator
WAIT_EVENT_BASE_BACKUP_THROTTLE 
WAIT_EVENT_PG_SLEEP 
WAIT_EVENT_RECOVERY_APPLY_DELAY 
WAIT_EVENT_RECOVERY_RETRIEVE_RETRY_INTERVAL 
WAIT_EVENT_VACUUM_DELAY 

Definition at line 137 of file wait_event.h.

Function Documentation

◆ pgstat_get_wait_event()

const char* pgstat_get_wait_event ( uint32  wait_event_info)

Definition at line 129 of file wait_event.c.

References GetLockNameFromTagType(), GetLWLockIdentifier(), PG_WAIT_ACTIVITY, PG_WAIT_BUFFER_PIN, PG_WAIT_CLIENT, PG_WAIT_EXTENSION, PG_WAIT_IO, PG_WAIT_IPC, PG_WAIT_LOCK, PG_WAIT_LWLOCK, PG_WAIT_TIMEOUT, pgstat_get_wait_activity(), pgstat_get_wait_client(), pgstat_get_wait_io(), pgstat_get_wait_ipc(), and pgstat_get_wait_timeout().

Referenced by pg_stat_get_activity(), and pg_stat_get_backend_wait_event().

130 {
131  uint32 classId;
132  uint16 eventId;
133  const char *event_name;
134 
135  /* report process as not waiting. */
136  if (wait_event_info == 0)
137  return NULL;
138 
139  classId = wait_event_info & 0xFF000000;
140  eventId = wait_event_info & 0x0000FFFF;
141 
142  switch (classId)
143  {
144  case PG_WAIT_LWLOCK:
145  event_name = GetLWLockIdentifier(classId, eventId);
146  break;
147  case PG_WAIT_LOCK:
148  event_name = GetLockNameFromTagType(eventId);
149  break;
150  case PG_WAIT_BUFFER_PIN:
151  event_name = "BufferPin";
152  break;
153  case PG_WAIT_ACTIVITY:
154  {
155  WaitEventActivity w = (WaitEventActivity) wait_event_info;
156 
157  event_name = pgstat_get_wait_activity(w);
158  break;
159  }
160  case PG_WAIT_CLIENT:
161  {
162  WaitEventClient w = (WaitEventClient) wait_event_info;
163 
164  event_name = pgstat_get_wait_client(w);
165  break;
166  }
167  case PG_WAIT_EXTENSION:
168  event_name = "Extension";
169  break;
170  case PG_WAIT_IPC:
171  {
172  WaitEventIPC w = (WaitEventIPC) wait_event_info;
173 
174  event_name = pgstat_get_wait_ipc(w);
175  break;
176  }
177  case PG_WAIT_TIMEOUT:
178  {
179  WaitEventTimeout w = (WaitEventTimeout) wait_event_info;
180 
181  event_name = pgstat_get_wait_timeout(w);
182  break;
183  }
184  case PG_WAIT_IO:
185  {
186  WaitEventIO w = (WaitEventIO) wait_event_info;
187 
188  event_name = pgstat_get_wait_io(w);
189  break;
190  }
191  default:
192  event_name = "unknown wait event";
193  break;
194  }
195 
196  return event_name;
197 }
#define PG_WAIT_IO
Definition: wait_event.h:26
WaitEventIPC
Definition: wait_event.h:80
#define PG_WAIT_EXTENSION
Definition: wait_event.h:23
#define PG_WAIT_IPC
Definition: wait_event.h:24
#define PG_WAIT_LOCK
Definition: wait_event.h:19
#define PG_WAIT_TIMEOUT
Definition: wait_event.h:25
WaitEventTimeout
Definition: wait_event.h:137
#define PG_WAIT_CLIENT
Definition: wait_event.h:22
unsigned short uint16
Definition: c.h:440
static const char * pgstat_get_wait_activity(WaitEventActivity w)
Definition: wait_event.c:206
static const char * pgstat_get_wait_ipc(WaitEventIPC w)
Definition: wait_event.c:307
static const char * pgstat_get_wait_timeout(WaitEventTimeout w)
Definition: wait_event.c:467
#define PG_WAIT_BUFFER_PIN
Definition: wait_event.h:20
#define PG_WAIT_LWLOCK
Definition: wait_event.h:18
unsigned int uint32
Definition: c.h:441
WaitEventClient
Definition: wait_event.h:61
WaitEventIO
Definition: wait_event.h:152
const char * GetLockNameFromTagType(uint16 locktag_type)
Definition: lmgr.c:1190
WaitEventActivity
Definition: wait_event.h:36
const char * GetLWLockIdentifier(uint32 classId, uint16 eventId)
Definition: lwlock.c:804
#define PG_WAIT_ACTIVITY
Definition: wait_event.h:21
static const char * pgstat_get_wait_client(WaitEventClient w)
Definition: wait_event.c:264
static const char * pgstat_get_wait_io(WaitEventIO w)
Definition: wait_event.c:501

◆ pgstat_get_wait_event_type()

const char* pgstat_get_wait_event_type ( uint32  wait_event_info)

Definition at line 74 of file wait_event.c.

References PG_WAIT_ACTIVITY, PG_WAIT_BUFFER_PIN, PG_WAIT_CLIENT, PG_WAIT_EXTENSION, PG_WAIT_IO, PG_WAIT_IPC, PG_WAIT_LOCK, PG_WAIT_LWLOCK, and PG_WAIT_TIMEOUT.

Referenced by pg_stat_get_activity(), and pg_stat_get_backend_wait_event_type().

75 {
76  uint32 classId;
77  const char *event_type;
78 
79  /* report process as not waiting. */
80  if (wait_event_info == 0)
81  return NULL;
82 
83  classId = wait_event_info & 0xFF000000;
84 
85  switch (classId)
86  {
87  case PG_WAIT_LWLOCK:
88  event_type = "LWLock";
89  break;
90  case PG_WAIT_LOCK:
91  event_type = "Lock";
92  break;
93  case PG_WAIT_BUFFER_PIN:
94  event_type = "BufferPin";
95  break;
96  case PG_WAIT_ACTIVITY:
97  event_type = "Activity";
98  break;
99  case PG_WAIT_CLIENT:
100  event_type = "Client";
101  break;
102  case PG_WAIT_EXTENSION:
103  event_type = "Extension";
104  break;
105  case PG_WAIT_IPC:
106  event_type = "IPC";
107  break;
108  case PG_WAIT_TIMEOUT:
109  event_type = "Timeout";
110  break;
111  case PG_WAIT_IO:
112  event_type = "IO";
113  break;
114  default:
115  event_type = "???";
116  break;
117  }
118 
119  return event_type;
120 }
#define PG_WAIT_IO
Definition: wait_event.h:26
#define PG_WAIT_EXTENSION
Definition: wait_event.h:23
#define PG_WAIT_IPC
Definition: wait_event.h:24
#define PG_WAIT_LOCK
Definition: wait_event.h:19
#define PG_WAIT_TIMEOUT
Definition: wait_event.h:25
#define PG_WAIT_CLIENT
Definition: wait_event.h:22
#define PG_WAIT_BUFFER_PIN
Definition: wait_event.h:20
#define PG_WAIT_LWLOCK
Definition: wait_event.h:18
unsigned int uint32
Definition: c.h:441
#define PG_WAIT_ACTIVITY
Definition: wait_event.h:21

◆ pgstat_report_wait_end()

static void pgstat_report_wait_end ( void  )
inlinestatic

Definition at line 277 of file wait_event.h.

References my_wait_event_info.

Referenced by AbortSubTransaction(), AbortTransaction(), AddToDataDirLockFile(), ApplyLogicalMappingFile(), assign_xlog_sync_method(), AutoVacLauncherMain(), BackgroundWriterMain(), basebackup_read_file(), BootStrapXLOG(), CheckpointerMain(), CheckPointLogicalRewriteHeap(), copy_file(), CreateLockFile(), do_pg_stop_backup(), dsm_impl_mmap(), dsm_impl_op(), FilePrefetch(), FileRead(), FileSync(), FileTruncate(), FileWrite(), FileWriteback(), heap_xlog_logical_rewrite(), issue_xlog_fsync(), load_relmap_file(), LWLockReportWaitEnd(), ProcArrayGroupClearXid(), ReadControlFile(), readTimeLineHistory(), ReadTwoPhaseFile(), RecheckDataDirLockFile(), RecreateTwoPhaseFile(), ReorderBufferSerializeChange(), RestoreSlotFromDisk(), SaveSlotToPath(), SendTimeLineHistory(), ShutdownAuxiliaryProcess(), SlruPhysicalReadPage(), SlruPhysicalWritePage(), SnapBuildRestore(), SnapBuildSerialize(), TransactionGroupUpdateXidStatus(), update_controlfile(), WaitEventSetWait(), WaitExceedsMaxStandbyDelay(), WALRead(), WalSndErrorCleanup(), WalWriterMain(), write_relmap_file(), WriteControlFile(), writeTimeLineHistory(), writeTimeLineHistoryFile(), XLogFileCopy(), XLogFileInit(), XLogPageRead(), and XLogWrite().

278 {
279  /* see pgstat_report_wait_start() */
280  *(volatile uint32 *) my_wait_event_info = 0;
281 }
unsigned int uint32
Definition: c.h:441
PGDLLIMPORT uint32 * my_wait_event_info
Definition: wait_event.c:38

◆ pgstat_report_wait_start()

static void pgstat_report_wait_start ( uint32  wait_event_info)
inlinestatic

◆ pgstat_reset_wait_event_storage()

void pgstat_reset_wait_event_storage ( void  )

Definition at line 62 of file wait_event.c.

References local_my_wait_event_info, and my_wait_event_info.

Referenced by AuxiliaryProcKill(), and ProcKill().

63 {
65 }
static uint32 local_my_wait_event_info
Definition: wait_event.c:37
uint32 * my_wait_event_info
Definition: wait_event.c:38

◆ pgstat_set_wait_event_storage()

void pgstat_set_wait_event_storage ( uint32 wait_event_info)

Definition at line 50 of file wait_event.c.

References my_wait_event_info.

Referenced by InitAuxiliaryProcess(), and InitProcess().

51 {
52  my_wait_event_info = wait_event_info;
53 }
uint32 * my_wait_event_info
Definition: wait_event.c:38

Variable Documentation

◆ my_wait_event_info