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, Suite 500, Boston, MA 02110-1335 USA */ 27 28 #ifndef MYSQL_PSI_BASE_H 29 #define MYSQL_PSI_BASE_H 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 /** 36 @file mysql/psi/psi_base.h 37 Performance schema instrumentation interface. 38 39 @defgroup Instrumentation_interface Instrumentation Interface 40 @ingroup Performance_schema 41 @{ 42 */ 43 44 #define PSI_INSTRUMENT_ME 0 45 46 #define PSI_NOT_INSTRUMENTED 0 47 48 /** 49 Global flag. 50 This flag indicate that an instrumentation point is a global variable, 51 or a singleton. 52 */ 53 #define PSI_FLAG_GLOBAL (1 << 0) 54 55 /** 56 Mutable flag. 57 This flag indicate that an instrumentation point is a general placeholder, 58 that can mutate into a more specific instrumentation point. 59 */ 60 #define PSI_FLAG_MUTABLE (1 << 1) 61 62 #define PSI_FLAG_THREAD (1 << 2) 63 64 /** 65 Stage progress flag. 66 This flag apply to the stage instruments only. 67 It indicates the instrumentation provides progress data. 68 */ 69 #define PSI_FLAG_STAGE_PROGRESS (1 << 3) 70 71 /** 72 Shared Exclusive flag. 73 Indicates that rwlock support the shared exclusive state. 74 */ 75 #define PSI_RWLOCK_FLAG_SX (1 << 4) 76 77 /** 78 Transferable flag. 79 This flag indicate that an instrumented object can 80 be created by a thread and destroyed by another thread. 81 */ 82 #define PSI_FLAG_TRANSFER (1 << 5) 83 84 /** 85 Volatility flag. 86 This flag indicate that an instrumented object 87 has a volatility (life cycle) comparable 88 to the volatility of a session. 89 */ 90 #define PSI_FLAG_VOLATILITY_SESSION (1 << 6) 91 92 #ifdef HAVE_PSI_INTERFACE 93 94 /** 95 @def PSI_VERSION_1 96 Performance Schema Interface number for version 1. 97 This version is supported. 98 */ 99 #define PSI_VERSION_1 1 100 101 /** 102 @def PSI_VERSION_2 103 Performance Schema Interface number for version 2. 104 This version is not implemented, it's a placeholder. 105 */ 106 #define PSI_VERSION_2 2 107 108 /** 109 @def PSI_CURRENT_VERSION 110 Performance Schema Interface number for the most recent version. 111 The most current version is @c PSI_VERSION_1 112 */ 113 #define PSI_CURRENT_VERSION 1 114 115 /** 116 @def USE_PSI_1 117 Define USE_PSI_1 to use the interface version 1. 118 */ 119 120 /** 121 @def USE_PSI_2 122 Define USE_PSI_2 to use the interface version 2. 123 */ 124 125 /** 126 @def HAVE_PSI_1 127 Define HAVE_PSI_1 if the interface version 1 needs to be compiled in. 128 */ 129 130 /** 131 @def HAVE_PSI_2 132 Define HAVE_PSI_2 if the interface version 2 needs to be compiled in. 133 */ 134 135 #ifndef USE_PSI_2 136 #ifndef USE_PSI_1 137 #define USE_PSI_1 138 #endif 139 #endif 140 141 #ifdef USE_PSI_1 142 #define HAVE_PSI_1 143 #endif 144 145 #ifdef USE_PSI_2 146 #define HAVE_PSI_2 147 #endif 148 149 /* 150 Allow to override PSI_XXX_CALL at compile time 151 with more efficient implementations, if available. 152 If nothing better is available, 153 make a dynamic call using the PSI_server function pointer. 154 */ 155 156 #define PSI_DYNAMIC_CALL(M) PSI_server->M 157 158 #endif /* HAVE_PSI_INTERFACE */ 159 160 /** @} */ 161 162 #ifdef __cplusplus 163 } 164 #endif 165 166 #endif /* MYSQL_PSI_BASE_H */ 167 168