1 /* Copyright (c) 2008, 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 Foundation, 21 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ 22 23 #ifndef TABLE_FILE_SUMMARY_H 24 #define TABLE_FILE_SUMMARY_H 25 26 /** 27 @file storage/perfschema/table_file_summary_by_event_name.h 28 Table FILE_SUMMARY_BY_EVENT_NAME (declarations). 29 */ 30 31 #include "pfs_column_types.h" 32 #include "pfs_engine_table.h" 33 #include "pfs_instr_class.h" 34 #include "pfs_instr.h" 35 #include "table_helper.h" 36 37 /** 38 @addtogroup Performance_schema_tables 39 @{ 40 */ 41 42 /** A row of PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */ 43 struct row_file_summary_by_event_name 44 { 45 /** Column EVENT_NAME. */ 46 PFS_event_name_row m_event_name; 47 48 /** Columns COUNT_STAR, SUM/MIN/AVG/MAX TIMER and NUMBER_OF_BYTES 49 for READ, WRITE and MISC operation types. 50 */ 51 PFS_file_io_stat_row m_io_stat; 52 }; 53 54 /** Table PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */ 55 class table_file_summary_by_event_name : public PFS_engine_table 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 static ha_rows get_row_count(); 63 64 virtual int rnd_next(); 65 virtual int rnd_pos(const void *pos); 66 virtual void reset_position(void); 67 68 private: 69 virtual int read_row_values(TABLE *table, 70 unsigned char *buf, 71 Field **fields, 72 bool read_all); 73 74 table_file_summary_by_event_name(); 75 76 public: ~table_file_summary_by_event_name()77 ~table_file_summary_by_event_name() 78 {} 79 80 private: 81 void make_row(PFS_file_class *klass); 82 83 /** Table share lock. */ 84 static THR_LOCK m_table_lock; 85 /** Fields definition. */ 86 static TABLE_FIELD_DEF m_field_def; 87 88 /** Current row. */ 89 row_file_summary_by_event_name m_row; 90 /** True if the current row exists. */ 91 bool m_row_exists; 92 /** Current position. */ 93 PFS_simple_index m_pos; 94 /** Next position. */ 95 PFS_simple_index m_next_pos; 96 }; 97 98 /** @} */ 99 #endif 100