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_SOCKET_SUMMARY_BY_INSTANCE_H 24 #define TABLE_SOCKET_SUMMARY_BY_INSTANCE_H 25 26 /** 27 @file storage/perfschema/table_socket_summary_by_instance.h 28 Table SOCKET_SUMMARY_BY_INSTANCE (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 /** 43 A row of table 44 PERFORMANCE_SCHEMA.SOCKET_SUMMARY_BY_INSTANCE. 45 */ 46 struct row_socket_summary_by_instance 47 { 48 /** Column EVENT_NAME. */ 49 PFS_event_name_row m_event_name; 50 51 /** Column OBJECT_INSTANCE_BEGIN */ 52 const void *m_identity; 53 54 /** Columns COUNT_STAR, SUM/MIN/AVG/MAX TIMER and NUMBER_OF_BYTES for each operation. */ 55 PFS_socket_io_stat_row m_io_stat; 56 }; 57 58 /** Table PERFORMANCE_SCHEMA.SOCKET_SUMMARY_BY_INSTANCE. */ 59 class table_socket_summary_by_instance : public PFS_engine_table 60 { 61 public: 62 /** Table share */ 63 static PFS_engine_table_share m_share; 64 static PFS_engine_table* create(); 65 static int delete_all_rows(); 66 static ha_rows get_row_count(); 67 68 virtual int rnd_next(); 69 virtual int rnd_pos(const void *pos); 70 virtual void reset_position(void); 71 72 private: 73 virtual int read_row_values(TABLE *table, 74 unsigned char *buf, 75 Field **fields, 76 bool read_all); 77 78 table_socket_summary_by_instance(); 79 80 public: ~table_socket_summary_by_instance()81 ~table_socket_summary_by_instance() 82 {} 83 84 private: 85 void make_row(PFS_socket *pfs); 86 87 /** Table share lock. */ 88 static THR_LOCK m_table_lock; 89 /** Fields definition. */ 90 static TABLE_FIELD_DEF m_field_def; 91 92 /** Current row. */ 93 row_socket_summary_by_instance m_row; 94 /** True if the current row exists. */ 95 bool m_row_exists; 96 /** Current position. */ 97 PFS_simple_index m_pos; 98 /** Next position. */ 99 PFS_simple_index m_next_pos; 100 }; 101 102 /** @} */ 103 #endif 104