1 /* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2 
3   This program is free software; you can redistribute it and/or modify
4   it under the terms of the GNU General Public License as published by
5   the Free Software Foundation; version 2 of the License.
6 
7   This program is distributed in the hope that it will be useful,
8   but WITHOUT ANY WARRANTY; without even the implied warranty of
9   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10   GNU General Public License for more details.
11 
12   You should have received a copy of the GNU General Public License
13   along with this program; if not, write to the Free Software Foundation,
14   51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15 
16 #ifndef TABLE_EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME_H
17 #define TABLE_EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME_H
18 
19 /**
20   @file storage/perfschema/table_ews_global_by_event_name.h
21   Table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME (declarations).
22 */
23 
24 #include "pfs_column_types.h"
25 #include "pfs_engine_table.h"
26 #include "pfs_instr_class.h"
27 #include "pfs_instr.h"
28 #include "table_all_instr.h"
29 
30 /**
31   @addtogroup Performance_schema_tables
32   @{
33 */
34 
35 /** A row of PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME. */
36 struct row_ews_global_by_event_name
37 {
38   /** Column EVENT_NAME. */
39   const char *m_name;
40   /** Length in bytes of @c m_name. */
41   uint m_name_length;
42   /** Column COUNT_STAR. */
43   ulonglong m_count;
44   /** Column SUM_TIMER_WAIT. */
45   ulonglong m_sum;
46   /** Column MIN_TIMER_WAIT. */
47   ulonglong m_min;
48   /** Column AVG_TIMER_WAIT. */
49   ulonglong m_avg;
50   /** Column MAX_TIMER_WAIT. */
51   ulonglong m_max;
52 };
53 
54 /** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME. */
55 class table_ews_global_by_event_name : public table_all_instr_class
56 {
57 public:
58   /** Table share */
59   static PFS_engine_table_share m_share;
60   static PFS_engine_table* create();
61   static int delete_all_rows();
62 
63 protected:
64   virtual void make_instr_row(PFS_instr_class *klass);
65 
66   virtual int read_row_values(TABLE *table,
67                               unsigned char *buf,
68                               Field **fields,
69                               bool read_all);
70 
71   table_ews_global_by_event_name();
72 
73 public:
~table_ews_global_by_event_name()74   ~table_ews_global_by_event_name()
75   {}
76 
77 private:
78   /** Table share lock. */
79   static THR_LOCK m_table_lock;
80   /** Fields definition. */
81   static TABLE_FIELD_DEF m_field_def;
82 
83   /** Current row. */
84   row_ews_global_by_event_name m_row;
85 };
86 
87 /** @} */
88 #endif
89