| 1 | /* Copyright (c) 2008, 2015, 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 as published by | 
| 5 |   the Free Software Foundation; version 2 of the License. | 
| 6 |  | 
| 7 |   This program is distributed in the hope that it will be useful, | 
| 8 |   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 9 |   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 10 |   GNU General Public License for more details. | 
| 11 |  | 
| 12 |   You should have received a copy of the GNU General Public License | 
| 13 |   along with this program; if not, write to the Free Software Foundation, | 
| 14 |   51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ | 
| 15 |  | 
| 16 | #ifndef MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H | 
| 17 | #define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H | 
| 18 |  | 
| 19 | #ifdef EMBEDDED_LIBRARY | 
| 20 | #define DISABLE_PSI_MUTEX | 
| 21 | #define DISABLE_PSI_RWLOCK | 
| 22 | #define DISABLE_PSI_COND | 
| 23 | #define DISABLE_PSI_FILE | 
| 24 | #define DISABLE_PSI_TABLE | 
| 25 | #define DISABLE_PSI_SOCKET | 
| 26 | #define DISABLE_PSI_STAGE | 
| 27 | #define DISABLE_PSI_STATEMENT | 
| 28 | #define DISABLE_PSI_IDLE | 
| 29 | #define DISABLE_PSI_STATEMENT_DIGEST | 
| 30 | #endif /* EMBEDDED_LIBRARY */ | 
| 31 |  | 
| 32 | #ifndef MY_GLOBAL_INCLUDED | 
| 33 | /* | 
| 34 |   Make sure a .c or .cc file contains an include to my_global.h first. | 
| 35 |   When this include is missing, all the #ifdef HAVE_XXX have no effect, | 
| 36 |   and the resulting binary won't build, or won't link, | 
| 37 |   or will crash at runtime | 
| 38 |   since various structures will have different binary definitions. | 
| 39 | */ | 
| 40 | #error "You must include my_global.h in the code for the build to be correct." | 
| 41 | #endif | 
| 42 |  | 
| 43 | /* | 
| 44 |   If PSI_ON_BY_DFAULT is defined, assume PSI will be enabled by default and | 
| 45 |   optimize jumps testing for PSI this case. If not, optimize the binary for | 
| 46 |   that PSI is not enabled | 
| 47 | */ | 
| 48 |  | 
| 49 | #ifdef PSI_ON_BY_DEFAULT | 
| 50 | #define psi_likely(A) likely(A) | 
| 51 | #define psi_unlikely(A) unlikely(A) | 
| 52 | #else | 
| 53 | #define psi_likely(A) unlikely(A) | 
| 54 | #define psi_unlikely(A) likely(A) | 
| 55 | #endif | 
| 56 |  | 
| 57 |  | 
| 58 | C_MODE_START | 
| 59 |  | 
| 60 | struct TABLE_SHARE; | 
| 61 |  | 
| 62 | struct sql_digest_storage; | 
| 63 |  | 
| 64 | /** | 
| 65 |   @file mysql/psi/psi.h | 
| 66 |   Performance schema instrumentation interface. | 
| 67 |  | 
| 68 |   @defgroup Instrumentation_interface Instrumentation Interface | 
| 69 |   @ingroup Performance_schema | 
| 70 |   @{ | 
| 71 | */ | 
| 72 |  | 
| 73 | /** | 
| 74 |   Interface for an instrumented mutex. | 
| 75 |   This is an opaque structure. | 
| 76 | */ | 
| 77 | struct PSI_mutex; | 
| 78 | typedef struct PSI_mutex PSI_mutex; | 
| 79 |  | 
| 80 | /** | 
| 81 |   Interface for an instrumented rwlock. | 
| 82 |   This is an opaque structure. | 
| 83 | */ | 
| 84 | struct PSI_rwlock; | 
| 85 | typedef struct PSI_rwlock PSI_rwlock; | 
| 86 |  | 
| 87 | /** | 
| 88 |   Interface for an instrumented condition. | 
| 89 |   This is an opaque structure. | 
| 90 | */ | 
| 91 | struct PSI_cond; | 
| 92 | typedef struct PSI_cond PSI_cond; | 
| 93 |  | 
| 94 | /** | 
| 95 |   Interface for an instrumented table share. | 
| 96 |   This is an opaque structure. | 
| 97 | */ | 
| 98 | struct PSI_table_share; | 
| 99 | typedef struct PSI_table_share PSI_table_share; | 
| 100 |  | 
| 101 | /** | 
| 102 |   Interface for an instrumented table handle. | 
| 103 |   This is an opaque structure. | 
| 104 | */ | 
| 105 | struct PSI_table; | 
| 106 | typedef struct PSI_table PSI_table; | 
| 107 |  | 
| 108 | /** | 
| 109 |   Interface for an instrumented thread. | 
| 110 |   This is an opaque structure. | 
| 111 | */ | 
| 112 | struct PSI_thread; | 
| 113 | typedef struct PSI_thread PSI_thread; | 
| 114 |  | 
| 115 | /** | 
| 116 |   Interface for an instrumented file handle. | 
| 117 |   This is an opaque structure. | 
| 118 | */ | 
| 119 | struct PSI_file; | 
| 120 | typedef struct PSI_file PSI_file; | 
| 121 |  | 
| 122 | /** | 
| 123 |   Interface for an instrumented socket descriptor. | 
| 124 |   This is an opaque structure. | 
| 125 | */ | 
| 126 | struct PSI_socket; | 
| 127 | typedef struct PSI_socket PSI_socket; | 
| 128 |  | 
| 129 | /** | 
| 130 |   Interface for an instrumented table operation. | 
| 131 |   This is an opaque structure. | 
| 132 | */ | 
| 133 | struct PSI_table_locker; | 
| 134 | typedef struct PSI_table_locker PSI_table_locker; | 
| 135 |  | 
| 136 | /** | 
| 137 |   Interface for an instrumented statement. | 
| 138 |   This is an opaque structure. | 
| 139 | */ | 
| 140 | struct PSI_statement_locker; | 
| 141 | typedef struct PSI_statement_locker PSI_statement_locker; | 
| 142 |  | 
| 143 | /** | 
| 144 |   Interface for an instrumented idle operation. | 
| 145 |   This is an opaque structure. | 
| 146 | */ | 
| 147 | struct PSI_idle_locker; | 
| 148 | typedef struct PSI_idle_locker PSI_idle_locker; | 
| 149 |  | 
| 150 | /** | 
| 151 |   Interface for an instrumented statement digest operation. | 
| 152 |   This is an opaque structure. | 
| 153 | */ | 
| 154 | struct PSI_digest_locker; | 
| 155 | typedef struct PSI_digest_locker PSI_digest_locker; | 
| 156 |  | 
| 157 | /** Entry point for the performance schema interface. */ | 
| 158 | struct PSI_bootstrap | 
| 159 | { | 
| 160 |   /** | 
| 161 |     ABI interface finder. | 
| 162 |     Calling this method with an interface version number returns either | 
| 163 |     an instance of the ABI for this version, or NULL. | 
| 164 |     @param version the interface version number to find | 
| 165 |     @return a versioned interface (PSI_v1, PSI_v2 or PSI) | 
| 166 |     @sa PSI_VERSION_1 | 
| 167 |     @sa PSI_v1 | 
| 168 |     @sa PSI_VERSION_2 | 
| 169 |     @sa PSI_v2 | 
| 170 |     @sa PSI_CURRENT_VERSION | 
| 171 |     @sa PSI | 
| 172 |   */ | 
| 173 |   void* (*get_interface)(int version); | 
| 174 | }; | 
| 175 | typedef struct PSI_bootstrap PSI_bootstrap; | 
| 176 |  | 
| 177 | #ifdef HAVE_PSI_INTERFACE | 
| 178 |  | 
| 179 | /** | 
| 180 |   @def DISABLE_PSI_MUTEX | 
| 181 |   Compiling option to disable the mutex instrumentation. | 
| 182 |   This option is mostly intended to be used during development, | 
| 183 |   when doing special builds with only a subset of the performance schema instrumentation, | 
| 184 |   for code analysis / profiling / performance tuning of a specific instrumentation alone. | 
| 185 |   For this reason, DISABLE_PSI_MUTEX is not advertised in the cmake general options. | 
| 186 |   To disable mutexes, add -DDISABLE_PSI_MUTEX to CFLAGS. | 
| 187 |   @sa DISABLE_PSI_RWLOCK | 
| 188 |   @sa DISABLE_PSI_COND | 
| 189 |   @sa DISABLE_PSI_FILE | 
| 190 |   @sa DISABLE_PSI_THREAD | 
| 191 |   @sa DISABLE_PSI_TABLE | 
| 192 |   @sa DISABLE_PSI_STAGE | 
| 193 |   @sa DISABLE_PSI_STATEMENT | 
| 194 |   @sa DISABLE_PSI_SOCKET | 
| 195 |   @sa DISABLE_PSI_IDLE | 
| 196 | */ | 
| 197 |  | 
| 198 | #ifndef DISABLE_PSI_MUTEX | 
| 199 | #define HAVE_PSI_MUTEX_INTERFACE | 
| 200 | #endif | 
| 201 |  | 
| 202 | /** | 
| 203 |   @def DISABLE_PSI_RWLOCK | 
| 204 |   Compiling option to disable the rwlock instrumentation. | 
| 205 |   @sa DISABLE_PSI_MUTEX | 
| 206 | */ | 
| 207 |  | 
| 208 | #ifndef DISABLE_PSI_RWLOCK | 
| 209 | #define HAVE_PSI_RWLOCK_INTERFACE | 
| 210 | #endif | 
| 211 |  | 
| 212 | /** | 
| 213 |   @def DISABLE_PSI_COND | 
| 214 |   Compiling option to disable the cond instrumentation. | 
| 215 |   @sa DISABLE_PSI_MUTEX | 
| 216 | */ | 
| 217 |  | 
| 218 | #ifndef DISABLE_PSI_COND | 
| 219 | #define HAVE_PSI_COND_INTERFACE | 
| 220 | #endif | 
| 221 |  | 
| 222 | /** | 
| 223 |   @def DISABLE_PSI_FILE | 
| 224 |   Compiling option to disable the file instrumentation. | 
| 225 |   @sa DISABLE_PSI_MUTEX | 
| 226 | */ | 
| 227 |  | 
| 228 | #ifndef DISABLE_PSI_FILE | 
| 229 | #define HAVE_PSI_FILE_INTERFACE | 
| 230 | #endif | 
| 231 |  | 
| 232 | /** | 
| 233 |   @def DISABLE_PSI_THREAD | 
| 234 |   Compiling option to disable the thread instrumentation. | 
| 235 |   @sa DISABLE_PSI_MUTEX | 
| 236 | */ | 
| 237 | #ifndef DISABLE_PSI_THREAD | 
| 238 | #define HAVE_PSI_THREAD_INTERFACE | 
| 239 | #endif | 
| 240 |  | 
| 241 | /** | 
| 242 |   @def DISABLE_PSI_TABLE | 
| 243 |   Compiling option to disable the table instrumentation. | 
| 244 |   @sa DISABLE_PSI_MUTEX | 
| 245 | */ | 
| 246 |  | 
| 247 | #ifndef DISABLE_PSI_TABLE | 
| 248 | #define HAVE_PSI_TABLE_INTERFACE | 
| 249 | #endif | 
| 250 |  | 
| 251 | /** | 
| 252 |   @def DISABLE_PSI_STAGE | 
| 253 |   Compiling option to disable the stage instrumentation. | 
| 254 |   @sa DISABLE_PSI_MUTEX | 
| 255 | */ | 
| 256 |  | 
| 257 | #ifndef DISABLE_PSI_STAGE | 
| 258 | #define HAVE_PSI_STAGE_INTERFACE | 
| 259 | #endif | 
| 260 |  | 
| 261 | /** | 
| 262 |   @def DISABLE_PSI_STATEMENT | 
| 263 |   Compiling option to disable the statement instrumentation. | 
| 264 |   @sa DISABLE_PSI_MUTEX | 
| 265 | */ | 
| 266 |  | 
| 267 | #ifndef DISABLE_PSI_STATEMENT | 
| 268 | #define HAVE_PSI_STATEMENT_INTERFACE | 
| 269 | #endif | 
| 270 |  | 
| 271 | /** | 
| 272 |   @def DISABLE_PSI_STATEMENT_DIGEST | 
| 273 |   Compiling option to disable the statement digest instrumentation. | 
| 274 | */ | 
| 275 |  | 
| 276 | #ifndef DISABLE_PSI_STATEMENT | 
| 277 | #ifndef DISABLE_PSI_STATEMENT_DIGEST | 
| 278 | #define HAVE_PSI_STATEMENT_DIGEST_INTERFACE | 
| 279 | #endif | 
| 280 | #endif | 
| 281 |  | 
| 282 | /** | 
| 283 |   @def DISABLE_PSI_SOCKET | 
| 284 |   Compiling option to disable the statement instrumentation. | 
| 285 |   @sa DISABLE_PSI_MUTEX | 
| 286 | */ | 
| 287 |  | 
| 288 | #ifndef DISABLE_PSI_SOCKET | 
| 289 | #define HAVE_PSI_SOCKET_INTERFACE | 
| 290 | #endif | 
| 291 |  | 
| 292 | /** | 
| 293 |   @def DISABLE_PSI_IDLE | 
| 294 |   Compiling option to disable the idle instrumentation. | 
| 295 |   @sa DISABLE_PSI_MUTEX | 
| 296 | */ | 
| 297 |  | 
| 298 | #ifndef DISABLE_PSI_IDLE | 
| 299 | #define HAVE_PSI_IDLE_INTERFACE | 
| 300 | #endif | 
| 301 |  | 
| 302 | /** | 
| 303 |   @def PSI_VERSION_1 | 
| 304 |   Performance Schema Interface number for version 1. | 
| 305 |   This version is supported. | 
| 306 | */ | 
| 307 | #define PSI_VERSION_1 1 | 
| 308 |  | 
| 309 | /** | 
| 310 |   @def PSI_VERSION_2 | 
| 311 |   Performance Schema Interface number for version 2. | 
| 312 |   This version is not implemented, it's a placeholder. | 
| 313 | */ | 
| 314 | #define PSI_VERSION_2 2 | 
| 315 |  | 
| 316 | /** | 
| 317 |   @def PSI_CURRENT_VERSION | 
| 318 |   Performance Schema Interface number for the most recent version. | 
| 319 |   The most current version is @c PSI_VERSION_1 | 
| 320 | */ | 
| 321 | #define PSI_CURRENT_VERSION 1 | 
| 322 |  | 
| 323 | #ifndef USE_PSI_2 | 
| 324 | #ifndef USE_PSI_1 | 
| 325 | #define USE_PSI_1 | 
| 326 | #endif | 
| 327 | #endif | 
| 328 |  | 
| 329 | /** | 
| 330 |   Interface for an instrumented mutex operation. | 
| 331 |   This is an opaque structure. | 
| 332 | */ | 
| 333 | struct PSI_mutex_locker; | 
| 334 | typedef struct PSI_mutex_locker PSI_mutex_locker; | 
| 335 |  | 
| 336 | /** | 
| 337 |   Interface for an instrumented rwlock operation. | 
| 338 |   This is an opaque structure. | 
| 339 | */ | 
| 340 | struct PSI_rwlock_locker; | 
| 341 | typedef struct PSI_rwlock_locker PSI_rwlock_locker; | 
| 342 |  | 
| 343 | /** | 
| 344 |   Interface for an instrumented condition operation. | 
| 345 |   This is an opaque structure. | 
| 346 | */ | 
| 347 | struct PSI_cond_locker; | 
| 348 | typedef struct PSI_cond_locker PSI_cond_locker; | 
| 349 |  | 
| 350 | /** | 
| 351 |   Interface for an instrumented file operation. | 
| 352 |   This is an opaque structure. | 
| 353 | */ | 
| 354 | struct PSI_file_locker; | 
| 355 | typedef struct PSI_file_locker PSI_file_locker; | 
| 356 |  | 
| 357 | /** | 
| 358 |   Interface for an instrumented socket operation. | 
| 359 |   This is an opaque structure. | 
| 360 | */ | 
| 361 | struct PSI_socket_locker; | 
| 362 | typedef struct PSI_socket_locker PSI_socket_locker; | 
| 363 |  | 
| 364 | /** Operation performed on an instrumented mutex. */ | 
| 365 | enum PSI_mutex_operation | 
| 366 | { | 
| 367 |   /** Lock. */ | 
| 368 |   PSI_MUTEX_LOCK= 0, | 
| 369 |   /** Lock attempt. */ | 
| 370 |   PSI_MUTEX_TRYLOCK= 1 | 
| 371 | }; | 
| 372 | typedef enum PSI_mutex_operation PSI_mutex_operation; | 
| 373 |  | 
| 374 | /** Operation performed on an instrumented rwlock. */ | 
| 375 | enum PSI_rwlock_operation | 
| 376 | { | 
| 377 |   /** Read lock. */ | 
| 378 |   PSI_RWLOCK_READLOCK= 0, | 
| 379 |   /** Write lock. */ | 
| 380 |   PSI_RWLOCK_WRITELOCK= 1, | 
| 381 |   /** Read lock attempt. */ | 
| 382 |   PSI_RWLOCK_TRYREADLOCK= 2, | 
| 383 |   /** Write lock attempt. */ | 
| 384 |   PSI_RWLOCK_TRYWRITELOCK= 3 | 
| 385 | }; | 
| 386 | typedef enum PSI_rwlock_operation PSI_rwlock_operation; | 
| 387 |  | 
| 388 | /** Operation performed on an instrumented condition. */ | 
| 389 | enum PSI_cond_operation | 
| 390 | { | 
| 391 |   /** Wait. */ | 
| 392 |   PSI_COND_WAIT= 0, | 
| 393 |   /** Wait, with timeout. */ | 
| 394 |   PSI_COND_TIMEDWAIT= 1 | 
| 395 | }; | 
| 396 | typedef enum PSI_cond_operation PSI_cond_operation; | 
| 397 |  | 
| 398 | /** Operation performed on an instrumented file. */ | 
| 399 | enum PSI_file_operation | 
| 400 | { | 
| 401 |   /** File creation, as in @c create(). */ | 
| 402 |   PSI_FILE_CREATE= 0, | 
| 403 |   /** Temporary file creation, as in @c create_temp_file(). */ | 
| 404 |   PSI_FILE_CREATE_TMP= 1, | 
| 405 |   /** File open, as in @c open(). */ | 
| 406 |   PSI_FILE_OPEN= 2, | 
| 407 |   /** File open, as in @c fopen(). */ | 
| 408 |   PSI_FILE_STREAM_OPEN= 3, | 
| 409 |   /** File close, as in @c close(). */ | 
| 410 |   PSI_FILE_CLOSE= 4, | 
| 411 |   /** File close, as in @c fclose(). */ | 
| 412 |   PSI_FILE_STREAM_CLOSE= 5, | 
| 413 |   /** | 
| 414 |     Generic file read, such as @c fgets(), @c fgetc(), @c fread(), @c read(), | 
| 415 |     @c pread(). | 
| 416 |   */ | 
| 417 |   PSI_FILE_READ= 6, | 
| 418 |   /** | 
| 419 |     Generic file write, such as @c fputs(), @c fputc(), @c fprintf(), | 
| 420 |     @c vfprintf(), @c fwrite(), @c write(), @c pwrite(). | 
| 421 |   */ | 
| 422 |   PSI_FILE_WRITE= 7, | 
| 423 |   /** Generic file seek, such as @c fseek() or @c seek(). */ | 
| 424 |   PSI_FILE_SEEK= 8, | 
| 425 |   /** Generic file tell, such as @c ftell() or @c tell(). */ | 
| 426 |   PSI_FILE_TELL= 9, | 
| 427 |   /** File flush, as in @c fflush(). */ | 
| 428 |   PSI_FILE_FLUSH= 10, | 
| 429 |   /** File stat, as in @c stat(). */ | 
| 430 |   PSI_FILE_STAT= 11, | 
| 431 |   /** File stat, as in @c fstat(). */ | 
| 432 |   PSI_FILE_FSTAT= 12, | 
| 433 |   /** File chsize, as in @c my_chsize(). */ | 
| 434 |   PSI_FILE_CHSIZE= 13, | 
| 435 |   /** File delete, such as @c my_delete() or @c my_handler_delete_with_symlink(). */ | 
| 436 |   PSI_FILE_DELETE= 14, | 
| 437 |   /** File rename, such as @c my_rename() or @c my_rename_with_symlink(). */ | 
| 438 |   PSI_FILE_RENAME= 15, | 
| 439 |   /** File sync, as in @c fsync() or @c my_sync(). */ | 
| 440 |   PSI_FILE_SYNC= 16 | 
| 441 | }; | 
| 442 | typedef enum PSI_file_operation PSI_file_operation; | 
| 443 |  | 
| 444 | /** IO operation performed on an instrumented table. */ | 
| 445 | enum PSI_table_io_operation | 
| 446 | { | 
| 447 |   /** Row fetch. */ | 
| 448 |   PSI_TABLE_FETCH_ROW= 0, | 
| 449 |   /** Row write. */ | 
| 450 |   PSI_TABLE_WRITE_ROW= 1, | 
| 451 |   /** Row update. */ | 
| 452 |   PSI_TABLE_UPDATE_ROW= 2, | 
| 453 |   /** Row delete. */ | 
| 454 |   PSI_TABLE_DELETE_ROW= 3 | 
| 455 | }; | 
| 456 | typedef enum PSI_table_io_operation PSI_table_io_operation; | 
| 457 |  | 
| 458 | /** Lock operation performed on an instrumented table. */ | 
| 459 | enum PSI_table_lock_operation | 
| 460 | { | 
| 461 |   /** Table lock, in the server layer. */ | 
| 462 |   PSI_TABLE_LOCK= 0, | 
| 463 |   /** Table lock, in the storage engine layer. */ | 
| 464 |   PSI_TABLE_EXTERNAL_LOCK= 1 | 
| 465 | }; | 
| 466 | typedef enum PSI_table_lock_operation PSI_table_lock_operation; | 
| 467 |  | 
| 468 | /** State of an instrumented socket. */ | 
| 469 | enum PSI_socket_state | 
| 470 | { | 
| 471 |   /** Idle, waiting for the next command. */ | 
| 472 |   PSI_SOCKET_STATE_IDLE= 1, | 
| 473 |   /** Active, executing a command. */ | 
| 474 |   PSI_SOCKET_STATE_ACTIVE= 2 | 
| 475 | }; | 
| 476 | typedef enum PSI_socket_state PSI_socket_state; | 
| 477 |  | 
| 478 | /** Operation performed on an instrumented socket. */ | 
| 479 | enum PSI_socket_operation | 
| 480 | { | 
| 481 |   /** Socket creation, as in @c socket() or @c socketpair(). */ | 
| 482 |   PSI_SOCKET_CREATE= 0, | 
| 483 |   /** Socket connection, as in @c connect(), @c listen() and @c accept(). */ | 
| 484 |   PSI_SOCKET_CONNECT= 1, | 
| 485 |   /** Socket bind, as in @c bind(), @c getsockname() and @c getpeername(). */ | 
| 486 |   PSI_SOCKET_BIND= 2, | 
| 487 |   /** Socket close, as in @c shutdown(). */ | 
| 488 |   PSI_SOCKET_CLOSE= 3, | 
| 489 |   /** Socket send, @c send(). */ | 
| 490 |   PSI_SOCKET_SEND= 4, | 
| 491 |   /** Socket receive, @c recv(). */ | 
| 492 |   PSI_SOCKET_RECV= 5, | 
| 493 |   /** Socket send, @c sendto(). */ | 
| 494 |   PSI_SOCKET_SENDTO= 6, | 
| 495 |   /** Socket receive, @c recvfrom). */ | 
| 496 |   PSI_SOCKET_RECVFROM= 7, | 
| 497 |   /** Socket send, @c sendmsg(). */ | 
| 498 |   PSI_SOCKET_SENDMSG= 8, | 
| 499 |   /** Socket receive, @c recvmsg(). */ | 
| 500 |   PSI_SOCKET_RECVMSG= 9, | 
| 501 |   /** Socket seek, such as @c fseek() or @c seek(). */ | 
| 502 |   PSI_SOCKET_SEEK= 10, | 
| 503 |   /** Socket options, as in @c getsockopt() and @c setsockopt(). */ | 
| 504 |   PSI_SOCKET_OPT= 11, | 
| 505 |   /** Socket status, as in @c sockatmark() and @c isfdtype(). */ | 
| 506 |   PSI_SOCKET_STAT= 12, | 
| 507 |   /** Socket shutdown, as in @c shutdown(). */ | 
| 508 |   PSI_SOCKET_SHUTDOWN= 13, | 
| 509 |   /** Socket select, as in @c select() and @c poll(). */ | 
| 510 |   PSI_SOCKET_SELECT= 14 | 
| 511 | }; | 
| 512 | typedef enum PSI_socket_operation PSI_socket_operation; | 
| 513 |  | 
| 514 | /** | 
| 515 |   Instrumented mutex key. | 
| 516 |   To instrument a mutex, a mutex key must be obtained using @c register_mutex. | 
| 517 |   Using a zero key always disable the instrumentation. | 
| 518 | */ | 
| 519 | typedef unsigned int PSI_mutex_key; | 
| 520 |  | 
| 521 | /** | 
| 522 |   Instrumented rwlock key. | 
| 523 |   To instrument a rwlock, a rwlock key must be obtained | 
| 524 |   using @c register_rwlock. | 
| 525 |   Using a zero key always disable the instrumentation. | 
| 526 | */ | 
| 527 | typedef unsigned int PSI_rwlock_key; | 
| 528 |  | 
| 529 | /** | 
| 530 |   Instrumented cond key. | 
| 531 |   To instrument a condition, a condition key must be obtained | 
| 532 |   using @c register_cond. | 
| 533 |   Using a zero key always disable the instrumentation. | 
| 534 | */ | 
| 535 | typedef unsigned int PSI_cond_key; | 
| 536 |  | 
| 537 | /** | 
| 538 |   Instrumented thread key. | 
| 539 |   To instrument a thread, a thread key must be obtained | 
| 540 |   using @c register_thread. | 
| 541 |   Using a zero key always disable the instrumentation. | 
| 542 | */ | 
| 543 | typedef unsigned int PSI_thread_key; | 
| 544 |  | 
| 545 | /** | 
| 546 |   Instrumented file key. | 
| 547 |   To instrument a file, a file key must be obtained using @c register_file. | 
| 548 |   Using a zero key always disable the instrumentation. | 
| 549 | */ | 
| 550 | typedef unsigned int PSI_file_key; | 
| 551 |  | 
| 552 | /** | 
| 553 |   Instrumented stage key. | 
| 554 |   To instrument a stage, a stage key must be obtained using @c register_stage. | 
| 555 |   Using a zero key always disable the instrumentation. | 
| 556 | */ | 
| 557 | typedef unsigned int PSI_stage_key; | 
| 558 |  | 
| 559 | /** | 
| 560 |   Instrumented statement key. | 
| 561 |   To instrument a statement, a statement key must be obtained using @c register_statement. | 
| 562 |   Using a zero key always disable the instrumentation. | 
| 563 | */ | 
| 564 | typedef unsigned int PSI_statement_key; | 
| 565 |  | 
| 566 | /** | 
| 567 |   Instrumented socket key. | 
| 568 |   To instrument a socket, a socket key must be obtained using @c register_socket. | 
| 569 |   Using a zero key always disable the instrumentation. | 
| 570 | */ | 
| 571 | typedef unsigned int PSI_socket_key; | 
| 572 |  | 
| 573 | /** | 
| 574 |   @def USE_PSI_1 | 
| 575 |   Define USE_PSI_1 to use the interface version 1. | 
| 576 | */ | 
| 577 |  | 
| 578 | /** | 
| 579 |   @def USE_PSI_2 | 
| 580 |   Define USE_PSI_2 to use the interface version 2. | 
| 581 | */ | 
| 582 |  | 
| 583 | /** | 
| 584 |   @def HAVE_PSI_1 | 
| 585 |   Define HAVE_PSI_1 if the interface version 1 needs to be compiled in. | 
| 586 | */ | 
| 587 |  | 
| 588 | /** | 
| 589 |   @def HAVE_PSI_2 | 
| 590 |   Define HAVE_PSI_2 if the interface version 2 needs to be compiled in. | 
| 591 | */ | 
| 592 |  | 
| 593 | /** | 
| 594 |   Global flag. | 
| 595 |   This flag indicate that an instrumentation point is a global variable, | 
| 596 |   or a singleton. | 
| 597 | */ | 
| 598 | #define PSI_FLAG_GLOBAL (1 << 0) | 
| 599 |  | 
| 600 | /** | 
| 601 |   Global flag. | 
| 602 |   This flag indicate that an instrumentation point is a general placeholder, | 
| 603 |   that can mutate into a more specific instrumentation point. | 
| 604 | */ | 
| 605 | #define PSI_FLAG_MUTABLE (1 << 1) | 
| 606 |  | 
| 607 | #ifdef USE_PSI_1 | 
| 608 | #define HAVE_PSI_1 | 
| 609 | #endif | 
| 610 |  | 
| 611 | #ifdef HAVE_PSI_1 | 
| 612 |  | 
| 613 | /** | 
| 614 |   @defgroup Group_PSI_v1 Application Binary Interface, version 1 | 
| 615 |   @ingroup Instrumentation_interface | 
| 616 |   @{ | 
| 617 | */ | 
| 618 |  | 
| 619 | /** | 
| 620 |   Mutex information. | 
| 621 |   @since PSI_VERSION_1 | 
| 622 |   This structure is used to register an instrumented mutex. | 
| 623 | */ | 
| 624 | struct PSI_mutex_info_v1 | 
| 625 | { | 
| 626 |   /** | 
| 627 |     Pointer to the key assigned to the registered mutex. | 
| 628 |   */ | 
| 629 |   PSI_mutex_key *m_key; | 
| 630 |   /** | 
| 631 |     The name of the mutex to register. | 
| 632 |   */ | 
| 633 |   const char *m_name; | 
| 634 |   /** | 
| 635 |     The flags of the mutex to register. | 
| 636 |     @sa PSI_FLAG_GLOBAL | 
| 637 |   */ | 
| 638 |   int m_flags; | 
| 639 | }; | 
| 640 |  | 
| 641 | /** | 
| 642 |   Rwlock information. | 
| 643 |   @since PSI_VERSION_1 | 
| 644 |   This structure is used to register an instrumented rwlock. | 
| 645 | */ | 
| 646 | struct PSI_rwlock_info_v1 | 
| 647 | { | 
| 648 |   /** | 
| 649 |     Pointer to the key assigned to the registered rwlock. | 
| 650 |   */ | 
| 651 |   PSI_rwlock_key *m_key; | 
| 652 |   /** | 
| 653 |     The name of the rwlock to register. | 
| 654 |   */ | 
| 655 |   const char *m_name; | 
| 656 |   /** | 
| 657 |     The flags of the rwlock to register. | 
| 658 |     @sa PSI_FLAG_GLOBAL | 
| 659 |   */ | 
| 660 |   int m_flags; | 
| 661 | }; | 
| 662 |  | 
| 663 | /** | 
| 664 |   Condition information. | 
| 665 |   @since PSI_VERSION_1 | 
| 666 |   This structure is used to register an instrumented cond. | 
| 667 | */ | 
| 668 | struct PSI_cond_info_v1 | 
| 669 | { | 
| 670 |   /** | 
| 671 |     Pointer to the key assigned to the registered cond. | 
| 672 |   */ | 
| 673 |   PSI_cond_key *m_key; | 
| 674 |   /** | 
| 675 |     The name of the cond to register. | 
| 676 |   */ | 
| 677 |   const char *m_name; | 
| 678 |   /** | 
| 679 |     The flags of the cond to register. | 
| 680 |     @sa PSI_FLAG_GLOBAL | 
| 681 |   */ | 
| 682 |   int m_flags; | 
| 683 | }; | 
| 684 |  | 
| 685 | /** | 
| 686 |   Thread instrument information. | 
| 687 |   @since PSI_VERSION_1 | 
| 688 |   This structure is used to register an instrumented thread. | 
| 689 | */ | 
| 690 | struct PSI_thread_info_v1 | 
| 691 | { | 
| 692 |   /** | 
| 693 |     Pointer to the key assigned to the registered thread. | 
| 694 |   */ | 
| 695 |   PSI_thread_key *m_key; | 
| 696 |   /** | 
| 697 |     The name of the thread instrument to register. | 
| 698 |   */ | 
| 699 |   const char *m_name; | 
| 700 |   /** | 
| 701 |     The flags of the thread to register. | 
| 702 |     @sa PSI_FLAG_GLOBAL | 
| 703 |   */ | 
| 704 |   int m_flags; | 
| 705 | }; | 
| 706 |  | 
| 707 | /** | 
| 708 |   File instrument information. | 
| 709 |   @since PSI_VERSION_1 | 
| 710 |   This structure is used to register an instrumented file. | 
| 711 | */ | 
| 712 | struct PSI_file_info_v1 | 
| 713 | { | 
| 714 |   /** | 
| 715 |     Pointer to the key assigned to the registered file. | 
| 716 |   */ | 
| 717 |   PSI_file_key *m_key; | 
| 718 |   /** | 
| 719 |     The name of the file instrument to register. | 
| 720 |   */ | 
| 721 |   const char *m_name; | 
| 722 |   /** | 
| 723 |     The flags of the file instrument to register. | 
| 724 |     @sa PSI_FLAG_GLOBAL | 
| 725 |   */ | 
| 726 |   int m_flags; | 
| 727 | }; | 
| 728 |  | 
| 729 | /** | 
| 730 |   Stage instrument information. | 
| 731 |   @since PSI_VERSION_1 | 
| 732 |   This structure is used to register an instrumented stage. | 
| 733 | */ | 
| 734 | struct PSI_stage_info_v1 | 
| 735 | { | 
| 736 |   /** The registered stage key. */ | 
| 737 |   PSI_stage_key m_key; | 
| 738 |   /** The name of the stage instrument to register. */ | 
| 739 |   const char *m_name; | 
| 740 |   /** The flags of the stage instrument to register. */ | 
| 741 |   int m_flags; | 
| 742 | }; | 
| 743 |  | 
| 744 | /** | 
| 745 |   Statement instrument information. | 
| 746 |   @since PSI_VERSION_1 | 
| 747 |   This structure is used to register an instrumented statement. | 
| 748 | */ | 
| 749 | struct PSI_statement_info_v1 | 
| 750 | { | 
| 751 |   /** The registered statement key. */ | 
| 752 |   PSI_statement_key m_key; | 
| 753 |   /** The name of the statement instrument to register. */ | 
| 754 |   const char *m_name; | 
| 755 |   /** The flags of the statement instrument to register. */ | 
| 756 |   int m_flags; | 
| 757 | }; | 
| 758 |  | 
| 759 | /** | 
| 760 |   Socket instrument information. | 
| 761 |   @since PSI_VERSION_1 | 
| 762 |   This structure is used to register an instrumented socket. | 
| 763 | */ | 
| 764 | struct PSI_socket_info_v1 | 
| 765 | { | 
| 766 |   /** | 
| 767 |     Pointer to the key assigned to the registered socket. | 
| 768 |   */ | 
| 769 |   PSI_socket_key *m_key; | 
| 770 |   /** | 
| 771 |     The name of the socket instrument to register. | 
| 772 |   */ | 
| 773 |   const char *m_name; | 
| 774 |   /** | 
| 775 |     The flags of the socket instrument to register. | 
| 776 |     @sa PSI_FLAG_GLOBAL | 
| 777 |   */ | 
| 778 |   int m_flags; | 
| 779 | }; | 
| 780 |  | 
| 781 | /** | 
| 782 |   State data storage for @c start_idle_wait_v1_t. | 
| 783 |   This structure provide temporary storage to an idle locker. | 
| 784 |   The content of this structure is considered opaque, | 
| 785 |   the fields are only hints of what an implementation | 
| 786 |   of the psi interface can use. | 
| 787 |   This memory is provided by the instrumented code for performance reasons. | 
| 788 |   @sa start_idle_wait_v1_t. | 
| 789 | */ | 
| 790 | struct PSI_idle_locker_state_v1 | 
| 791 | { | 
| 792 |   /** Internal state. */ | 
| 793 |   uint m_flags; | 
| 794 |   /** Current thread. */ | 
| 795 |   struct PSI_thread *m_thread; | 
| 796 |   /** Timer start. */ | 
| 797 |   ulonglong m_timer_start; | 
| 798 |   /** Timer function. */ | 
| 799 |   ulonglong (*m_timer)(void); | 
| 800 |   /** Internal data. */ | 
| 801 |   void *m_wait; | 
| 802 | }; | 
| 803 |  | 
| 804 | /** | 
| 805 |   State data storage for @c start_mutex_wait_v1_t. | 
| 806 |   This structure provide temporary storage to a mutex locker. | 
| 807 |   The content of this structure is considered opaque, | 
| 808 |   the fields are only hints of what an implementation | 
| 809 |   of the psi interface can use. | 
| 810 |   This memory is provided by the instrumented code for performance reasons. | 
| 811 |   @sa start_mutex_wait_v1_t | 
| 812 | */ | 
| 813 | struct PSI_mutex_locker_state_v1 | 
| 814 | { | 
| 815 |   /** Internal state. */ | 
| 816 |   uint m_flags; | 
| 817 |   /** Current operation. */ | 
| 818 |   enum PSI_mutex_operation m_operation; | 
| 819 |   /** Current mutex. */ | 
| 820 |   struct PSI_mutex *m_mutex; | 
| 821 |   /** Current thread. */ | 
| 822 |   struct PSI_thread *m_thread; | 
| 823 |   /** Timer start. */ | 
| 824 |   ulonglong m_timer_start; | 
| 825 |   /** Timer function. */ | 
| 826 |   ulonglong (*m_timer)(void); | 
| 827 |   /** Internal data. */ | 
| 828 |   void *m_wait; | 
| 829 | }; | 
| 830 |  | 
| 831 | /** | 
| 832 |   State data storage for @c start_rwlock_rdwait_v1_t, @c start_rwlock_wrwait_v1_t. | 
| 833 |   This structure provide temporary storage to a rwlock locker. | 
| 834 |   The content of this structure is considered opaque, | 
| 835 |   the fields are only hints of what an implementation | 
| 836 |   of the psi interface can use. | 
| 837 |   This memory is provided by the instrumented code for performance reasons. | 
| 838 |   @sa start_rwlock_rdwait_v1_t | 
| 839 |   @sa start_rwlock_wrwait_v1_t | 
| 840 | */ | 
| 841 | struct PSI_rwlock_locker_state_v1 | 
| 842 | { | 
| 843 |   /** Internal state. */ | 
| 844 |   uint m_flags; | 
| 845 |   /** Current operation. */ | 
| 846 |   enum PSI_rwlock_operation m_operation; | 
| 847 |   /** Current rwlock. */ | 
| 848 |   struct PSI_rwlock *m_rwlock; | 
| 849 |   /** Current thread. */ | 
| 850 |   struct PSI_thread *m_thread; | 
| 851 |   /** Timer start. */ | 
| 852 |   ulonglong m_timer_start; | 
| 853 |   /** Timer function. */ | 
| 854 |   ulonglong (*m_timer)(void); | 
| 855 |   /** Internal data. */ | 
| 856 |   void *m_wait; | 
| 857 | }; | 
| 858 |  | 
| 859 | /** | 
| 860 |   State data storage for @c start_cond_wait_v1_t. | 
| 861 |   This structure provide temporary storage to a condition locker. | 
| 862 |   The content of this structure is considered opaque, | 
| 863 |   the fields are only hints of what an implementation | 
| 864 |   of the psi interface can use. | 
| 865 |   This memory is provided by the instrumented code for performance reasons. | 
| 866 |   @sa start_cond_wait_v1_t | 
| 867 | */ | 
| 868 | struct PSI_cond_locker_state_v1 | 
| 869 | { | 
| 870 |   /** Internal state. */ | 
| 871 |   uint m_flags; | 
| 872 |   /** Current operation. */ | 
| 873 |   enum PSI_cond_operation m_operation; | 
| 874 |   /** Current condition. */ | 
| 875 |   struct PSI_cond *m_cond; | 
| 876 |   /** Current mutex. */ | 
| 877 |   struct PSI_mutex *m_mutex; | 
| 878 |   /** Current thread. */ | 
| 879 |   struct PSI_thread *m_thread; | 
| 880 |   /** Timer start. */ | 
| 881 |   ulonglong m_timer_start; | 
| 882 |   /** Timer function. */ | 
| 883 |   ulonglong (*m_timer)(void); | 
| 884 |   /** Internal data. */ | 
| 885 |   void *m_wait; | 
| 886 | }; | 
| 887 |  | 
| 888 | /** | 
| 889 |   State data storage for @c get_thread_file_name_locker_v1_t. | 
| 890 |   This structure provide temporary storage to a file locker. | 
| 891 |   The content of this structure is considered opaque, | 
| 892 |   the fields are only hints of what an implementation | 
| 893 |   of the psi interface can use. | 
| 894 |   This memory is provided by the instrumented code for performance reasons. | 
| 895 |   @sa get_thread_file_name_locker_v1_t | 
| 896 |   @sa get_thread_file_stream_locker_v1_t | 
| 897 |   @sa get_thread_file_descriptor_locker_v1_t | 
| 898 | */ | 
| 899 | struct PSI_file_locker_state_v1 | 
| 900 | { | 
| 901 |   /** Internal state. */ | 
| 902 |   uint m_flags; | 
| 903 |   /** Current operation. */ | 
| 904 |   enum PSI_file_operation m_operation; | 
| 905 |   /** Current file. */ | 
| 906 |   struct PSI_file *m_file; | 
| 907 |   /** Current file name. */ | 
| 908 |   const char *m_name; | 
| 909 |   /** Current file class. */ | 
| 910 |   void *m_class; | 
| 911 |   /** Current thread. */ | 
| 912 |   struct PSI_thread *m_thread; | 
| 913 |   /** Operation number of bytes. */ | 
| 914 |   size_t m_number_of_bytes; | 
| 915 |   /** Timer start. */ | 
| 916 |   ulonglong m_timer_start; | 
| 917 |   /** Timer function. */ | 
| 918 |   ulonglong (*m_timer)(void); | 
| 919 |   /** Internal data. */ | 
| 920 |   void *m_wait; | 
| 921 | }; | 
| 922 |  | 
| 923 | /** | 
| 924 |   State data storage for @c start_table_io_wait_v1_t, | 
| 925 |   @c start_table_lock_wait_v1_t. | 
| 926 |   This structure provide temporary storage to a table locker. | 
| 927 |   The content of this structure is considered opaque, | 
| 928 |   the fields are only hints of what an implementation | 
| 929 |   of the psi interface can use. | 
| 930 |   This memory is provided by the instrumented code for performance reasons. | 
| 931 |   @sa start_table_io_wait_v1_t | 
| 932 |   @sa start_table_lock_wait_v1_t | 
| 933 | */ | 
| 934 | struct PSI_table_locker_state_v1 | 
| 935 | { | 
| 936 |   /** Internal state. */ | 
| 937 |   uint m_flags; | 
| 938 |   /** Current io operation. */ | 
| 939 |   enum PSI_table_io_operation m_io_operation; | 
| 940 |   /** Current table handle. */ | 
| 941 |   struct PSI_table *m_table; | 
| 942 |   /** Current table share. */ | 
| 943 |   struct PSI_table_share *m_table_share; | 
| 944 |   /** Current thread. */ | 
| 945 |   struct PSI_thread *m_thread; | 
| 946 |   /** Timer start. */ | 
| 947 |   ulonglong m_timer_start; | 
| 948 |   /** Timer function. */ | 
| 949 |   ulonglong (*m_timer)(void); | 
| 950 |   /** Internal data. */ | 
| 951 |   void *m_wait; | 
| 952 |   /** | 
| 953 |     Implementation specific. | 
| 954 |     For table io, the table io index. | 
| 955 |     For table lock, the lock type. | 
| 956 |   */ | 
| 957 |   uint m_index; | 
| 958 | }; | 
| 959 |  | 
| 960 | /* Duplicate of NAME_LEN, to avoid dependency on mysql_com.h */ | 
| 961 | #define PSI_SCHEMA_NAME_LEN (64 * 3) | 
| 962 |  | 
| 963 | /** | 
| 964 |   State data storage for @c get_thread_statement_locker_v1_t, | 
| 965 |   @c get_thread_statement_locker_v1_t. | 
| 966 |   This structure provide temporary storage to a statement locker. | 
| 967 |   The content of this structure is considered opaque, | 
| 968 |   the fields are only hints of what an implementation | 
| 969 |   of the psi interface can use. | 
| 970 |   This memory is provided by the instrumented code for performance reasons. | 
| 971 |   @sa get_thread_statement_locker_v1_t | 
| 972 | */ | 
| 973 | struct PSI_statement_locker_state_v1 | 
| 974 | { | 
| 975 |   /** Discarded flag. */ | 
| 976 |   my_bool m_discarded; | 
| 977 |   /** Metric, no index used flag. */ | 
| 978 |   uchar m_no_index_used; | 
| 979 |   /** Metric, no good index used flag. */ | 
| 980 |   uchar m_no_good_index_used; | 
| 981 |   /** Internal state. */ | 
| 982 |   uint m_flags; | 
| 983 |   /** Instrumentation class. */ | 
| 984 |   void *m_class; | 
| 985 |   /** Current thread. */ | 
| 986 |   struct PSI_thread *m_thread; | 
| 987 |   /** Timer start. */ | 
| 988 |   ulonglong m_timer_start; | 
| 989 |   /** Timer function. */ | 
| 990 |   ulonglong (*m_timer)(void); | 
| 991 |   /** Internal data. */ | 
| 992 |   void *m_statement; | 
| 993 |   /** Locked time. */ | 
| 994 |   ulonglong m_lock_time; | 
| 995 |   /** Rows sent. */ | 
| 996 |   ulonglong m_rows_sent; | 
| 997 |   /** Rows examined. */ | 
| 998 |   ulonglong m_rows_examined; | 
| 999 |   /** Metric, temporary tables created on disk. */ | 
| 1000 |   ulong m_created_tmp_disk_tables; | 
| 1001 |   /** Metric, temporary tables created. */ | 
| 1002 |   ulong m_created_tmp_tables; | 
| 1003 |   /** Metric, number of select full join. */ | 
| 1004 |   ulong m_select_full_join; | 
| 1005 |   /** Metric, number of select full range join. */ | 
| 1006 |   ulong m_select_full_range_join; | 
| 1007 |   /** Metric, number of select range. */ | 
| 1008 |   ulong m_select_range; | 
| 1009 |   /** Metric, number of select range check. */ | 
| 1010 |   ulong m_select_range_check; | 
| 1011 |   /** Metric, number of select scan. */ | 
| 1012 |   ulong m_select_scan; | 
| 1013 |   /** Metric, number of sort merge passes. */ | 
| 1014 |   ulong m_sort_merge_passes; | 
| 1015 |   /** Metric, number of sort merge. */ | 
| 1016 |   ulong m_sort_range; | 
| 1017 |   /** Metric, number of sort rows. */ | 
| 1018 |   ulong m_sort_rows; | 
| 1019 |   /** Metric, number of sort scans. */ | 
| 1020 |   ulong m_sort_scan; | 
| 1021 |   /** Statement digest. */ | 
| 1022 |   const struct sql_digest_storage *m_digest; | 
| 1023 |   /** Current schema name. */ | 
| 1024 |   char m_schema_name[PSI_SCHEMA_NAME_LEN]; | 
| 1025 |   /** Length in bytes of @c m_schema_name. */ | 
| 1026 |   uint m_schema_name_length; | 
| 1027 |   /** Statement character set number. */ | 
| 1028 |   uint m_cs_number; | 
| 1029 | }; | 
| 1030 |  | 
| 1031 | /** | 
| 1032 |   State data storage for @c start_socket_wait_v1_t. | 
| 1033 |   This structure provide temporary storage to a socket locker. | 
| 1034 |   The content of this structure is considered opaque, | 
| 1035 |   the fields are only hints of what an implementation | 
| 1036 |   of the psi interface can use. | 
| 1037 |   This memory is provided by the instrumented code for performance reasons. | 
| 1038 |   @sa start_socket_wait_v1_t | 
| 1039 | */ | 
| 1040 | struct PSI_socket_locker_state_v1 | 
| 1041 | { | 
| 1042 |   /** Internal state. */ | 
| 1043 |   uint m_flags; | 
| 1044 |   /** Current socket. */ | 
| 1045 |   struct PSI_socket *m_socket; | 
| 1046 |   /** Current thread. */ | 
| 1047 |   struct PSI_thread *m_thread; | 
| 1048 |   /** Operation number of bytes. */ | 
| 1049 |   size_t m_number_of_bytes; | 
| 1050 |   /** Timer start. */ | 
| 1051 |   ulonglong m_timer_start; | 
| 1052 |   /** Timer function. */ | 
| 1053 |   ulonglong (*m_timer)(void); | 
| 1054 |   /** Current operation. */ | 
| 1055 |   enum PSI_socket_operation m_operation; | 
| 1056 |   /** Source file. */ | 
| 1057 |   const char* m_src_file; | 
| 1058 |   /** Source line number. */ | 
| 1059 |   int m_src_line; | 
| 1060 |   /** Internal data. */ | 
| 1061 |   void *m_wait; | 
| 1062 | }; | 
| 1063 |  | 
| 1064 | /* Using typedef to make reuse between PSI_v1 and PSI_v2 easier later. */ | 
| 1065 |  | 
| 1066 | /** | 
| 1067 |   Mutex registration API. | 
| 1068 |   @param category a category name (typically a plugin name) | 
| 1069 |   @param info an array of mutex info to register | 
| 1070 |   @param count the size of the info array | 
| 1071 | */ | 
| 1072 | typedef void (*register_mutex_v1_t) | 
| 1073 |   (const char *category, struct PSI_mutex_info_v1 *info, int count); | 
| 1074 |  | 
| 1075 | /** | 
| 1076 |   Rwlock registration API. | 
| 1077 |   @param category a category name (typically a plugin name) | 
| 1078 |   @param info an array of rwlock info to register | 
| 1079 |   @param count the size of the info array | 
| 1080 | */ | 
| 1081 | typedef void (*register_rwlock_v1_t) | 
| 1082 |   (const char *category, struct PSI_rwlock_info_v1 *info, int count); | 
| 1083 |  | 
| 1084 | /** | 
| 1085 |   Cond registration API. | 
| 1086 |   @param category a category name (typically a plugin name) | 
| 1087 |   @param info an array of cond info to register | 
| 1088 |   @param count the size of the info array | 
| 1089 | */ | 
| 1090 | typedef void (*register_cond_v1_t) | 
| 1091 |   (const char *category, struct PSI_cond_info_v1 *info, int count); | 
| 1092 |  | 
| 1093 | /** | 
| 1094 |   Thread registration API. | 
| 1095 |   @param category a category name (typically a plugin name) | 
| 1096 |   @param info an array of thread info to register | 
| 1097 |   @param count the size of the info array | 
| 1098 | */ | 
| 1099 | typedef void (*register_thread_v1_t) | 
| 1100 |   (const char *category, struct PSI_thread_info_v1 *info, int count); | 
| 1101 |  | 
| 1102 | /** | 
| 1103 |   File registration API. | 
| 1104 |   @param category a category name (typically a plugin name) | 
| 1105 |   @param info an array of file info to register | 
| 1106 |   @param count the size of the info array | 
| 1107 | */ | 
| 1108 | typedef void (*register_file_v1_t) | 
| 1109 |   (const char *category, struct PSI_file_info_v1 *info, int count); | 
| 1110 |  | 
| 1111 | /** | 
| 1112 |   Stage registration API. | 
| 1113 |   @param category a category name | 
| 1114 |   @param info an array of stage info to register | 
| 1115 |   @param count the size of the info array | 
| 1116 | */ | 
| 1117 | typedef void (*register_stage_v1_t) | 
| 1118 |   (const char *category, struct PSI_stage_info_v1 **info, int count); | 
| 1119 |  | 
| 1120 | /** | 
| 1121 |   Statement registration API. | 
| 1122 |   @param category a category name | 
| 1123 |   @param info an array of stage info to register | 
| 1124 |   @param count the size of the info array | 
| 1125 | */ | 
| 1126 | typedef void (*register_statement_v1_t) | 
| 1127 |   (const char *category, struct PSI_statement_info_v1 *info, int count); | 
| 1128 |  | 
| 1129 | /** | 
| 1130 |   Socket registration API. | 
| 1131 |   @param category a category name (typically a plugin name) | 
| 1132 |   @param info an array of socket info to register | 
| 1133 |   @param count the size of the info array | 
| 1134 | */ | 
| 1135 | typedef void (*register_socket_v1_t) | 
| 1136 |   (const char *category, struct PSI_socket_info_v1 *info, int count); | 
| 1137 |  | 
| 1138 | /** | 
| 1139 |   Mutex instrumentation initialisation API. | 
| 1140 |   @param key the registered mutex key | 
| 1141 |   @param identity the address of the mutex itself | 
| 1142 |   @return an instrumented mutex | 
| 1143 | */ | 
| 1144 | typedef struct PSI_mutex* (*init_mutex_v1_t) | 
| 1145 |   (PSI_mutex_key key, const void *identity); | 
| 1146 |  | 
| 1147 | /** | 
| 1148 |   Mutex instrumentation destruction API. | 
| 1149 |   @param mutex the mutex to destroy | 
| 1150 | */ | 
| 1151 | typedef void (*destroy_mutex_v1_t)(struct PSI_mutex *mutex); | 
| 1152 |  | 
| 1153 | /** | 
| 1154 |   Rwlock instrumentation initialisation API. | 
| 1155 |   @param key the registered rwlock key | 
| 1156 |   @param identity the address of the rwlock itself | 
| 1157 |   @return an instrumented rwlock | 
| 1158 | */ | 
| 1159 | typedef struct PSI_rwlock* (*init_rwlock_v1_t) | 
| 1160 |   (PSI_rwlock_key key, const void *identity); | 
| 1161 |  | 
| 1162 | /** | 
| 1163 |   Rwlock instrumentation destruction API. | 
| 1164 |   @param rwlock the rwlock to destroy | 
| 1165 | */ | 
| 1166 | typedef void (*destroy_rwlock_v1_t)(struct PSI_rwlock *rwlock); | 
| 1167 |  | 
| 1168 | /** | 
| 1169 |   Cond instrumentation initialisation API. | 
| 1170 |   @param key the registered key | 
| 1171 |   @param identity the address of the rwlock itself | 
| 1172 |   @return an instrumented cond | 
| 1173 | */ | 
| 1174 | typedef struct PSI_cond* (*init_cond_v1_t) | 
| 1175 |   (PSI_cond_key key, const void *identity); | 
| 1176 |  | 
| 1177 | /** | 
| 1178 |   Cond instrumentation destruction API. | 
| 1179 |   @param cond the rcond to destroy | 
| 1180 | */ | 
| 1181 | typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond); | 
| 1182 |  | 
| 1183 | /** | 
| 1184 |   Socket instrumentation initialisation API. | 
| 1185 |   @param key the registered mutex key | 
| 1186 |   @param socket descriptor | 
| 1187 |   @param addr the socket ip address | 
| 1188 |   @param addr_len length of socket ip address | 
| 1189 |   @return an instrumented socket | 
| 1190 | */ | 
| 1191 | typedef struct PSI_socket* (*init_socket_v1_t) | 
| 1192 |   (PSI_socket_key key, const my_socket *fd, | 
| 1193 |   const struct sockaddr *addr, socklen_t addr_len); | 
| 1194 |  | 
| 1195 | /** | 
| 1196 |   socket instrumentation destruction API. | 
| 1197 |   @param socket the socket to destroy | 
| 1198 | */ | 
| 1199 | typedef void (*destroy_socket_v1_t)(struct PSI_socket *socket); | 
| 1200 |  | 
| 1201 | /** | 
| 1202 |   Acquire a table share instrumentation. | 
| 1203 |   @param temporary True for temporary tables | 
| 1204 |   @param share The SQL layer table share | 
| 1205 |   @return a table share instrumentation, or NULL | 
| 1206 | */ | 
| 1207 | typedef struct PSI_table_share* (*get_table_share_v1_t) | 
| 1208 |   (my_bool temporary, struct TABLE_SHARE *share); | 
| 1209 |  | 
| 1210 | /** | 
| 1211 |   Release a table share. | 
| 1212 |   @param info the table share to release | 
| 1213 | */ | 
| 1214 | typedef void (*release_table_share_v1_t)(struct PSI_table_share *share); | 
| 1215 |  | 
| 1216 | /** | 
| 1217 |   Drop a table share. | 
| 1218 |   @param temporary True for temporary tables | 
| 1219 |   @param schema_name the table schema name | 
| 1220 |   @param schema_name_length the table schema name length | 
| 1221 |   @param table_name the table name | 
| 1222 |   @param table_name_length the table name length | 
| 1223 | */ | 
| 1224 | typedef void (*drop_table_share_v1_t) | 
| 1225 |   (my_bool temporary, const char *schema_name, int schema_name_length, | 
| 1226 |    const char *table_name, int table_name_length); | 
| 1227 |  | 
| 1228 | /** | 
| 1229 |   Open an instrumentation table handle. | 
| 1230 |   @param share the table to open | 
| 1231 |   @param identity table handle identity | 
| 1232 |   @return a table handle, or NULL | 
| 1233 | */ | 
| 1234 | typedef struct PSI_table* (*open_table_v1_t) | 
| 1235 |   (struct PSI_table_share *share, const void *identity); | 
| 1236 |  | 
| 1237 | /** | 
| 1238 |   Unbind a table handle from the current thread. | 
| 1239 |   This operation happens when an opened table is added to the open table cache. | 
| 1240 |   @param table the table to unbind | 
| 1241 | */ | 
| 1242 | typedef void (*unbind_table_v1_t) | 
| 1243 |   (struct PSI_table *table); | 
| 1244 |  | 
| 1245 | /** | 
| 1246 |   Rebind a table handle to the current thread. | 
| 1247 |   This operation happens when a table from the open table cache | 
| 1248 |   is reused for a thread. | 
| 1249 |   @param table the table to unbind | 
| 1250 | */ | 
| 1251 | typedef PSI_table* (*rebind_table_v1_t) | 
| 1252 |   (PSI_table_share *share, const void *identity, PSI_table *table); | 
| 1253 |  | 
| 1254 | /** | 
| 1255 |   Close an instrumentation table handle. | 
| 1256 |   Note that the table handle is invalid after this call. | 
| 1257 |   @param table the table handle to close | 
| 1258 | */ | 
| 1259 | typedef void (*close_table_v1_t)(struct PSI_table *table); | 
| 1260 |  | 
| 1261 | /** | 
| 1262 |   Create a file instrumentation for a created file. | 
| 1263 |   This method does not create the file itself, but is used to notify the | 
| 1264 |   instrumentation interface that a file was just created. | 
| 1265 |   @param key the file instrumentation key for this file | 
| 1266 |   @param name the file name | 
| 1267 |   @param file the file handle | 
| 1268 | */ | 
| 1269 | typedef void (*create_file_v1_t)(PSI_file_key key, const char *name, | 
| 1270 |                                  File file); | 
| 1271 |  | 
| 1272 | /** | 
| 1273 |   Spawn a thread. | 
| 1274 |   This method creates a new thread, with instrumentation. | 
| 1275 |   @param key the instrumentation key for this thread | 
| 1276 |   @param thread the resulting thread | 
| 1277 |   @param attr the thread attributes | 
| 1278 |   @param start_routine the thread start routine | 
| 1279 |   @param arg the thread start routine argument | 
| 1280 | */ | 
| 1281 | typedef int (*spawn_thread_v1_t)(PSI_thread_key key, | 
| 1282 |                                  pthread_t *thread, | 
| 1283 |                                  const pthread_attr_t *attr, | 
| 1284 |                                  void *(*start_routine)(void*), void *arg); | 
| 1285 |  | 
| 1286 | /** | 
| 1287 |   Create instrumentation for a thread. | 
| 1288 |   @param key the registered key | 
| 1289 |   @param identity an address typical of the thread | 
| 1290 |   @return an instrumented thread | 
| 1291 | */ | 
| 1292 | typedef struct PSI_thread* (*new_thread_v1_t) | 
| 1293 |   (PSI_thread_key key, const void *identity, ulonglong thread_id); | 
| 1294 |  | 
| 1295 | /** | 
| 1296 |   Assign an id to an instrumented thread. | 
| 1297 |   @param thread the instrumented thread | 
| 1298 |   @param id the id to assign | 
| 1299 | */ | 
| 1300 | typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread, | 
| 1301 |                                    ulonglong id); | 
| 1302 |  | 
| 1303 | /** | 
| 1304 |   Get the instrumentation for the running thread. | 
| 1305 |   For this function to return a result, | 
| 1306 |   the thread instrumentation must have been attached to the | 
| 1307 |   running thread using @c set_thread() | 
| 1308 |   @return the instrumentation for the running thread | 
| 1309 | */ | 
| 1310 | typedef struct PSI_thread* (*get_thread_v1_t)(void); | 
| 1311 |  | 
| 1312 | /** | 
| 1313 |   Assign a user name to the instrumented thread. | 
| 1314 |   @param user the user name | 
| 1315 |   @param user_len the user name length | 
| 1316 | */ | 
| 1317 | typedef void (*set_thread_user_v1_t)(const char *user, int user_len); | 
| 1318 |  | 
| 1319 | /** | 
| 1320 |   Assign a user name and host name to the instrumented thread. | 
| 1321 |   @param user the user name | 
| 1322 |   @param user_len the user name length | 
| 1323 |   @param host the host name | 
| 1324 |   @param host_len the host name length | 
| 1325 | */ | 
| 1326 | typedef void (*set_thread_user_host_v1_t)(const char *user, int user_len, | 
| 1327 |                                           const char *host, int host_len); | 
| 1328 |  | 
| 1329 | /** | 
| 1330 |   Assign a current database to the instrumented thread. | 
| 1331 |   @param db the database name | 
| 1332 |   @param db_len the database name length | 
| 1333 | */ | 
| 1334 | typedef void (*set_thread_db_v1_t)(const char* db, int db_len); | 
| 1335 |  | 
| 1336 | /** | 
| 1337 |   Assign a current command to the instrumented thread. | 
| 1338 |   @param command the current command | 
| 1339 | */ | 
| 1340 | typedef void (*set_thread_command_v1_t)(int command); | 
| 1341 |  | 
| 1342 | /** | 
| 1343 |   Assign a start time to the instrumented thread. | 
| 1344 |   @param start_time the thread start time | 
| 1345 | */ | 
| 1346 | typedef void (*set_thread_start_time_v1_t)(time_t start_time); | 
| 1347 |  | 
| 1348 | /** | 
| 1349 |   Assign a state to the instrumented thread. | 
| 1350 |   @param state the thread state | 
| 1351 | */ | 
| 1352 | typedef void (*set_thread_state_v1_t)(const char* state); | 
| 1353 |  | 
| 1354 | /** | 
| 1355 |   Assign a process info to the instrumented thread. | 
| 1356 |   @param info the process into string | 
| 1357 |   @param info_len the process into string length | 
| 1358 | */ | 
| 1359 | typedef void (*set_thread_info_v1_t)(const char* info, uint info_len); | 
| 1360 |  | 
| 1361 | /** | 
| 1362 |   Attach a thread instrumentation to the running thread. | 
| 1363 |   In case of thread pools, this method should be called when | 
| 1364 |   a worker thread picks a work item and runs it. | 
| 1365 |   Also, this method should be called if the instrumented code does not | 
| 1366 |   keep the pointer returned by @c new_thread() and relies on @c get_thread() | 
| 1367 |   instead. | 
| 1368 |   @param thread the thread instrumentation | 
| 1369 | */ | 
| 1370 | typedef void (*set_thread_v1_t)(struct PSI_thread *thread); | 
| 1371 |  | 
| 1372 | /** Delete the current thread instrumentation. */ | 
| 1373 | typedef void (*delete_current_thread_v1_t)(void); | 
| 1374 |  | 
| 1375 | /** Delete a thread instrumentation. */ | 
| 1376 | typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); | 
| 1377 |  | 
| 1378 | /** | 
| 1379 |   Get a file instrumentation locker, for opening or creating a file. | 
| 1380 |   @param state data storage for the locker | 
| 1381 |   @param key the file instrumentation key | 
| 1382 |   @param op the operation to perform | 
| 1383 |   @param name the file name | 
| 1384 |   @param identity a pointer representative of this file. | 
| 1385 |   @return a file locker, or NULL | 
| 1386 | */ | 
| 1387 | typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) | 
| 1388 |   (struct PSI_file_locker_state_v1 *state, | 
| 1389 |    PSI_file_key key, enum PSI_file_operation op, const char *name, | 
| 1390 |    const void *identity); | 
| 1391 |  | 
| 1392 | /** | 
| 1393 |   Get a file stream instrumentation locker. | 
| 1394 |   @param state data storage for the locker | 
| 1395 |   @param file the file stream to access | 
| 1396 |   @param op the operation to perform | 
| 1397 |   @return a file locker, or NULL | 
| 1398 | */ | 
| 1399 | typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t) | 
| 1400 |   (struct PSI_file_locker_state_v1 *state, | 
| 1401 |    struct PSI_file *file, enum PSI_file_operation op); | 
| 1402 |  | 
| 1403 | /** | 
| 1404 |   Get a file instrumentation locker. | 
| 1405 |   @param state data storage for the locker | 
| 1406 |   @param file the file descriptor to access | 
| 1407 |   @param op the operation to perform | 
| 1408 |   @return a file locker, or NULL | 
| 1409 | */ | 
| 1410 | typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t) | 
| 1411 |   (struct PSI_file_locker_state_v1 *state, | 
| 1412 |    File file, enum PSI_file_operation op); | 
| 1413 |  | 
| 1414 | /** | 
| 1415 |   Record a mutex instrumentation unlock event. | 
| 1416 |   @param mutex the mutex instrumentation | 
| 1417 | */ | 
| 1418 | typedef void (*unlock_mutex_v1_t) | 
| 1419 |   (struct PSI_mutex *mutex); | 
| 1420 |  | 
| 1421 | /** | 
| 1422 |   Record a rwlock instrumentation unlock event. | 
| 1423 |   @param rwlock the rwlock instrumentation | 
| 1424 | */ | 
| 1425 | typedef void (*unlock_rwlock_v1_t) | 
| 1426 |   (struct PSI_rwlock *rwlock); | 
| 1427 |  | 
| 1428 | /** | 
| 1429 |   Record a condition instrumentation signal event. | 
| 1430 |   @param cond the cond instrumentation | 
| 1431 | */ | 
| 1432 | typedef void (*signal_cond_v1_t) | 
| 1433 |   (struct PSI_cond *cond); | 
| 1434 |  | 
| 1435 | /** | 
| 1436 |   Record a condition instrumentation broadcast event. | 
| 1437 |   @param cond the cond instrumentation | 
| 1438 | */ | 
| 1439 | typedef void (*broadcast_cond_v1_t) | 
| 1440 |   (struct PSI_cond *cond); | 
| 1441 |  | 
| 1442 | typedef struct PSI_idle_locker* (*start_idle_wait_v1_t) | 
| 1443 |   (struct PSI_idle_locker_state_v1 *state, const char *src_file, uint src_line); | 
| 1444 |  | 
| 1445 | typedef void (*end_idle_wait_v1_t) | 
| 1446 |   (struct PSI_idle_locker *locker); | 
| 1447 |  | 
| 1448 | /** | 
| 1449 |   Record a mutex instrumentation wait start event. | 
| 1450 |   @param state data storage for the locker | 
| 1451 |   @param mutex the instrumented mutex to lock | 
| 1452 |   @param op the operation to perform | 
| 1453 |   @param file the source file name | 
| 1454 |   @param line the source line number | 
| 1455 |   @return a mutex locker, or NULL | 
| 1456 | */ | 
| 1457 | typedef struct PSI_mutex_locker* (*start_mutex_wait_v1_t) | 
| 1458 |   (struct PSI_mutex_locker_state_v1 *state, | 
| 1459 |    struct PSI_mutex *mutex, | 
| 1460 |    enum PSI_mutex_operation op, | 
| 1461 |    const char *src_file, uint src_line); | 
| 1462 |  | 
| 1463 | /** | 
| 1464 |   Record a mutex instrumentation wait end event. | 
| 1465 |   @param locker a thread locker for the running thread | 
| 1466 |   @param rc the wait operation return code | 
| 1467 | */ | 
| 1468 | typedef void (*end_mutex_wait_v1_t) | 
| 1469 |   (struct PSI_mutex_locker *locker, int rc); | 
| 1470 |  | 
| 1471 | /** | 
| 1472 |   Record a rwlock instrumentation read wait start event. | 
| 1473 |   @param locker a thread locker for the running thread | 
| 1474 |   @param must must block: 1 for lock, 0 for trylock | 
| 1475 | */ | 
| 1476 | typedef struct PSI_rwlock_locker* (*start_rwlock_rdwait_v1_t) | 
| 1477 |   (struct PSI_rwlock_locker_state_v1 *state, | 
| 1478 |    struct PSI_rwlock *rwlock, | 
| 1479 |    enum PSI_rwlock_operation op, | 
| 1480 |    const char *src_file, uint src_line); | 
| 1481 |  | 
| 1482 | /** | 
| 1483 |   Record a rwlock instrumentation read wait end event. | 
| 1484 |   @param locker a thread locker for the running thread | 
| 1485 |   @param rc the wait operation return code | 
| 1486 | */ | 
| 1487 | typedef void (*end_rwlock_rdwait_v1_t) | 
| 1488 |   (struct PSI_rwlock_locker *locker, int rc); | 
| 1489 |  | 
| 1490 | /** | 
| 1491 |   Record a rwlock instrumentation write wait start event. | 
| 1492 |   @param locker a thread locker for the running thread | 
| 1493 |   @param must must block: 1 for lock, 0 for trylock | 
| 1494 | */ | 
| 1495 | typedef struct PSI_rwlock_locker* (*start_rwlock_wrwait_v1_t) | 
| 1496 |   (struct PSI_rwlock_locker_state_v1 *state, | 
| 1497 |    struct PSI_rwlock *rwlock, | 
| 1498 |    enum PSI_rwlock_operation op, | 
| 1499 |    const char *src_file, uint src_line); | 
| 1500 |  | 
| 1501 | /** | 
| 1502 |   Record a rwlock instrumentation write wait end event. | 
| 1503 |   @param locker a thread locker for the running thread | 
| 1504 |   @param rc the wait operation return code | 
| 1505 | */ | 
| 1506 | typedef void (*end_rwlock_wrwait_v1_t) | 
| 1507 |   (struct PSI_rwlock_locker *locker, int rc); | 
| 1508 |  | 
| 1509 | /** | 
| 1510 |   Record a condition instrumentation wait start event. | 
| 1511 |   @param locker a thread locker for the running thread | 
| 1512 |   @param must must block: 1 for wait, 0 for timedwait | 
| 1513 | */ | 
| 1514 | typedef struct PSI_cond_locker* (*start_cond_wait_v1_t) | 
| 1515 |   (struct PSI_cond_locker_state_v1 *state, | 
| 1516 |    struct PSI_cond *cond, | 
| 1517 |    struct PSI_mutex *mutex, | 
| 1518 |    enum PSI_cond_operation op, | 
| 1519 |    const char *src_file, uint src_line); | 
| 1520 |  | 
| 1521 | /** | 
| 1522 |   Record a condition instrumentation wait end event. | 
| 1523 |   @param locker a thread locker for the running thread | 
| 1524 |   @param rc the wait operation return code | 
| 1525 | */ | 
| 1526 | typedef void (*end_cond_wait_v1_t) | 
| 1527 |   (struct PSI_cond_locker *locker, int rc); | 
| 1528 |  | 
| 1529 | /** | 
| 1530 |   Record a table instrumentation io wait start event. | 
| 1531 |   @param locker a table locker for the running thread | 
| 1532 |   @param file the source file name | 
| 1533 |   @param line the source line number | 
| 1534 | */ | 
| 1535 | typedef struct PSI_table_locker* (*start_table_io_wait_v1_t) | 
| 1536 |   (struct PSI_table_locker_state_v1 *state, | 
| 1537 |    struct PSI_table *table, | 
| 1538 |    enum PSI_table_io_operation op, | 
| 1539 |    uint index, | 
| 1540 |    const char *src_file, uint src_line); | 
| 1541 |  | 
| 1542 | /** | 
| 1543 |   Record a table instrumentation io wait end event. | 
| 1544 |   @param locker a table locker for the running thread | 
| 1545 | */ | 
| 1546 | typedef void (*end_table_io_wait_v1_t)(struct PSI_table_locker *locker); | 
| 1547 |  | 
| 1548 | /** | 
| 1549 |   Record a table instrumentation lock wait start event. | 
| 1550 |   @param locker a table locker for the running thread | 
| 1551 |   @param file the source file name | 
| 1552 |   @param line the source line number | 
| 1553 | */ | 
| 1554 | typedef struct PSI_table_locker* (*start_table_lock_wait_v1_t) | 
| 1555 |   (struct PSI_table_locker_state_v1 *state, | 
| 1556 |    struct PSI_table *table, | 
| 1557 |    enum PSI_table_lock_operation op, | 
| 1558 |    ulong flags, | 
| 1559 |    const char *src_file, uint src_line); | 
| 1560 |  | 
| 1561 | /** | 
| 1562 |   Record a table instrumentation lock wait end event. | 
| 1563 |   @param locker a table locker for the running thread | 
| 1564 | */ | 
| 1565 | typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker); | 
| 1566 |  | 
| 1567 | /** | 
| 1568 |   Start a file instrumentation open operation. | 
| 1569 |   @param locker the file locker | 
| 1570 |   @param op the operation to perform | 
| 1571 |   @param src_file the source file name | 
| 1572 |   @param src_line the source line number | 
| 1573 | */ | 
| 1574 | typedef void (*start_file_open_wait_v1_t) | 
| 1575 |   (struct PSI_file_locker *locker, const char *src_file, uint src_line); | 
| 1576 |  | 
| 1577 | /** | 
| 1578 |   End a file instrumentation open operation, for file streams. | 
| 1579 |   @param locker the file locker. | 
| 1580 |   @param result the opened file (NULL indicates failure, non NULL success). | 
| 1581 |   @return an instrumented file handle | 
| 1582 | */ | 
| 1583 | typedef struct PSI_file* (*end_file_open_wait_v1_t) | 
| 1584 |   (struct PSI_file_locker *locker, void *result); | 
| 1585 |  | 
| 1586 | /** | 
| 1587 |   End a file instrumentation open operation, for non stream files. | 
| 1588 |   @param locker the file locker. | 
| 1589 |   @param file the file number assigned by open() or create() for this file. | 
| 1590 | */ | 
| 1591 | typedef void (*end_file_open_wait_and_bind_to_descriptor_v1_t) | 
| 1592 |   (struct PSI_file_locker *locker, File file); | 
| 1593 |  | 
| 1594 | /** | 
| 1595 |   Record a file instrumentation start event. | 
| 1596 |   @param locker a file locker for the running thread | 
| 1597 |   @param op file operation to be performed | 
| 1598 |   @param count the number of bytes requested, or 0 if not applicable | 
| 1599 |   @param src_file the source file name | 
| 1600 |   @param src_line the source line number | 
| 1601 | */ | 
| 1602 | typedef void (*start_file_wait_v1_t) | 
| 1603 |   (struct PSI_file_locker *locker, size_t count, | 
| 1604 |    const char *src_file, uint src_line); | 
| 1605 |  | 
| 1606 | /** | 
| 1607 |   Record a file instrumentation end event. | 
| 1608 |   Note that for file close operations, the instrumented file handle | 
| 1609 |   associated with the file (which was provided to obtain a locker) | 
| 1610 |   is invalid after this call. | 
| 1611 |   @param locker a file locker for the running thread | 
| 1612 |   @param count the number of bytes actually used in the operation, | 
| 1613 |   or 0 if not applicable, or -1 if the operation failed | 
| 1614 |   @sa get_thread_file_name_locker | 
| 1615 |   @sa get_thread_file_stream_locker | 
| 1616 |   @sa get_thread_file_descriptor_locker | 
| 1617 | */ | 
| 1618 | typedef void (*end_file_wait_v1_t) | 
| 1619 |   (struct PSI_file_locker *locker, size_t count); | 
| 1620 |  | 
| 1621 | /** | 
| 1622 |   Start a file instrumentation close operation. | 
| 1623 |   @param locker the file locker | 
| 1624 |   @param op the operation to perform | 
| 1625 |   @param src_file the source file name | 
| 1626 |   @param src_line the source line number | 
| 1627 | */ | 
| 1628 | typedef void (*start_file_close_wait_v1_t) | 
| 1629 |   (struct PSI_file_locker *locker, const char *src_file, uint src_line); | 
| 1630 |  | 
| 1631 | /** | 
| 1632 |   End a file instrumentation close operation. | 
| 1633 |   @param locker the file locker. | 
| 1634 |   @param rc the close operation return code (0 for success). | 
| 1635 |   @return an instrumented file handle | 
| 1636 | */ | 
| 1637 | typedef void (*end_file_close_wait_v1_t) | 
| 1638 |   (struct PSI_file_locker *locker, int rc); | 
| 1639 |  | 
| 1640 | /** | 
| 1641 |   Start a new stage, and implicitly end the previous stage. | 
| 1642 |   @param key the key of the new stage | 
| 1643 |   @param src_file the source file name | 
| 1644 |   @param src_line the source line number | 
| 1645 | */ | 
| 1646 | typedef void (*start_stage_v1_t) | 
| 1647 |   (PSI_stage_key key, const char *src_file, int src_line); | 
| 1648 |  | 
| 1649 | /** End the current stage. */ | 
| 1650 | typedef void (*end_stage_v1_t) (void); | 
| 1651 |  | 
| 1652 | /** | 
| 1653 |   Get a statement instrumentation locker. | 
| 1654 |   @param state data storage for the locker | 
| 1655 |   @param key the statement instrumentation key | 
| 1656 |   @param charset client character set | 
| 1657 |   @return a statement locker, or NULL | 
| 1658 | */ | 
| 1659 | typedef struct PSI_statement_locker* (*get_thread_statement_locker_v1_t) | 
| 1660 |   (struct PSI_statement_locker_state_v1 *state, | 
| 1661 |    PSI_statement_key key, const void *charset); | 
| 1662 |  | 
| 1663 | /** | 
| 1664 |   Refine a statement locker to a more specific key. | 
| 1665 |   Note that only events declared mutable can be refined. | 
| 1666 |   @param the statement locker for the current event | 
| 1667 |   @param key the new key for the event | 
| 1668 |   @sa PSI_FLAG_MUTABLE | 
| 1669 | */ | 
| 1670 | typedef struct PSI_statement_locker* (*refine_statement_v1_t) | 
| 1671 |   (struct PSI_statement_locker *locker, | 
| 1672 |    PSI_statement_key key); | 
| 1673 |  | 
| 1674 | /** | 
| 1675 |   Start a new statement event. | 
| 1676 |   @param locker the statement locker for this event | 
| 1677 |   @param db the active database name for this statement | 
| 1678 |   @param db_length the active database name length for this statement | 
| 1679 |   @param src_file source file name | 
| 1680 |   @param src_line source line number | 
| 1681 | */ | 
| 1682 | typedef void (*start_statement_v1_t) | 
| 1683 |   (struct PSI_statement_locker *locker, | 
| 1684 |    const char *db, uint db_length, | 
| 1685 |    const char *src_file, uint src_line); | 
| 1686 |  | 
| 1687 | /** | 
| 1688 |   Set the statement text for a statement event. | 
| 1689 |   @param locker the current statement locker | 
| 1690 |   @param text the statement text | 
| 1691 |   @param text_len the statement text length | 
| 1692 | */ | 
| 1693 | typedef void (*set_statement_text_v1_t) | 
| 1694 |   (struct PSI_statement_locker *locker, | 
| 1695 |    const char *text, uint text_len); | 
| 1696 |  | 
| 1697 | /** | 
| 1698 |   Set a statement event lock time. | 
| 1699 |   @param locker the statement locker | 
| 1700 |   @param lock_time the locked time, in microseconds | 
| 1701 | */ | 
| 1702 | typedef void (*set_statement_lock_time_t) | 
| 1703 |   (struct PSI_statement_locker *locker, ulonglong lock_time); | 
| 1704 |  | 
| 1705 | /** | 
| 1706 |   Set a statement event rows sent metric. | 
| 1707 |   @param locker the statement locker | 
| 1708 |   @param count the number of rows sent | 
| 1709 | */ | 
| 1710 | typedef void (*set_statement_rows_sent_t) | 
| 1711 |   (struct PSI_statement_locker *locker, ulonglong count); | 
| 1712 |  | 
| 1713 | /** | 
| 1714 |   Set a statement event rows examined metric. | 
| 1715 |   @param locker the statement locker | 
| 1716 |   @param count the number of rows examined | 
| 1717 | */ | 
| 1718 | typedef void (*set_statement_rows_examined_t) | 
| 1719 |   (struct PSI_statement_locker *locker, ulonglong count); | 
| 1720 |  | 
| 1721 | /** | 
| 1722 |   Increment a statement event "created tmp disk tables" metric. | 
| 1723 |   @param locker the statement locker | 
| 1724 |   @param count the metric increment value | 
| 1725 | */ | 
| 1726 | typedef void (*inc_statement_created_tmp_disk_tables_t) | 
| 1727 |   (struct PSI_statement_locker *locker, ulong count); | 
| 1728 |  | 
| 1729 | /** | 
| 1730 |   Increment a statement event "created tmp tables" metric. | 
| 1731 |   @param locker the statement locker | 
| 1732 |   @param count the metric increment value | 
| 1733 | */ | 
| 1734 | typedef void (*inc_statement_created_tmp_tables_t) | 
| 1735 |   (struct PSI_statement_locker *locker, ulong count); | 
| 1736 |  | 
| 1737 | /** | 
| 1738 |   Increment a statement event "select full join" metric. | 
| 1739 |   @param locker the statement locker | 
| 1740 |   @param count the metric increment value | 
| 1741 | */ | 
| 1742 | typedef void (*inc_statement_select_full_join_t) | 
| 1743 |   (struct PSI_statement_locker *locker, ulong count); | 
| 1744 |  | 
| 1745 | /** | 
| 1746 |   Increment a statement event "select full range join" metric. | 
| 1747 |   @param locker the statement locker | 
| 1748 |   @param count the metric increment value | 
| 1749 | */ | 
| 1750 | typedef void (*inc_statement_select_full_range_join_t) | 
| 1751 |   (struct PSI_statement_locker *locker, ulong count); | 
| 1752 |  | 
| 1753 | /** | 
| 1754 |   Increment a statement event "select range join" metric. | 
| 1755 |   @param locker the statement locker | 
| 1756 |   @param count the metric increment value | 
| 1757 | */ | 
| 1758 | typedef void (*inc_statement_select_range_t) | 
| 1759 |   (struct PSI_statement_locker *locker, ulong count); | 
| 1760 |  | 
| 1761 | /** | 
| 1762 |   Increment a statement event "select range check" metric. | 
| 1763 |   @param locker the statement locker | 
| 1764 |   @param count the metric increment value | 
| 1765 | */ | 
| 1766 | typedef void (*inc_statement_select_range_check_t) | 
| 1767 |   (struct PSI_statement_locker *locker, ulong count); | 
| 1768 |  | 
| 1769 | /** | 
| 1770 |   Increment a statement event "select scan" metric. | 
| 1771 |   @param locker the statement locker | 
| 1772 |   @param count the metric increment value | 
| 1773 | */ | 
| 1774 | typedef void (*inc_statement_select_scan_t) | 
| 1775 |   (struct PSI_statement_locker *locker, ulong count); | 
| 1776 |  | 
| 1777 | /** | 
| 1778 |   Increment a statement event "sort merge passes" metric. | 
| 1779 |   @param locker the statement locker | 
| 1780 |   @param count the metric increment value | 
| 1781 | */ | 
| 1782 | typedef void (*inc_statement_sort_merge_passes_t) | 
| 1783 |   (struct PSI_statement_locker *locker, ulong count); | 
| 1784 |  | 
| 1785 | /** | 
| 1786 |   Increment a statement event "sort range" metric. | 
| 1787 |   @param locker the statement locker | 
| 1788 |   @param count the metric increment value | 
| 1789 | */ | 
| 1790 | typedef void (*inc_statement_sort_range_t) | 
| 1791 |   (struct PSI_statement_locker *locker, ulong count); | 
| 1792 |  | 
| 1793 | /** | 
| 1794 |   Increment a statement event "sort rows" metric. | 
| 1795 |   @param locker the statement locker | 
| 1796 |   @param count the metric increment value | 
| 1797 | */ | 
| 1798 | typedef void (*inc_statement_sort_rows_t) | 
| 1799 |   (struct PSI_statement_locker *locker, ulong count); | 
| 1800 |  | 
| 1801 | /** | 
| 1802 |   Increment a statement event "sort scan" metric. | 
| 1803 |   @param locker the statement locker | 
| 1804 |   @param count the metric increment value | 
| 1805 | */ | 
| 1806 | typedef void (*inc_statement_sort_scan_t) | 
| 1807 |   (struct PSI_statement_locker *locker, ulong count); | 
| 1808 |  | 
| 1809 | /** | 
| 1810 |   Set a statement event "no index used" metric. | 
| 1811 |   @param locker the statement locker | 
| 1812 |   @param count the metric value | 
| 1813 | */ | 
| 1814 | typedef void (*set_statement_no_index_used_t) | 
| 1815 |   (struct PSI_statement_locker *locker); | 
| 1816 |  | 
| 1817 | /** | 
| 1818 |   Set a statement event "no good index used" metric. | 
| 1819 |   @param locker the statement locker | 
| 1820 |   @param count the metric value | 
| 1821 | */ | 
| 1822 | typedef void (*set_statement_no_good_index_used_t) | 
| 1823 |   (struct PSI_statement_locker *locker); | 
| 1824 |  | 
| 1825 | /** | 
| 1826 |   End a statement event. | 
| 1827 |   @param locker the statement locker | 
| 1828 |   @param stmt_da the statement diagnostics area. | 
| 1829 |   @sa Diagnostics_area | 
| 1830 | */ | 
| 1831 | typedef void (*end_statement_v1_t) | 
| 1832 |   (struct PSI_statement_locker *locker, void *stmt_da); | 
| 1833 |  | 
| 1834 | /** | 
| 1835 |   Record a socket instrumentation start event. | 
| 1836 |   @param locker a socket locker for the running thread | 
| 1837 |   @param op socket operation to be performed | 
| 1838 |   @param count the number of bytes requested, or 0 if not applicable | 
| 1839 |   @param src_file the source file name | 
| 1840 |   @param src_line the source line number | 
| 1841 | */ | 
| 1842 | typedef struct PSI_socket_locker* (*start_socket_wait_v1_t) | 
| 1843 |   (struct PSI_socket_locker_state_v1 *state, | 
| 1844 |    struct PSI_socket *socket, | 
| 1845 |    enum PSI_socket_operation op, | 
| 1846 |    size_t count, | 
| 1847 |    const char *src_file, uint src_line); | 
| 1848 |  | 
| 1849 | /** | 
| 1850 |   Record a socket instrumentation end event. | 
| 1851 |   Note that for socket close operations, the instrumented socket handle | 
| 1852 |   associated with the socket (which was provided to obtain a locker) | 
| 1853 |   is invalid after this call. | 
| 1854 |   @param locker a socket locker for the running thread | 
| 1855 |   @param count the number of bytes actually used in the operation, | 
| 1856 |   or 0 if not applicable, or -1 if the operation failed | 
| 1857 |   @sa get_thread_socket_locker | 
| 1858 | */ | 
| 1859 | typedef void (*end_socket_wait_v1_t) | 
| 1860 |   (struct PSI_socket_locker *locker, size_t count); | 
| 1861 |  | 
| 1862 | /** | 
| 1863 |   Set the socket state for an instrumented socket. | 
| 1864 |     @param socket the instrumented socket | 
| 1865 |     @param state socket state | 
| 1866 |   */ | 
| 1867 | typedef void (*set_socket_state_v1_t)(struct PSI_socket *socket, | 
| 1868 |                                       enum PSI_socket_state state); | 
| 1869 |  | 
| 1870 | /** | 
| 1871 |   Set the socket info for an instrumented socket. | 
| 1872 |   @param socket the instrumented socket | 
| 1873 |   @param fd the socket descriptor | 
| 1874 |   @param addr the socket ip address | 
| 1875 |   @param addr_len length of socket ip address | 
| 1876 |   @param thread_id associated thread id | 
| 1877 | */ | 
| 1878 | typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket, | 
| 1879 |                                      const my_socket *fd, | 
| 1880 |                                      const struct sockaddr *addr, | 
| 1881 |                                      socklen_t addr_len); | 
| 1882 |  | 
| 1883 | /** | 
| 1884 |   Bind a socket to the thread that owns it. | 
| 1885 |   @param socket instrumented socket | 
| 1886 | */ | 
| 1887 | typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket); | 
| 1888 |  | 
| 1889 | /** | 
| 1890 |   Get a digest locker for the current statement. | 
| 1891 |   @param locker a statement locker for the running thread | 
| 1892 | */ | 
| 1893 | typedef struct PSI_digest_locker * (*digest_start_v1_t) | 
| 1894 |   (struct PSI_statement_locker *locker); | 
| 1895 |  | 
| 1896 | typedef void (*digest_end_v1_t) | 
| 1897 |   (struct PSI_digest_locker *locker, const struct sql_digest_storage *digest); | 
| 1898 |  | 
| 1899 | /** | 
| 1900 |   Stores an array of connection attributes | 
| 1901 |   @param buffer         char array of length encoded connection attributes | 
| 1902 |                         in network format | 
| 1903 |   @param length         legnth of the data in buffer | 
| 1904 |   @param from_cs        charset in which @buffer is encodded | 
| 1905 |   @return state | 
| 1906 |     @retval  non-0    attributes truncated | 
| 1907 |     @retval  0        stored the attribute | 
| 1908 | */ | 
| 1909 | typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length, | 
| 1910 |                                              const void *from_cs); | 
| 1911 |  | 
| 1912 | /** | 
| 1913 |   Performance Schema Interface, version 1. | 
| 1914 |   @since PSI_VERSION_1 | 
| 1915 | */ | 
| 1916 | struct PSI_v1 | 
| 1917 | { | 
| 1918 |   /** @sa register_mutex_v1_t. */ | 
| 1919 |   register_mutex_v1_t register_mutex; | 
| 1920 |   /** @sa register_rwlock_v1_t. */ | 
| 1921 |   register_rwlock_v1_t register_rwlock; | 
| 1922 |   /** @sa register_cond_v1_t. */ | 
| 1923 |   register_cond_v1_t register_cond; | 
| 1924 |   /** @sa register_thread_v1_t. */ | 
| 1925 |   register_thread_v1_t register_thread; | 
| 1926 |   /** @sa register_file_v1_t. */ | 
| 1927 |   register_file_v1_t register_file; | 
| 1928 |   /** @sa register_stage_v1_t. */ | 
| 1929 |   register_stage_v1_t register_stage; | 
| 1930 |   /** @sa register_statement_v1_t. */ | 
| 1931 |   register_statement_v1_t register_statement; | 
| 1932 |   /** @sa register_socket_v1_t. */ | 
| 1933 |   register_socket_v1_t register_socket; | 
| 1934 |   /** @sa init_mutex_v1_t. */ | 
| 1935 |   init_mutex_v1_t init_mutex; | 
| 1936 |   /** @sa destroy_mutex_v1_t. */ | 
| 1937 |   destroy_mutex_v1_t destroy_mutex; | 
| 1938 |   /** @sa init_rwlock_v1_t. */ | 
| 1939 |   init_rwlock_v1_t init_rwlock; | 
| 1940 |   /** @sa destroy_rwlock_v1_t. */ | 
| 1941 |   destroy_rwlock_v1_t destroy_rwlock; | 
| 1942 |   /** @sa init_cond_v1_t. */ | 
| 1943 |   init_cond_v1_t init_cond; | 
| 1944 |   /** @sa destroy_cond_v1_t. */ | 
| 1945 |   destroy_cond_v1_t destroy_cond; | 
| 1946 |   /** @sa init_socket_v1_t. */ | 
| 1947 |   init_socket_v1_t init_socket; | 
| 1948 |   /** @sa destroy_socket_v1_t. */ | 
| 1949 |   destroy_socket_v1_t destroy_socket; | 
| 1950 |   /** @sa get_table_share_v1_t. */ | 
| 1951 |   get_table_share_v1_t get_table_share; | 
| 1952 |   /** @sa release_table_share_v1_t. */ | 
| 1953 |   release_table_share_v1_t release_table_share; | 
| 1954 |   /** @sa drop_table_share_v1_t. */ | 
| 1955 |   drop_table_share_v1_t drop_table_share; | 
| 1956 |   /** @sa open_table_v1_t. */ | 
| 1957 |   open_table_v1_t open_table; | 
| 1958 |   /** @sa unbind_table_v1_t. */ | 
| 1959 |   unbind_table_v1_t unbind_table; | 
| 1960 |   /** @sa rebind_table_v1_t. */ | 
| 1961 |   rebind_table_v1_t rebind_table; | 
| 1962 |   /** @sa close_table_v1_t. */ | 
| 1963 |   close_table_v1_t close_table; | 
| 1964 |   /** @sa create_file_v1_t. */ | 
| 1965 |   create_file_v1_t create_file; | 
| 1966 |   /** @sa spawn_thread_v1_t. */ | 
| 1967 |   spawn_thread_v1_t spawn_thread; | 
| 1968 |   /** @sa new_thread_v1_t. */ | 
| 1969 |   new_thread_v1_t new_thread; | 
| 1970 |   /** @sa set_thread_id_v1_t. */ | 
| 1971 |   set_thread_id_v1_t set_thread_id; | 
| 1972 |   /** @sa get_thread_v1_t. */ | 
| 1973 |   get_thread_v1_t get_thread; | 
| 1974 |   /** @sa set_thread_user_v1_t. */ | 
| 1975 |   set_thread_user_v1_t set_thread_user; | 
| 1976 |   /** @sa set_thread_user_host_v1_t. */ | 
| 1977 |   set_thread_user_host_v1_t set_thread_user_host; | 
| 1978 |   /** @sa set_thread_db_v1_t. */ | 
| 1979 |   set_thread_db_v1_t set_thread_db; | 
| 1980 |   /** @sa set_thread_command_v1_t. */ | 
| 1981 |   set_thread_command_v1_t set_thread_command; | 
| 1982 |   /** @sa set_thread_start_time_v1_t. */ | 
| 1983 |   set_thread_start_time_v1_t set_thread_start_time; | 
| 1984 |   /** @sa set_thread_state_v1_t. */ | 
| 1985 |   set_thread_state_v1_t set_thread_state; | 
| 1986 |   /** @sa set_thread_info_v1_t. */ | 
| 1987 |   set_thread_info_v1_t set_thread_info; | 
| 1988 |   /** @sa set_thread_v1_t. */ | 
| 1989 |   set_thread_v1_t set_thread; | 
| 1990 |   /** @sa delete_current_thread_v1_t. */ | 
| 1991 |   delete_current_thread_v1_t delete_current_thread; | 
| 1992 |   /** @sa delete_thread_v1_t. */ | 
| 1993 |   delete_thread_v1_t delete_thread; | 
| 1994 |   /** @sa get_thread_file_name_locker_v1_t. */ | 
| 1995 |   get_thread_file_name_locker_v1_t get_thread_file_name_locker; | 
| 1996 |   /** @sa get_thread_file_stream_locker_v1_t. */ | 
| 1997 |   get_thread_file_stream_locker_v1_t get_thread_file_stream_locker; | 
| 1998 |   /** @sa get_thread_file_descriptor_locker_v1_t. */ | 
| 1999 |   get_thread_file_descriptor_locker_v1_t get_thread_file_descriptor_locker; | 
| 2000 |   /** @sa unlock_mutex_v1_t. */ | 
| 2001 |   unlock_mutex_v1_t unlock_mutex; | 
| 2002 |   /** @sa unlock_rwlock_v1_t. */ | 
| 2003 |   unlock_rwlock_v1_t unlock_rwlock; | 
| 2004 |   /** @sa signal_cond_v1_t. */ | 
| 2005 |   signal_cond_v1_t signal_cond; | 
| 2006 |   /** @sa broadcast_cond_v1_t. */ | 
| 2007 |   broadcast_cond_v1_t broadcast_cond; | 
| 2008 |   /** @sa start_idle_wait_v1_t. */ | 
| 2009 |   start_idle_wait_v1_t start_idle_wait; | 
| 2010 |   /** @sa end_idle_wait_v1_t. */ | 
| 2011 |   end_idle_wait_v1_t end_idle_wait; | 
| 2012 |   /** @sa start_mutex_wait_v1_t. */ | 
| 2013 |   start_mutex_wait_v1_t start_mutex_wait; | 
| 2014 |   /** @sa end_mutex_wait_v1_t. */ | 
| 2015 |   end_mutex_wait_v1_t end_mutex_wait; | 
| 2016 |   /** @sa start_rwlock_rdwait_v1_t. */ | 
| 2017 |   start_rwlock_rdwait_v1_t start_rwlock_rdwait; | 
| 2018 |   /** @sa end_rwlock_rdwait_v1_t. */ | 
| 2019 |   end_rwlock_rdwait_v1_t end_rwlock_rdwait; | 
| 2020 |   /** @sa start_rwlock_wrwait_v1_t. */ | 
| 2021 |   start_rwlock_wrwait_v1_t start_rwlock_wrwait; | 
| 2022 |   /** @sa end_rwlock_wrwait_v1_t. */ | 
| 2023 |   end_rwlock_wrwait_v1_t end_rwlock_wrwait; | 
| 2024 |   /** @sa start_cond_wait_v1_t. */ | 
| 2025 |   start_cond_wait_v1_t start_cond_wait; | 
| 2026 |   /** @sa end_cond_wait_v1_t. */ | 
| 2027 |   end_cond_wait_v1_t end_cond_wait; | 
| 2028 |   /** @sa start_table_io_wait_v1_t. */ | 
| 2029 |   start_table_io_wait_v1_t start_table_io_wait; | 
| 2030 |   /** @sa end_table_io_wait_v1_t. */ | 
| 2031 |   end_table_io_wait_v1_t end_table_io_wait; | 
| 2032 |   /** @sa start_table_lock_wait_v1_t. */ | 
| 2033 |   start_table_lock_wait_v1_t start_table_lock_wait; | 
| 2034 |   /** @sa end_table_lock_wait_v1_t. */ | 
| 2035 |   end_table_lock_wait_v1_t end_table_lock_wait; | 
| 2036 |   /** @sa start_file_open_wait_v1_t. */ | 
| 2037 |   start_file_open_wait_v1_t start_file_open_wait; | 
| 2038 |   /** @sa end_file_open_wait_v1_t. */ | 
| 2039 |   end_file_open_wait_v1_t end_file_open_wait; | 
| 2040 |   /** @sa end_file_open_wait_and_bind_to_descriptor_v1_t. */ | 
| 2041 |   end_file_open_wait_and_bind_to_descriptor_v1_t | 
| 2042 |     end_file_open_wait_and_bind_to_descriptor; | 
| 2043 |   /** @sa start_file_wait_v1_t. */ | 
| 2044 |   start_file_wait_v1_t start_file_wait; | 
| 2045 |   /** @sa end_file_wait_v1_t. */ | 
| 2046 |   end_file_wait_v1_t end_file_wait; | 
| 2047 |   /** @sa start_file_close_wait_v1_t. */ | 
| 2048 |   start_file_close_wait_v1_t start_file_close_wait; | 
| 2049 |   /** @sa end_file_close_wait_v1_t. */ | 
| 2050 |   end_file_close_wait_v1_t end_file_close_wait; | 
| 2051 |   /** @sa start_stage_v1_t. */ | 
| 2052 |   start_stage_v1_t start_stage; | 
| 2053 |   /** @sa end_stage_v1_t. */ | 
| 2054 |   end_stage_v1_t end_stage; | 
| 2055 |   /** @sa get_thread_statement_locker_v1_t. */ | 
| 2056 |   get_thread_statement_locker_v1_t get_thread_statement_locker; | 
| 2057 |   /** @sa refine_statement_v1_t. */ | 
| 2058 |   refine_statement_v1_t refine_statement; | 
| 2059 |   /** @sa start_statement_v1_t. */ | 
| 2060 |   start_statement_v1_t start_statement; | 
| 2061 |   /** @sa set_statement_text_v1_t. */ | 
| 2062 |   set_statement_text_v1_t set_statement_text; | 
| 2063 |   /** @sa set_statement_lock_time_t. */ | 
| 2064 |   set_statement_lock_time_t set_statement_lock_time; | 
| 2065 |   /** @sa set_statement_rows_sent_t. */ | 
| 2066 |   set_statement_rows_sent_t set_statement_rows_sent; | 
| 2067 |   /** @sa set_statement_rows_examined_t. */ | 
| 2068 |   set_statement_rows_examined_t set_statement_rows_examined; | 
| 2069 |   /** @sa inc_statement_created_tmp_disk_tables. */ | 
| 2070 |   inc_statement_created_tmp_disk_tables_t inc_statement_created_tmp_disk_tables; | 
| 2071 |   /** @sa inc_statement_created_tmp_tables. */ | 
| 2072 |   inc_statement_created_tmp_tables_t inc_statement_created_tmp_tables; | 
| 2073 |   /** @sa inc_statement_select_full_join. */ | 
| 2074 |   inc_statement_select_full_join_t inc_statement_select_full_join; | 
| 2075 |   /** @sa inc_statement_select_full_range_join. */ | 
| 2076 |   inc_statement_select_full_range_join_t inc_statement_select_full_range_join; | 
| 2077 |   /** @sa inc_statement_select_range. */ | 
| 2078 |   inc_statement_select_range_t inc_statement_select_range; | 
| 2079 |   /** @sa inc_statement_select_range_check. */ | 
| 2080 |   inc_statement_select_range_check_t inc_statement_select_range_check; | 
| 2081 |   /** @sa inc_statement_select_scan. */ | 
| 2082 |   inc_statement_select_scan_t inc_statement_select_scan; | 
| 2083 |   /** @sa inc_statement_sort_merge_passes. */ | 
| 2084 |   inc_statement_sort_merge_passes_t inc_statement_sort_merge_passes; | 
| 2085 |   /** @sa inc_statement_sort_range. */ | 
| 2086 |   inc_statement_sort_range_t inc_statement_sort_range; | 
| 2087 |   /** @sa inc_statement_sort_rows. */ | 
| 2088 |   inc_statement_sort_rows_t inc_statement_sort_rows; | 
| 2089 |   /** @sa inc_statement_sort_scan. */ | 
| 2090 |   inc_statement_sort_scan_t inc_statement_sort_scan; | 
| 2091 |   /** @sa set_statement_no_index_used. */ | 
| 2092 |   set_statement_no_index_used_t set_statement_no_index_used; | 
| 2093 |   /** @sa set_statement_no_good_index_used. */ | 
| 2094 |   set_statement_no_good_index_used_t set_statement_no_good_index_used; | 
| 2095 |   /** @sa end_statement_v1_t. */ | 
| 2096 |   end_statement_v1_t end_statement; | 
| 2097 |   /** @sa start_socket_wait_v1_t. */ | 
| 2098 |   start_socket_wait_v1_t start_socket_wait; | 
| 2099 |   /** @sa end_socket_wait_v1_t. */ | 
| 2100 |   end_socket_wait_v1_t end_socket_wait; | 
| 2101 |   /** @sa set_socket_state_v1_t. */ | 
| 2102 |   set_socket_state_v1_t set_socket_state; | 
| 2103 |   /** @sa set_socket_info_v1_t. */ | 
| 2104 |   set_socket_info_v1_t set_socket_info; | 
| 2105 |   /** @sa set_socket_thread_owner_v1_t. */ | 
| 2106 |   set_socket_thread_owner_v1_t set_socket_thread_owner; | 
| 2107 |   /** @sa digest_start_v1_t. */ | 
| 2108 |   digest_start_v1_t digest_start; | 
| 2109 |   /** @sa digest_end_v1_t. */ | 
| 2110 |   digest_end_v1_t digest_end; | 
| 2111 |   /** @sa set_thread_connect_attrs_v1_t. */ | 
| 2112 |   set_thread_connect_attrs_v1_t set_thread_connect_attrs; | 
| 2113 | }; | 
| 2114 |  | 
| 2115 | /** @} (end of group Group_PSI_v1) */ | 
| 2116 |  | 
| 2117 | #endif /* HAVE_PSI_1 */ | 
| 2118 |  | 
| 2119 | #ifdef USE_PSI_2 | 
| 2120 | #define HAVE_PSI_2 | 
| 2121 | #endif | 
| 2122 |  | 
| 2123 | #ifdef HAVE_PSI_2 | 
| 2124 |  | 
| 2125 | /** | 
| 2126 |   @defgroup Group_PSI_v2 Application Binary Interface, version 2 | 
| 2127 |   @ingroup Instrumentation_interface | 
| 2128 |   @{ | 
| 2129 | */ | 
| 2130 |  | 
| 2131 | /** | 
| 2132 |   Performance Schema Interface, version 2. | 
| 2133 |   This is a placeholder, this interface is not defined yet. | 
| 2134 |   @since PSI_VERSION_2 | 
| 2135 | */ | 
| 2136 | struct PSI_v2 | 
| 2137 | { | 
| 2138 |   /** Placeholder */ | 
| 2139 |   int placeholder; | 
| 2140 |   /* ... extended interface ... */ | 
| 2141 | }; | 
| 2142 |  | 
| 2143 | /** Placeholder */ | 
| 2144 | struct PSI_mutex_info_v2 | 
| 2145 | { | 
| 2146 |   /** Placeholder */ | 
| 2147 |   int placeholder; | 
| 2148 | }; | 
| 2149 |  | 
| 2150 | /** Placeholder */ | 
| 2151 | struct PSI_rwlock_info_v2 | 
| 2152 | { | 
| 2153 |   /** Placeholder */ | 
| 2154 |   int placeholder; | 
| 2155 | }; | 
| 2156 |  | 
| 2157 | /** Placeholder */ | 
| 2158 | struct PSI_cond_info_v2 | 
| 2159 | { | 
| 2160 |   /** Placeholder */ | 
| 2161 |   int placeholder; | 
| 2162 | }; | 
| 2163 |  | 
| 2164 | /** Placeholder */ | 
| 2165 | struct PSI_thread_info_v2 | 
| 2166 | { | 
| 2167 |   /** Placeholder */ | 
| 2168 |   int placeholder; | 
| 2169 | }; | 
| 2170 |  | 
| 2171 | /** Placeholder */ | 
| 2172 | struct PSI_file_info_v2 | 
| 2173 | { | 
| 2174 |   /** Placeholder */ | 
| 2175 |   int placeholder; | 
| 2176 | }; | 
| 2177 |  | 
| 2178 | /** Placeholder */ | 
| 2179 | struct PSI_stage_info_v2 | 
| 2180 | { | 
| 2181 |   /** Placeholder */ | 
| 2182 |   int placeholder; | 
| 2183 | }; | 
| 2184 |  | 
| 2185 | /** Placeholder */ | 
| 2186 | struct PSI_statement_info_v2 | 
| 2187 | { | 
| 2188 |   /** Placeholder */ | 
| 2189 |   int placeholder; | 
| 2190 | }; | 
| 2191 |  | 
| 2192 | /** Placeholder */ | 
| 2193 | struct PSI_idle_locker_state_v2 | 
| 2194 | { | 
| 2195 |   /** Placeholder */ | 
| 2196 |   int placeholder; | 
| 2197 | }; | 
| 2198 |  | 
| 2199 | /** Placeholder */ | 
| 2200 | struct PSI_mutex_locker_state_v2 | 
| 2201 | { | 
| 2202 |   /** Placeholder */ | 
| 2203 |   int placeholder; | 
| 2204 | }; | 
| 2205 |  | 
| 2206 | /** Placeholder */ | 
| 2207 | struct PSI_rwlock_locker_state_v2 | 
| 2208 | { | 
| 2209 |   /** Placeholder */ | 
| 2210 |   int placeholder; | 
| 2211 | }; | 
| 2212 |  | 
| 2213 | /** Placeholder */ | 
| 2214 | struct PSI_cond_locker_state_v2 | 
| 2215 | { | 
| 2216 |   /** Placeholder */ | 
| 2217 |   int placeholder; | 
| 2218 | }; | 
| 2219 |  | 
| 2220 | /** Placeholder */ | 
| 2221 | struct PSI_file_locker_state_v2 | 
| 2222 | { | 
| 2223 |   /** Placeholder */ | 
| 2224 |   int placeholder; | 
| 2225 | }; | 
| 2226 |  | 
| 2227 | /** Placeholder */ | 
| 2228 | struct PSI_table_locker_state_v2 | 
| 2229 | { | 
| 2230 |   /** Placeholder */ | 
| 2231 |   int placeholder; | 
| 2232 | }; | 
| 2233 |  | 
| 2234 | /** Placeholder */ | 
| 2235 | struct PSI_statement_locker_state_v2 | 
| 2236 | { | 
| 2237 |   /** Placeholder */ | 
| 2238 |   int placeholder; | 
| 2239 | }; | 
| 2240 |  | 
| 2241 | /** Placeholder */ | 
| 2242 | struct PSI_socket_locker_state_v2 | 
| 2243 | { | 
| 2244 |   /** Placeholder */ | 
| 2245 |   int placeholder; | 
| 2246 | }; | 
| 2247 |  | 
| 2248 | /** @} (end of group Group_PSI_v2) */ | 
| 2249 |  | 
| 2250 | #endif /* HAVE_PSI_2 */ | 
| 2251 |  | 
| 2252 | /** | 
| 2253 |   @typedef PSI | 
| 2254 |   The instrumentation interface for the current version. | 
| 2255 |   @sa PSI_CURRENT_VERSION | 
| 2256 | */ | 
| 2257 |  | 
| 2258 | /** | 
| 2259 |   @typedef PSI_mutex_info | 
| 2260 |   The mutex information structure for the current version. | 
| 2261 | */ | 
| 2262 |  | 
| 2263 | /** | 
| 2264 |   @typedef PSI_rwlock_info | 
| 2265 |   The rwlock information structure for the current version. | 
| 2266 | */ | 
| 2267 |  | 
| 2268 | /** | 
| 2269 |   @typedef PSI_cond_info | 
| 2270 |   The cond information structure for the current version. | 
| 2271 | */ | 
| 2272 |  | 
| 2273 | /** | 
| 2274 |   @typedef PSI_thread_info | 
| 2275 |   The thread information structure for the current version. | 
| 2276 | */ | 
| 2277 |  | 
| 2278 | /** | 
| 2279 |   @typedef PSI_file_info | 
| 2280 |   The file information structure for the current version. | 
| 2281 | */ | 
| 2282 |  | 
| 2283 | /* Export the required version */ | 
| 2284 | #ifdef USE_PSI_1 | 
| 2285 | typedef struct PSI_v1 PSI; | 
| 2286 | typedef struct PSI_mutex_info_v1 PSI_mutex_info; | 
| 2287 | typedef struct PSI_rwlock_info_v1 PSI_rwlock_info; | 
| 2288 | typedef struct PSI_cond_info_v1 PSI_cond_info; | 
| 2289 | typedef struct PSI_thread_info_v1 PSI_thread_info; | 
| 2290 | typedef struct PSI_file_info_v1 PSI_file_info; | 
| 2291 | typedef struct PSI_stage_info_v1 PSI_stage_info; | 
| 2292 | typedef struct PSI_statement_info_v1 PSI_statement_info; | 
| 2293 | typedef struct PSI_socket_info_v1 PSI_socket_info; | 
| 2294 | typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state; | 
| 2295 | typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state; | 
| 2296 | typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state; | 
| 2297 | typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state; | 
| 2298 | typedef struct PSI_file_locker_state_v1 PSI_file_locker_state; | 
| 2299 | typedef struct PSI_table_locker_state_v1 PSI_table_locker_state; | 
| 2300 | typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state; | 
| 2301 | typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state; | 
| 2302 | #endif | 
| 2303 |  | 
| 2304 | #ifdef USE_PSI_2 | 
| 2305 | typedef struct PSI_v2 PSI; | 
| 2306 | typedef struct PSI_mutex_info_v2 PSI_mutex_info; | 
| 2307 | typedef struct PSI_rwlock_info_v2 PSI_rwlock_info; | 
| 2308 | typedef struct PSI_cond_info_v2 PSI_cond_info; | 
| 2309 | typedef struct PSI_thread_info_v2 PSI_thread_info; | 
| 2310 | typedef struct PSI_file_info_v2 PSI_file_info; | 
| 2311 | typedef struct PSI_stage_info_v2 PSI_stage_info; | 
| 2312 | typedef struct PSI_statement_info_v2 PSI_statement_info; | 
| 2313 | typedef struct PSI_socket_info_v2 PSI_socket_info; | 
| 2314 | typedef struct PSI_idle_locker_state_v2 PSI_idle_locker_state; | 
| 2315 | typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state; | 
| 2316 | typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state; | 
| 2317 | typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state; | 
| 2318 | typedef struct PSI_file_locker_state_v2 PSI_file_locker_state; | 
| 2319 | typedef struct PSI_table_locker_state_v2 PSI_table_locker_state; | 
| 2320 | typedef struct PSI_statement_locker_state_v2 PSI_statement_locker_state; | 
| 2321 | typedef struct PSI_socket_locker_state_v2 PSI_socket_locker_state; | 
| 2322 | #endif | 
| 2323 |  | 
| 2324 | #else /* HAVE_PSI_INTERFACE */ | 
| 2325 |  | 
| 2326 | /** | 
| 2327 |   Dummy structure, used to declare PSI_server when no instrumentation | 
| 2328 |   is available. | 
| 2329 |   The content does not matter, since PSI_server will be NULL. | 
| 2330 | */ | 
| 2331 | struct PSI_none | 
| 2332 | { | 
| 2333 |   int opaque; | 
| 2334 | }; | 
| 2335 | typedef struct PSI_none PSI; | 
| 2336 |  | 
| 2337 | /** | 
| 2338 |   Stage instrument information. | 
| 2339 |   @since PSI_VERSION_1 | 
| 2340 |   This structure is used to register an instrumented stage. | 
| 2341 | */ | 
| 2342 | struct PSI_stage_info_none | 
| 2343 | { | 
| 2344 |   /** Unused stage key. */ | 
| 2345 |   unsigned int m_key; | 
| 2346 |   /** The name of the stage instrument. */ | 
| 2347 |   const char *m_name; | 
| 2348 |   /** Unused stage flags. */ | 
| 2349 |   int m_flags; | 
| 2350 | }; | 
| 2351 |  | 
| 2352 | /** | 
| 2353 |   The stage instrumentation has to co exist with the legacy | 
| 2354 |   THD::set_proc_info instrumentation. | 
| 2355 |   To avoid duplication of the instrumentation in the server, | 
| 2356 |   the common PSI_stage_info structure is used, | 
| 2357 |   so we export it here, even when not building | 
| 2358 |   with HAVE_PSI_INTERFACE. | 
| 2359 | */ | 
| 2360 | typedef struct PSI_stage_info_none PSI_stage_info; | 
| 2361 |  | 
| 2362 | #endif /* HAVE_PSI_INTERFACE */ | 
| 2363 |  | 
| 2364 | extern MYSQL_PLUGIN_IMPORT my_bool pfs_enabled; | 
| 2365 | extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; | 
| 2366 |  | 
| 2367 | /* | 
| 2368 |   Allow to override PSI_XXX_CALL at compile time | 
| 2369 |   with more efficient implementations, if available. | 
| 2370 |   If nothing better is available, | 
| 2371 |   make a dynamic call using the PSI_server function pointer. | 
| 2372 | */ | 
| 2373 |  | 
| 2374 | #ifndef PSI_MUTEX_CALL | 
| 2375 | #define PSI_MUTEX_CALL(M) PSI_DYNAMIC_CALL(M) | 
| 2376 | #endif | 
| 2377 |  | 
| 2378 | #ifndef PSI_RWLOCK_CALL | 
| 2379 | #define PSI_RWLOCK_CALL(M) PSI_DYNAMIC_CALL(M) | 
| 2380 | #endif | 
| 2381 |  | 
| 2382 | #ifndef PSI_COND_CALL | 
| 2383 | #define PSI_COND_CALL(M) PSI_DYNAMIC_CALL(M) | 
| 2384 | #endif | 
| 2385 |  | 
| 2386 | #ifndef PSI_THREAD_CALL | 
| 2387 | #define PSI_THREAD_CALL(M) PSI_DYNAMIC_CALL(M) | 
| 2388 | #endif | 
| 2389 |  | 
| 2390 | #ifndef PSI_FILE_CALL | 
| 2391 | #define PSI_FILE_CALL(M) PSI_DYNAMIC_CALL(M) | 
| 2392 | #endif | 
| 2393 |  | 
| 2394 | #ifndef PSI_SOCKET_CALL | 
| 2395 | #define PSI_SOCKET_CALL(M) PSI_DYNAMIC_CALL(M) | 
| 2396 | #endif | 
| 2397 |  | 
| 2398 | #ifndef PSI_STAGE_CALL | 
| 2399 | #define PSI_STAGE_CALL(M) PSI_DYNAMIC_CALL(M) | 
| 2400 | #endif | 
| 2401 |  | 
| 2402 | #ifndef PSI_STATEMENT_CALL | 
| 2403 | #define PSI_STATEMENT_CALL(M) PSI_DYNAMIC_CALL(M) | 
| 2404 | #endif | 
| 2405 |  | 
| 2406 | #ifndef PSI_DIGEST_CALL | 
| 2407 | #define PSI_DIGEST_CALL(M) PSI_DYNAMIC_CALL(M) | 
| 2408 | #endif | 
| 2409 |  | 
| 2410 | #ifndef PSI_TABLE_CALL | 
| 2411 | #define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M) | 
| 2412 | #endif | 
| 2413 |  | 
| 2414 | #ifndef PSI_IDLE_CALL | 
| 2415 | #define PSI_IDLE_CALL(M) PSI_DYNAMIC_CALL(M) | 
| 2416 | #endif | 
| 2417 |  | 
| 2418 | #define PSI_DYNAMIC_CALL(M) PSI_server->M | 
| 2419 |  | 
| 2420 | /** @} */ | 
| 2421 |  | 
| 2422 | C_MODE_END | 
| 2423 | #endif /* MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H */ | 
| 2424 |  | 
| 2425 |  |