21 #include "my_global.h"
22 #include "my_pthread.h"
30 THR_LOCK table_ews_by_thread_by_event_name::m_table_lock;
35 { C_STRING_WITH_LEN(
"THREAD_ID") },
36 { C_STRING_WITH_LEN(
"bigint(20)") },
40 { C_STRING_WITH_LEN(
"EVENT_NAME") },
41 { C_STRING_WITH_LEN(
"varchar(128)") },
45 { C_STRING_WITH_LEN(
"COUNT_STAR") },
46 { C_STRING_WITH_LEN(
"bigint(20)") },
50 { C_STRING_WITH_LEN(
"SUM_TIMER_WAIT") },
51 { C_STRING_WITH_LEN(
"bigint(20)") },
55 { C_STRING_WITH_LEN(
"MIN_TIMER_WAIT") },
56 { C_STRING_WITH_LEN(
"bigint(20)") },
60 { C_STRING_WITH_LEN(
"AVG_TIMER_WAIT") },
61 { C_STRING_WITH_LEN(
"bigint(20)") },
65 { C_STRING_WITH_LEN(
"MAX_TIMER_WAIT") },
66 { C_STRING_WITH_LEN(
"bigint(20)") },
72 table_ews_by_thread_by_event_name::m_field_def=
78 { C_STRING_WITH_LEN(
"events_waits_summary_by_thread_by_event_name") },
80 table_ews_by_thread_by_event_name::create,
82 table_ews_by_thread_by_event_name::delete_all_rows,
92 table_ews_by_thread_by_event_name::create(
void)
98 table_ews_by_thread_by_event_name::delete_all_rows(
void)
104 table_ews_by_thread_by_event_name::table_ews_by_thread_by_event_name()
106 m_row_exists(false), m_pos(), m_next_pos()
120 for (m_pos.
set_at(&m_next_pos);
121 m_pos.has_more_thread();
133 m_pos.has_more_view();
138 case pos_ews_by_thread_by_event_name::VIEW_MUTEX:
141 case pos_ews_by_thread_by_event_name::VIEW_RWLOCK:
144 case pos_ews_by_thread_by_event_name::VIEW_COND:
147 case pos_ews_by_thread_by_event_name::VIEW_FILE:
150 case pos_ews_by_thread_by_event_name::VIEW_TABLE:
151 instr_class= find_table_class(m_pos.
m_index_3);
153 case pos_ews_by_thread_by_event_name::VIEW_SOCKET:
156 case pos_ews_by_thread_by_event_name::VIEW_IDLE:
157 instr_class= find_idle_class(m_pos.
m_index_3);
165 if (instr_class != NULL)
167 make_row(thread, instr_class);
175 return HA_ERR_END_OF_FILE;
189 return HA_ERR_RECORD_DELETED;
193 case pos_ews_by_thread_by_event_name::VIEW_MUTEX:
196 case pos_ews_by_thread_by_event_name::VIEW_RWLOCK:
199 case pos_ews_by_thread_by_event_name::VIEW_COND:
202 case pos_ews_by_thread_by_event_name::VIEW_FILE:
205 case pos_ews_by_thread_by_event_name::VIEW_TABLE:
206 instr_class= find_table_class(m_pos.
m_index_3);
208 case pos_ews_by_thread_by_event_name::VIEW_SOCKET:
211 case pos_ews_by_thread_by_event_name::VIEW_IDLE:
212 instr_class= find_idle_class(m_pos.
m_index_3);
221 make_row(thread, instr_class);
224 return HA_ERR_RECORD_DELETED;
227 void table_ews_by_thread_by_event_name
247 if (klass->is_deferred())
254 visitor.m_stat.aggregate(&inst_visitor.
m_stat);
272 if (unlikely(! m_row_exists))
273 return HA_ERR_RECORD_DELETED;
276 DBUG_ASSERT(table->s->null_bytes == 0);
278 for (; (f= *fields) ; fields++)
280 if (read_all || bitmap_is_set(table->read_set, f->field_index))
282 switch(f->field_index)
285 set_field_ulonglong(f, m_row.m_thread_internal_id);
288 m_row.m_event_name.set_field(f);
291 m_row.m_stat.set_field(f->field_index - 2, f);