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 Without limiting anything contained in the foregoing, this file, 15 which is part of C Driver for MySQL (Connector/C), is also subject to the 16 Universal FOSS Exception, version 1.0, a copy of which can be found at 17 http://oss.oracle.com/licenses/universal-foss-exception. 18 19 This program is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 GNU General Public License, version 2.0, for more details. 23 24 You should have received a copy of the GNU General Public License 25 along with this program; if not, write to the Free Software Foundation, 26 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ 27 28 #ifndef MYSQL_PSI_BASE_H 29 #define MYSQL_PSI_BASE_H 30 31 #ifdef EMBEDDED_LIBRARY 32 #define DISABLE_ALL_PSI 33 #endif /* EMBEDDED_LIBRARY */ 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 /** 40 @file mysql/psi/psi_base.h 41 Performance schema instrumentation interface. 42 43 @defgroup Instrumentation_interface Instrumentation Interface 44 @ingroup Performance_schema 45 @{ 46 */ 47 48 #define PSI_INSTRUMENT_ME 0 49 #define PSI_INSTRUMENT_MEM ((PSI_memory_key)0) 50 51 #define PSI_NOT_INSTRUMENTED 0 52 53 /** 54 Global flag. 55 This flag indicate that an instrumentation point is a global variable, 56 or a singleton. 57 */ 58 #define PSI_FLAG_GLOBAL (1 << 0) 59 60 /** 61 Mutable flag. 62 This flag indicate that an instrumentation point is a general placeholder, 63 that can mutate into a more specific instrumentation point. 64 */ 65 #define PSI_FLAG_MUTABLE (1 << 1) 66 67 #define PSI_FLAG_THREAD (1 << 2) 68 69 /** 70 Stage progress flag. 71 This flag apply to the stage instruments only. 72 It indicates the instrumentation provides progress data. 73 */ 74 #define PSI_FLAG_STAGE_PROGRESS (1 << 3) 75 76 /** 77 Shared Exclusive flag. 78 Indicates that rwlock support the shared exclusive state. 79 */ 80 #define PSI_RWLOCK_FLAG_SX (1 << 4) 81 82 /** 83 Transferable flag. 84 This flag indicate that an instrumented object can 85 be created by a thread and destroyed by another thread. 86 */ 87 #define PSI_FLAG_TRANSFER (1 << 5) 88 89 /** 90 Volatility flag. 91 This flag indicate that an instrumented object 92 has a volatility (life cycle) comparable 93 to the volatility of a session. 94 */ 95 #define PSI_FLAG_VOLATILITY_SESSION (1 << 6) 96 97 #ifdef HAVE_PSI_INTERFACE 98 99 /** 100 @def PSI_VERSION_1 101 Performance Schema Interface number for version 1. 102 This version is supported. 103 */ 104 #define PSI_VERSION_1 1 105 106 /** 107 @def PSI_VERSION_2 108 Performance Schema Interface number for version 2. 109 This version is not implemented, it's a placeholder. 110 */ 111 #define PSI_VERSION_2 2 112 113 /** 114 @def PSI_CURRENT_VERSION 115 Performance Schema Interface number for the most recent version. 116 The most current version is @c PSI_VERSION_1 117 */ 118 #define PSI_CURRENT_VERSION 1 119 120 /** 121 @def USE_PSI_1 122 Define USE_PSI_1 to use the interface version 1. 123 */ 124 125 /** 126 @def USE_PSI_2 127 Define USE_PSI_2 to use the interface version 2. 128 */ 129 130 /** 131 @def HAVE_PSI_1 132 Define HAVE_PSI_1 if the interface version 1 needs to be compiled in. 133 */ 134 135 /** 136 @def HAVE_PSI_2 137 Define HAVE_PSI_2 if the interface version 2 needs to be compiled in. 138 */ 139 140 #ifndef USE_PSI_2 141 #ifndef USE_PSI_1 142 #define USE_PSI_1 143 #endif 144 #endif 145 146 #ifdef USE_PSI_1 147 #define HAVE_PSI_1 148 #endif 149 150 #ifdef USE_PSI_2 151 #define HAVE_PSI_2 152 #endif 153 154 /* 155 Allow to override PSI_XXX_CALL at compile time 156 with more efficient implementations, if available. 157 If nothing better is available, 158 make a dynamic call using the PSI_server function pointer. 159 */ 160 161 #define PSI_DYNAMIC_CALL(M) PSI_server->M 162 163 #endif /* HAVE_PSI_INTERFACE */ 164 165 /** @} */ 166 167 #ifdef __cplusplus 168 } 169 #endif 170 171 #endif /* MYSQL_PSI_BASE_H */ 172 173