1 /* Copyright (c) 2013, 2021, Oracle and/or its affiliates. 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, version 2.0, 5 as published by the Free Software Foundation. 6 7 This program is also distributed with certain software (including 8 but not limited to OpenSSL) that is licensed under separate terms, 9 as designated in a particular file or component or in included license 10 documentation. The authors of MySQL hereby grant you an additional 11 permission to link the program and your derivative works with the 12 separately licensed software that they have included with MySQL. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License, version 2.0, for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ 22 23 #ifndef TABLE_ESMS_BY_PROGRAM_H 24 #define TABLE_ESMS_BY_PROGRAM_H 25 26 /** 27 @file storage/perfschema/table_esms_by_program.h 28 Table EVENTS_STATEMENTS_SUMMARY_BY_PROGRAM (declarations). 29 */ 30 31 #include "table_helper.h" 32 #include "pfs_program.h" 33 34 /** 35 @addtogroup Performance_schema_tables 36 @{ 37 */ 38 39 /** 40 A row of table 41 PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_PROGRAM. 42 */ 43 struct row_esms_by_program 44 { 45 /** Column OBJECT_TYPE. */ 46 enum_object_type m_object_type; 47 /** Column OBJECT_SCHEMA. */ 48 char m_schema_name[COL_OBJECT_SCHEMA_SIZE]; 49 int m_schema_name_length; 50 /** Column OBJECT_NAME. */ 51 char m_object_name[COL_OBJECT_NAME_SIZE]; 52 int m_object_name_length; 53 54 /** 55 Columns COUNT_STAR 56 SUM_TIMER_WAIT 57 MIN_TIMER_WAIT 58 AVG_TIMER_WAIT 59 MAX_TIMER_WAIT 60 */ 61 PFS_sp_stat_row m_sp_stat; 62 63 /** Columns COUNT_STATEMENTS,SUM_STATEMENTS_WAIT...SUM_NO_GOOD_INDEX_USED. */ 64 PFS_statement_stat_row m_stmt_stat; 65 }; 66 67 /** Table PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_PROGRAM. */ 68 class table_esms_by_program : public PFS_engine_table 69 { 70 public: 71 /** Table share */ 72 static PFS_engine_table_share m_share; 73 static PFS_engine_table* create(); 74 static int delete_all_rows(); 75 static ha_rows get_row_count(); 76 77 virtual int rnd_next(); 78 virtual int rnd_pos(const void *pos); 79 virtual void reset_position(void); 80 81 protected: 82 virtual int read_row_values(TABLE *table, 83 unsigned char *buf, 84 Field **fields, 85 bool read_all); 86 87 table_esms_by_program(); 88 89 public: ~table_esms_by_program()90 ~table_esms_by_program() 91 {} 92 93 protected: 94 void make_row(PFS_program*); 95 96 private: 97 /** Table share lock. */ 98 static THR_LOCK m_table_lock; 99 /** Fields definition. */ 100 static TABLE_FIELD_DEF m_field_def; 101 102 /** Current row. */ 103 row_esms_by_program m_row; 104 /** True is the current row exists. */ 105 bool m_row_exists; 106 /** Current position. */ 107 PFS_simple_index m_pos; 108 /** Next position. */ 109 PFS_simple_index m_next_pos; 110 }; 111 112 /** @} */ 113 #endif 114