1 /* Copyright (c) 2008, 2020, 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, 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ 22 23 #ifndef MYSQL_PSI_THREAD_H 24 #define MYSQL_PSI_THREAD_H 25 26 /** 27 @file include/mysql/psi/psi_thread.h 28 Performance schema instrumentation interface. 29 30 @defgroup psi_abi_thread Thread Instrumentation (ABI) 31 @ingroup psi_abi 32 @{ 33 */ 34 35 #include "my_inttypes.h" 36 #include "my_macros.h" 37 #include "my_psi_config.h" // IWYU pragma: keep 38 #include "my_sharedlib.h" 39 #include "mysql/components/services/psi_thread_bits.h" 40 41 /** 42 @def PSI_THREAD_VERSION_1 43 Performance Schema Thread Interface number for version 1. 44 This version is obsolete. 45 */ 46 #define PSI_THREAD_VERSION_1 1 47 48 /** 49 @def PSI_THREAD_VERSION_2 50 Performance Schema Thread Interface number for version 2. 51 This version is obsolete. 52 */ 53 #define PSI_THREAD_VERSION_2 2 54 55 /** 56 @def PSI_THREAD_VERSION_3 57 Performance Schema Thread Interface number for version 3. 58 This version is supported. 59 */ 60 #define PSI_THREAD_VERSION_3 3 61 62 /** 63 @def PSI_CURRENT_THREAD_VERSION 64 Performance Schema Thread Interface number for the most recent version. 65 The most current version is @c PSI_THREAD_VERSION_3 66 */ 67 #define PSI_CURRENT_THREAD_VERSION 3 68 69 /** Entry point for the performance schema interface. */ 70 struct PSI_thread_bootstrap { 71 /** 72 ABI interface finder. 73 Calling this method with an interface version number returns either 74 an instance of the ABI for this version, or NULL. 75 @sa PSI_THREAD_VERSION_1 76 @sa PSI_THREAD_VERSION_2 77 @sa PSI_THREAD_VERSION_3 78 @sa PSI_CURRENT_THREAD_VERSION 79 */ 80 void *(*get_interface)(int version); 81 }; 82 typedef struct PSI_thread_bootstrap PSI_thread_bootstrap; 83 84 #ifdef HAVE_PSI_THREAD_INTERFACE 85 86 /** 87 Performance Schema Thread Interface, version 3. 88 @since PSI_THREAD_VERSION_3 89 */ 90 struct PSI_thread_service_v3 { 91 /** @sa register_thread_v1_t. */ 92 register_thread_v1_t register_thread; 93 /** @sa spawn_thread_v1_t. */ 94 spawn_thread_v1_t spawn_thread; 95 /** @sa new_thread_v1_t. */ 96 new_thread_v1_t new_thread; 97 /** @sa set_thread_id_v1_t. */ 98 set_thread_id_v1_t set_thread_id; 99 /** @sa get_current_thread_internal_id_v2_t. */ 100 get_current_thread_internal_id_v2_t get_current_thread_internal_id; 101 /** @sa get_thread_internal_id_v2_t. */ 102 get_thread_internal_id_v2_t get_thread_internal_id; 103 /** @sa get_thread_by_id_v2_t. */ 104 get_thread_by_id_v2_t get_thread_by_id; 105 /** @sa set_thread_THD_v1_t. */ 106 set_thread_THD_v1_t set_thread_THD; 107 /** @sa set_thread_os_id_v1_t. */ 108 set_thread_os_id_v1_t set_thread_os_id; 109 /** @sa get_thread_v1_t. */ 110 get_thread_v1_t get_thread; 111 /** @sa set_thread_user_v1_t. */ 112 set_thread_user_v1_t set_thread_user; 113 /** @sa set_thread_account_v1_t. */ 114 set_thread_account_v1_t set_thread_account; 115 /** @sa set_thread_db_v1_t. */ 116 set_thread_db_v1_t set_thread_db; 117 /** @sa set_thread_command_v1_t. */ 118 set_thread_command_v1_t set_thread_command; 119 /** @sa set_connection_type_v1_t. */ 120 set_connection_type_v1_t set_connection_type; 121 /** @sa set_thread_start_time_v1_t. */ 122 set_thread_start_time_v1_t set_thread_start_time; 123 /** @sa set_thread_info_v1_t. */ 124 set_thread_info_v1_t set_thread_info; 125 /** @sa set_thread_resource_group_v1_t. */ 126 set_thread_resource_group_v1_t set_thread_resource_group; 127 /** @sa set_thread_resource_group_by_id_v1_t. */ 128 set_thread_resource_group_by_id_v1_t set_thread_resource_group_by_id; 129 /** @sa set_thread_v1_t. */ 130 set_thread_v1_t set_thread; 131 /** @sa aggregate_thread_status_v1_t. */ 132 aggregate_thread_status_v2_t aggregate_thread_status; 133 /** @sa delete_current_thread_v1_t. */ 134 delete_current_thread_v1_t delete_current_thread; 135 /** @sa delete_thread_v1_t. */ 136 delete_thread_v1_t delete_thread; 137 /** @sa set_thread_connect_attrs_v1_t. */ 138 set_thread_connect_attrs_v1_t set_thread_connect_attrs; 139 /** @sa get_current_thread_event_id_v2_t. */ 140 get_current_thread_event_id_v2_t get_current_thread_event_id; 141 /** @sa get_thread_event_id_v2_t. */ 142 get_thread_event_id_v2_t get_thread_event_id; 143 /** @sa get_thread_system_attrs_v1_t. */ 144 get_thread_system_attrs_v3_t get_thread_system_attrs; 145 /** @sa get_thread_system_attrs_by_id_v1_t. */ 146 get_thread_system_attrs_by_id_v3_t get_thread_system_attrs_by_id; 147 /** @sa register_notification_v1_t. */ 148 register_notification_v3_t register_notification; 149 /** @sa unregister_notification_v1_t. */ 150 unregister_notification_v1_t unregister_notification; 151 /** @sa notify_session_connect_v1_t. */ 152 notify_session_connect_v1_t notify_session_connect; 153 /** @sa notify_session_disconnect_v1_t. */ 154 notify_session_disconnect_v1_t notify_session_disconnect; 155 /** @sa notify_session_change_user_v1_t. */ 156 notify_session_change_user_v1_t notify_session_change_user; 157 }; 158 159 typedef struct PSI_thread_service_v3 PSI_thread_service_t; 160 161 extern MYSQL_PLUGIN_IMPORT PSI_thread_service_t *psi_thread_service; 162 163 #endif /* HAVE_PSI_THREAD_INTERFACE */ 164 165 /** @} (end of group psi_abi_thread) */ 166 167 #endif /* MYSQL_PSI_THREAD_H */ 168