42 #define WAIT_EVENT_CLASS_MASK 0xFF000000
43 #define WAIT_EVENT_ID_MASK 0x0000FFFF
66 #define WAIT_EVENT_CUSTOM_HASH_INIT_SIZE 16
67 #define WAIT_EVENT_CUSTOM_HASH_MAX_SIZE 128
94 #define WAIT_EVENT_CUSTOM_INITIAL_ID 1
139 ShmemInitHash(
"WaitEventCustom hash by wait event information",
186 "cannot use custom wait event string longer than %u characters",
203 if (oldClassId != classId)
206 errmsg(
"wait event \"%s\" already exists in type \"%s\"",
228 if (oldClassId != classId)
231 errmsg(
"wait event \"%s\" already exists in type \"%s\"",
244 errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
245 errmsg(
"too many custom wait events"));
253 wait_event_info = classId | eventId;
269 return wait_event_info;
294 "could not find custom name for wait event information %u",
308 char **waiteventnames;
320 waiteventnames =
palloc(els *
sizeof(
char *));
336 *nwaitevents =
index;
337 return waiteventnames;
376 const char *event_type;
379 if (wait_event_info == 0)
387 event_type =
"LWLock";
393 event_type =
"BufferPin";
396 event_type =
"Activity";
399 event_type =
"Client";
402 event_type =
"Extension";
408 event_type =
"Timeout";
414 event_type =
"InjectionPoint";
435 const char *event_name;
438 if (wait_event_info == 0)
458 WaitEventBufferPin w = (WaitEventBufferPin) wait_event_info;
465 WaitEventActivity w = (WaitEventActivity) wait_event_info;
472 WaitEventClient w = (WaitEventClient) wait_event_info;
479 WaitEventIPC w = (WaitEventIPC) wait_event_info;
486 WaitEventTimeout w = (WaitEventTimeout) wait_event_info;
493 WaitEventIO w = (WaitEventIO) wait_event_info;
499 event_name =
"unknown wait event";
506 #include "pgstat_wait_event.c"
#define Assert(condition)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
long hash_get_num_entries(HTAB *hashp)
Size hash_estimate_size(long num_entries, Size entrysize)
void * hash_seq_search(HASH_SEQ_STATUS *status)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
const char * GetLockNameFromTagType(uint16 locktag_type)
const char * GetLWLockIdentifier(uint32 classId, uint16 eventId)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
void LWLockRelease(LWLock *lock)
char * pstrdup(const char *in)
size_t strlcpy(char *dst, const char *src, size_t siz)
Size add_size(Size s1, Size s2)
void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)
HTAB * ShmemInitHash(const char *name, long init_size, long max_size, HASHCTL *infoP, int hash_flags)
#define SpinLockInit(lock)
#define SpinLockRelease(lock)
#define SpinLockAcquire(lock)
#define ERRCODE_DUPLICATE_OBJECT
char wait_event_name[NAMEDATALEN]
char wait_event_name[NAMEDATALEN]
#define WAIT_EVENT_CUSTOM_HASH_MAX_SIZE
struct WaitEventCustomEntryByName WaitEventCustomEntryByName
static const char * pgstat_get_wait_ipc(WaitEventIPC w)
Size WaitEventCustomShmemSize(void)
static const char * pgstat_get_wait_io(WaitEventIO w)
#define WAIT_EVENT_CUSTOM_HASH_INIT_SIZE
static WaitEventCustomCounterData * WaitEventCustomCounter
const char * pgstat_get_wait_event(uint32 wait_event_info)
void pgstat_set_wait_event_storage(uint32 *wait_event_info)
static const char * pgstat_get_wait_bufferpin(WaitEventBufferPin w)
char ** GetWaitEventCustomNames(uint32 classId, int *nwaitevents)
static const char * GetWaitEventCustomIdentifier(uint32 wait_event_info)
static const char * pgstat_get_wait_timeout(WaitEventTimeout w)
static uint32 local_my_wait_event_info
uint32 WaitEventInjectionPointNew(const char *wait_event_name)
const char * pgstat_get_wait_event_type(uint32 wait_event_info)
static HTAB * WaitEventCustomHashByName
struct WaitEventCustomEntryByInfo WaitEventCustomEntryByInfo
void pgstat_reset_wait_event_storage(void)
struct WaitEventCustomCounterData WaitEventCustomCounterData
static const char * pgstat_get_wait_client(WaitEventClient w)
#define WAIT_EVENT_ID_MASK
static HTAB * WaitEventCustomHashByInfo
#define WAIT_EVENT_CLASS_MASK
uint32 WaitEventExtensionNew(const char *wait_event_name)
void WaitEventCustomShmemInit(void)
static uint32 WaitEventCustomNew(uint32 classId, const char *wait_event_name)
uint32 * my_wait_event_info
#define WAIT_EVENT_CUSTOM_INITIAL_ID
static const char * pgstat_get_wait_activity(WaitEventActivity w)
#define PG_WAIT_INJECTIONPOINT
#define PG_WAIT_BUFFERPIN
#define PG_WAIT_EXTENSION