summaryrefslogtreecommitdiff
path: root/storage/perfschema/table_ews_global_by_event_name.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-07-28 15:52:12 +0200
committerSergei Golubchik <serg@mariadb.org>2016-07-28 15:52:12 +0200
commit15f60c1a733eced957384ac56317337fc5f32420 (patch)
tree32e5595cdaa5acc78023745d81e3e4a80571f352 /storage/perfschema/table_ews_global_by_event_name.cc
parent51ed64a520dfbec24b73bffc40494d738713df22 (diff)
downloadmariadb-git-15f60c1a733eced957384ac56317337fc5f32420.tar.gz
5.7.13
Diffstat (limited to 'storage/perfschema/table_ews_global_by_event_name.cc')
-rw-r--r--storage/perfschema/table_ews_global_by_event_name.cc62
1 files changed, 54 insertions, 8 deletions
diff --git a/storage/perfschema/table_ews_global_by_event_name.cc b/storage/perfschema/table_ews_global_by_event_name.cc
index 1e165c36bc5..c26789dc58f 100644
--- a/storage/perfschema/table_ews_global_by_event_name.cc
+++ b/storage/perfschema/table_ews_global_by_event_name.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
*/
#include "my_global.h"
-#include "my_pthread.h"
+#include "my_thread.h"
#include "pfs_instr_class.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
@@ -28,6 +28,7 @@
#include "pfs_instr.h"
#include "pfs_timer.h"
#include "pfs_visitor.h"
+#include "field.h"
THR_LOCK table_ews_global_by_event_name::m_table_lock;
@@ -77,12 +78,12 @@ table_ews_global_by_event_name::m_share=
table_ews_global_by_event_name::create,
NULL, /* write_row */
table_ews_global_by_event_name::delete_all_rows,
- NULL, /* get_row_count */
- 1000, /* records */
+ table_ews_global_by_event_name::get_row_count,
sizeof(pos_ews_global_by_event_name),
&m_table_lock,
&m_field_def,
- false /* checked */
+ false, /* checked */
+ false /* perpetual */
};
PFS_engine_table*
@@ -101,6 +102,12 @@ table_ews_global_by_event_name::delete_all_rows(void)
return 0;
}
+ha_rows
+table_ews_global_by_event_name::get_row_count(void)
+{
+ return wait_class_max;
+}
+
table_ews_global_by_event_name::table_ews_global_by_event_name()
: PFS_engine_table(&m_share, &m_pos),
m_row_exists(false), m_pos(), m_next_pos()
@@ -195,6 +202,15 @@ int table_ews_global_by_event_name::rnd_next(void)
return 0;
}
break;
+ case pos_ews_global_by_event_name::VIEW_METADATA:
+ instr_class= find_metadata_class(m_pos.m_index_2);
+ if (instr_class)
+ {
+ make_metadata_row(instr_class);
+ m_next_pos.set_after(&m_pos);
+ return 0;
+ }
+ break;
default:
break;
}
@@ -273,6 +289,17 @@ table_ews_global_by_event_name::rnd_pos(const void *pos)
return 0;
}
break;
+ case pos_ews_global_by_event_name::VIEW_METADATA:
+ instr_class= find_metadata_class(m_pos.m_index_2);
+ if (instr_class)
+ {
+ make_metadata_row(instr_class);
+ return 0;
+ }
+ break;
+ default:
+ DBUG_ASSERT(false);
+ break;
}
return HA_ERR_RECORD_DELETED;
@@ -350,7 +377,7 @@ void table_ews_global_by_event_name
PFS_table_lock_wait_visitor visitor;
PFS_object_iterator::visit_all_tables(& visitor);
-
+
get_normalizer(klass);
m_row.m_stat.set(m_normalizer, & visitor.m_stat);
m_row_exists= true;
@@ -377,8 +404,27 @@ void table_ews_global_by_event_name
PFS_connection_wait_visitor visitor(klass);
PFS_connection_iterator::visit_global(false, /* hosts */
false, /* users */
- false, /* accts */
- true, /* threads */ &visitor);
+ false, /* accounts */
+ true, /* threads */
+ false, /* THDs */
+ &visitor);
+ get_normalizer(klass);
+ m_row.m_stat.set(m_normalizer, &visitor.m_stat);
+ m_row_exists= true;
+}
+
+void table_ews_global_by_event_name
+::make_metadata_row(PFS_instr_class *klass)
+{
+ m_row.m_event_name.make_row(klass);
+
+ PFS_connection_wait_visitor visitor(klass);
+ PFS_connection_iterator::visit_global(false, /* hosts */
+ true, /* users */
+ true, /* accounts */
+ true, /* threads */
+ false, /* THDs */
+ &visitor);
get_normalizer(klass);
m_row.m_stat.set(m_normalizer, &visitor.m_stat);
m_row_exists= true;