21 #include "my_global.h"
22 #include "my_pthread.h"
31 THR_LOCK table_ews_by_host_by_event_name::m_table_lock;
36 { C_STRING_WITH_LEN(
"HOST") },
37 { C_STRING_WITH_LEN(
"char(60)") },
41 { C_STRING_WITH_LEN(
"EVENT_NAME") },
42 { C_STRING_WITH_LEN(
"varchar(128)") },
46 { C_STRING_WITH_LEN(
"COUNT_STAR") },
47 { C_STRING_WITH_LEN(
"bigint(20)") },
51 { C_STRING_WITH_LEN(
"SUM_TIMER_WAIT") },
52 { C_STRING_WITH_LEN(
"bigint(20)") },
56 { C_STRING_WITH_LEN(
"MIN_TIMER_WAIT") },
57 { C_STRING_WITH_LEN(
"bigint(20)") },
61 { C_STRING_WITH_LEN(
"AVG_TIMER_WAIT") },
62 { C_STRING_WITH_LEN(
"bigint(20)") },
66 { C_STRING_WITH_LEN(
"MAX_TIMER_WAIT") },
67 { C_STRING_WITH_LEN(
"bigint(20)") },
73 table_ews_by_host_by_event_name::m_field_def=
79 { C_STRING_WITH_LEN(
"events_waits_summary_by_host_by_event_name") },
81 table_ews_by_host_by_event_name::create,
83 table_ews_by_host_by_event_name::delete_all_rows,
93 table_ews_by_host_by_event_name::create(
void)
99 table_ews_by_host_by_event_name::delete_all_rows(
void)
107 table_ews_by_host_by_event_name::table_ews_by_host_by_event_name()
109 m_row_exists(false), m_pos(), m_next_pos()
123 for (m_pos.
set_at(&m_next_pos);
124 m_pos.has_more_host();
131 m_pos.has_more_view();
136 case pos_ews_by_host_by_event_name::VIEW_MUTEX:
139 case pos_ews_by_host_by_event_name::VIEW_RWLOCK:
142 case pos_ews_by_host_by_event_name::VIEW_COND:
145 case pos_ews_by_host_by_event_name::VIEW_FILE:
148 case pos_ews_by_host_by_event_name::VIEW_TABLE:
149 instr_class= find_table_class(m_pos.
m_index_3);
151 case pos_ews_by_host_by_event_name::VIEW_SOCKET:
154 case pos_ews_by_host_by_event_name::VIEW_IDLE:
155 instr_class= find_idle_class(m_pos.
m_index_3);
165 make_row(host, instr_class);
173 return HA_ERR_END_OF_FILE;
187 return HA_ERR_RECORD_DELETED;
191 case pos_ews_by_host_by_event_name::VIEW_MUTEX:
194 case pos_ews_by_host_by_event_name::VIEW_RWLOCK:
197 case pos_ews_by_host_by_event_name::VIEW_COND:
200 case pos_ews_by_host_by_event_name::VIEW_FILE:
203 case pos_ews_by_host_by_event_name::VIEW_TABLE:
204 instr_class= find_table_class(m_pos.
m_index_3);
206 case pos_ews_by_host_by_event_name::VIEW_SOCKET:
209 case pos_ews_by_host_by_event_name::VIEW_IDLE:
210 instr_class= find_idle_class(m_pos.
m_index_3);
219 make_row(host, instr_class);
223 return HA_ERR_RECORD_DELETED;
226 void table_ews_by_host_by_event_name
257 if (unlikely(! m_row_exists))
258 return HA_ERR_RECORD_DELETED;
261 DBUG_ASSERT(table->s->null_bytes == 1);
264 for (; (f= *fields) ; fields++)
266 if (read_all || bitmap_is_set(table->read_set, f->field_index))
268 switch(f->field_index)
271 m_row.m_host.set_field(f);
274 m_row.m_event_name.set_field(f);
277 m_row.m_stat.set_field(f->field_index - 2, f);