21 #include "my_global.h"
22 #include "my_pthread.h"
30 THR_LOCK table_ews_by_account_by_event_name::m_table_lock;
35 { C_STRING_WITH_LEN(
"USER") },
36 { C_STRING_WITH_LEN(
"char(16)") },
40 { C_STRING_WITH_LEN(
"HOST") },
41 { C_STRING_WITH_LEN(
"char(60)") },
45 { C_STRING_WITH_LEN(
"EVENT_NAME") },
46 { C_STRING_WITH_LEN(
"varchar(128)") },
50 { C_STRING_WITH_LEN(
"COUNT_STAR") },
51 { C_STRING_WITH_LEN(
"bigint(20)") },
55 { C_STRING_WITH_LEN(
"SUM_TIMER_WAIT") },
56 { C_STRING_WITH_LEN(
"bigint(20)") },
60 { C_STRING_WITH_LEN(
"MIN_TIMER_WAIT") },
61 { C_STRING_WITH_LEN(
"bigint(20)") },
65 { C_STRING_WITH_LEN(
"AVG_TIMER_WAIT") },
66 { C_STRING_WITH_LEN(
"bigint(20)") },
70 { C_STRING_WITH_LEN(
"MAX_TIMER_WAIT") },
71 { C_STRING_WITH_LEN(
"bigint(20)") },
77 table_ews_by_account_by_event_name::m_field_def=
83 { C_STRING_WITH_LEN(
"events_waits_summary_by_account_by_event_name") },
85 table_ews_by_account_by_event_name::create,
87 table_ews_by_account_by_event_name::delete_all_rows,
97 table_ews_by_account_by_event_name::create(
void)
103 table_ews_by_account_by_event_name::delete_all_rows(
void)
110 table_ews_by_account_by_event_name::table_ews_by_account_by_event_name()
112 m_row_exists(false), m_pos(), m_next_pos()
126 for (m_pos.
set_at(&m_next_pos);
127 m_pos.has_more_account();
128 m_pos.next_account())
130 account= &account_array[m_pos.
m_index_1];
134 m_pos.has_more_view();
139 case pos_ews_by_account_by_event_name::VIEW_MUTEX:
142 case pos_ews_by_account_by_event_name::VIEW_RWLOCK:
145 case pos_ews_by_account_by_event_name::VIEW_COND:
148 case pos_ews_by_account_by_event_name::VIEW_FILE:
151 case pos_ews_by_account_by_event_name::VIEW_TABLE:
152 instr_class= find_table_class(m_pos.
m_index_3);
154 case pos_ews_by_account_by_event_name::VIEW_SOCKET:
157 case pos_ews_by_account_by_event_name::VIEW_IDLE:
158 instr_class= find_idle_class(m_pos.
m_index_3);
168 make_row(account, instr_class);
176 return HA_ERR_END_OF_FILE;
186 DBUG_ASSERT(m_pos.
m_index_1 < account_max);
188 account= &account_array[m_pos.
m_index_1];
190 return HA_ERR_RECORD_DELETED;
194 case pos_ews_by_account_by_event_name::VIEW_MUTEX:
197 case pos_ews_by_account_by_event_name::VIEW_RWLOCK:
200 case pos_ews_by_account_by_event_name::VIEW_COND:
203 case pos_ews_by_account_by_event_name::VIEW_FILE:
206 case pos_ews_by_account_by_event_name::VIEW_TABLE:
207 instr_class= find_table_class(m_pos.
m_index_3);
209 case pos_ews_by_account_by_event_name::VIEW_SOCKET:
212 case pos_ews_by_account_by_event_name::VIEW_IDLE:
213 instr_class= find_idle_class(m_pos.
m_index_3);
221 make_row(account, instr_class);
225 return HA_ERR_RECORD_DELETED;
228 void table_ews_by_account_by_event_name
259 if (unlikely(! m_row_exists))
260 return HA_ERR_RECORD_DELETED;
263 DBUG_ASSERT(table->s->null_bytes == 1);
266 for (; (f= *fields) ; fields++)
268 if (read_all || bitmap_is_set(table->read_set, f->field_index))
270 switch(f->field_index)
274 m_row.m_account.set_field(f->field_index, f);
277 m_row.m_event_name.set_field(f);
280 m_row.m_stat.set_field(f->field_index - 3, f);