Skip to content

Commit 7395a90

Browse files
committed
Add WAIT_EVENT_{CLASS,ID}_MASK in wait_event.c
These are useful to extract the class ID and the event ID associated to a single uint32 wait_event_info. Only two code paths use them now, but an upcoming patch will extend their use. Discussion: https://postgr.es/m/ZMcJ7F7nkGkIs8zP@paquier.xyz
1 parent f1e9f6b commit 7395a90

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/backend/utils/activity/wait_event.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ static const char *pgstat_get_wait_io(WaitEventIO w);
3939
static uint32 local_my_wait_event_info;
4040
uint32 *my_wait_event_info = &local_my_wait_event_info;
4141

42+
#define WAIT_EVENT_CLASS_MASK 0xFF000000
43+
#define WAIT_EVENT_ID_MASK 0x0000FFFF
4244

4345
/*
4446
* Configure wait event reporting to report wait events to *wait_event_info.
@@ -82,7 +84,7 @@ pgstat_get_wait_event_type(uint32 wait_event_info)
8284
if (wait_event_info == 0)
8385
return NULL;
8486

85-
classId = wait_event_info & 0xFF000000;
87+
classId = wait_event_info & WAIT_EVENT_CLASS_MASK;
8688

8789
switch (classId)
8890
{
@@ -138,8 +140,8 @@ pgstat_get_wait_event(uint32 wait_event_info)
138140
if (wait_event_info == 0)
139141
return NULL;
140142

141-
classId = wait_event_info & 0xFF000000;
142-
eventId = wait_event_info & 0x0000FFFF;
143+
classId = wait_event_info & WAIT_EVENT_CLASS_MASK;
144+
eventId = wait_event_info & WAIT_EVENT_ID_MASK;
143145

144146
switch (classId)
145147
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy