@@ -45,7 +45,6 @@ static void io_poll_close(TP_file_handle fd)
45
45
#endif
46
46
}
47
47
48
-
49
48
/* * Maximum number of native events a listener can read in one go */
50
49
#define MAX_EVENTS 1024
51
50
@@ -435,6 +434,16 @@ static TP_connection_generic *queue_get(thread_group_t *thread_group)
435
434
DBUG_RETURN (0 );
436
435
}
437
436
437
+ static TP_connection_generic* queue_get (thread_group_t * group, operation_origin origin)
438
+ {
439
+ auto ret = queue_get (group);
440
+ if (ret)
441
+ {
442
+ TP_INCREMENT_GROUP_COUNTER (group, dequeues[(int )origin]);
443
+ }
444
+ return ret;
445
+ }
446
+
438
447
static bool is_queue_empty (thread_group_t *thread_group)
439
448
{
440
449
for (int i=0 ; i < NQUEUES; i++)
@@ -684,7 +693,7 @@ static TP_connection_generic * listener(worker_thread_t *current_thread,
684
693
break ;
685
694
686
695
cnt = io_poll_wait (thread_group->pollfd , ev, MAX_EVENTS, -1 );
687
- TP_INCREMENT_GROUP_COUNTER (thread_group, polls_by_listener );
696
+ TP_INCREMENT_GROUP_COUNTER (thread_group, polls[( int )operation_origin::LISTENER] );
688
697
if (cnt <=0 )
689
698
{
690
699
DBUG_ASSERT (thread_group->shutdown );
@@ -750,7 +759,7 @@ static TP_connection_generic * listener(worker_thread_t *current_thread,
750
759
if (listener_picks_event)
751
760
{
752
761
/* Handle the first event. */
753
- retval= queue_get (thread_group);
762
+ retval= queue_get (thread_group, operation_origin::LISTENER );
754
763
mysql_mutex_unlock (&thread_group->mutex );
755
764
break ;
756
765
}
@@ -1130,10 +1139,9 @@ TP_connection_generic *get_event(worker_thread_t *current_thread,
1130
1139
/* Check if queue is not empty */
1131
1140
if (!oversubscribed)
1132
1141
{
1133
- connection = queue_get (thread_group);
1142
+ connection = queue_get (thread_group, operation_origin::WORKER );
1134
1143
if (connection)
1135
1144
{
1136
- TP_INCREMENT_GROUP_COUNTER (thread_group,dequeues_by_worker);
1137
1145
break ;
1138
1146
}
1139
1147
}
@@ -1146,10 +1154,7 @@ TP_connection_generic *get_event(worker_thread_t *current_thread,
1146
1154
mysql_mutex_unlock (&thread_group->mutex );
1147
1155
1148
1156
connection = listener (current_thread, thread_group);
1149
- if (connection)
1150
- {
1151
- TP_INCREMENT_GROUP_COUNTER (thread_group, dequeues_by_listener);
1152
- }
1157
+
1153
1158
mysql_mutex_lock (&thread_group->mutex );
1154
1159
thread_group->active_thread_count ++;
1155
1160
/* There is no listener anymore, it just returned. */
@@ -1167,11 +1172,11 @@ TP_connection_generic *get_event(worker_thread_t *current_thread,
1167
1172
{
1168
1173
native_event ev[MAX_EVENTS];
1169
1174
int cnt = io_poll_wait (thread_group->pollfd , ev, MAX_EVENTS, 0 );
1170
- TP_INCREMENT_GROUP_COUNTER (thread_group, polls_by_worker );
1175
+ TP_INCREMENT_GROUP_COUNTER (thread_group, polls[( int )operation_origin::WORKER] );
1171
1176
if (cnt > 0 )
1172
1177
{
1173
1178
queue_put (thread_group, ev, cnt);
1174
- connection= queue_get (thread_group);
1179
+ connection= queue_get (thread_group,operation_origin::WORKER );
1175
1180
break ;
1176
1181
}
1177
1182
}
0 commit comments