1extern "C" {
2}
3extern "C" {
4struct PSI_thread;
5typedef unsigned int PSI_memory_key;
6struct PSI_memory_info_v1
7{
8  PSI_memory_key *m_key;
9  const char *m_name;
10  int m_flags;
11};
12typedef struct PSI_memory_info_v1 PSI_memory_info_v1;
13typedef void (*register_memory_v1_t)
14  (const char *category, struct PSI_memory_info_v1 *info, int count);
15typedef PSI_memory_key (*memory_alloc_v1_t)
16  (PSI_memory_key key, size_t size, struct PSI_thread ** owner);
17typedef PSI_memory_key (*memory_realloc_v1_t)
18  (PSI_memory_key key, size_t old_size, size_t new_size, struct PSI_thread ** owner);
19typedef PSI_memory_key (*memory_claim_v1_t)
20  (PSI_memory_key key, size_t size, struct PSI_thread ** owner);
21typedef void (*memory_free_v1_t)
22  (PSI_memory_key key, size_t size, struct PSI_thread * owner);
23typedef struct PSI_memory_info_v1 PSI_memory_info;
24}
25C_MODE_START
26struct MDL_key;
27typedef struct MDL_key MDL_key;
28typedef int opaque_mdl_type;
29typedef int opaque_mdl_duration;
30typedef int opaque_mdl_status;
31typedef int opaque_vio_type;
32struct TABLE_SHARE;
33struct sql_digest_storage;
34  class THD;
35struct PSI_mutex;
36typedef struct PSI_mutex PSI_mutex;
37struct PSI_rwlock;
38typedef struct PSI_rwlock PSI_rwlock;
39struct PSI_cond;
40typedef struct PSI_cond PSI_cond;
41struct PSI_table_share;
42typedef struct PSI_table_share PSI_table_share;
43struct PSI_table;
44typedef struct PSI_table PSI_table;
45struct PSI_thread;
46typedef struct PSI_thread PSI_thread;
47struct PSI_file;
48typedef struct PSI_file PSI_file;
49struct PSI_socket;
50typedef struct PSI_socket PSI_socket;
51struct PSI_prepared_stmt;
52typedef struct PSI_prepared_stmt PSI_prepared_stmt;
53struct PSI_table_locker;
54typedef struct PSI_table_locker PSI_table_locker;
55struct PSI_statement_locker;
56typedef struct PSI_statement_locker PSI_statement_locker;
57struct PSI_transaction_locker;
58typedef struct PSI_transaction_locker PSI_transaction_locker;
59struct PSI_idle_locker;
60typedef struct PSI_idle_locker PSI_idle_locker;
61struct PSI_digest_locker;
62typedef struct PSI_digest_locker PSI_digest_locker;
63struct PSI_sp_share;
64typedef struct PSI_sp_share PSI_sp_share;
65struct PSI_sp_locker;
66typedef struct PSI_sp_locker PSI_sp_locker;
67struct PSI_metadata_lock;
68typedef struct PSI_metadata_lock PSI_metadata_lock;
69struct PSI_stage_progress
70{
71  ulonglong m_work_completed;
72  ulonglong m_work_estimated;
73};
74typedef struct PSI_stage_progress PSI_stage_progress;
75enum PSI_table_io_operation
76{
77  PSI_TABLE_FETCH_ROW= 0,
78  PSI_TABLE_WRITE_ROW= 1,
79  PSI_TABLE_UPDATE_ROW= 2,
80  PSI_TABLE_DELETE_ROW= 3
81};
82typedef enum PSI_table_io_operation PSI_table_io_operation;
83struct PSI_table_locker_state
84{
85  uint m_flags;
86  enum PSI_table_io_operation m_io_operation;
87  struct PSI_table *m_table;
88  struct PSI_table_share *m_table_share;
89  struct PSI_thread *m_thread;
90  ulonglong m_timer_start;
91  ulonglong (*m_timer)(void);
92  void *m_wait;
93  uint m_index;
94};
95typedef struct PSI_table_locker_state PSI_table_locker_state;
96struct PSI_bootstrap
97{
98  void* (*get_interface)(int version);
99};
100typedef struct PSI_bootstrap PSI_bootstrap;
101struct PSI_mutex_locker;
102typedef struct PSI_mutex_locker PSI_mutex_locker;
103struct PSI_rwlock_locker;
104typedef struct PSI_rwlock_locker PSI_rwlock_locker;
105struct PSI_cond_locker;
106typedef struct PSI_cond_locker PSI_cond_locker;
107struct PSI_file_locker;
108typedef struct PSI_file_locker PSI_file_locker;
109struct PSI_socket_locker;
110typedef struct PSI_socket_locker PSI_socket_locker;
111struct PSI_metadata_locker;
112typedef struct PSI_metadata_locker PSI_metadata_locker;
113enum PSI_mutex_operation
114{
115  PSI_MUTEX_LOCK= 0,
116  PSI_MUTEX_TRYLOCK= 1
117};
118typedef enum PSI_mutex_operation PSI_mutex_operation;
119enum PSI_rwlock_operation
120{
121  PSI_RWLOCK_READLOCK= 0,
122  PSI_RWLOCK_WRITELOCK= 1,
123  PSI_RWLOCK_TRYREADLOCK= 2,
124  PSI_RWLOCK_TRYWRITELOCK= 3,
125  PSI_RWLOCK_SHAREDLOCK= 4,
126  PSI_RWLOCK_SHAREDEXCLUSIVELOCK= 5,
127  PSI_RWLOCK_EXCLUSIVELOCK= 6,
128  PSI_RWLOCK_TRYSHAREDLOCK= 7,
129  PSI_RWLOCK_TRYSHAREDEXCLUSIVELOCK= 8,
130  PSI_RWLOCK_TRYEXCLUSIVELOCK= 9
131};
132typedef enum PSI_rwlock_operation PSI_rwlock_operation;
133enum PSI_cond_operation
134{
135  PSI_COND_WAIT= 0,
136  PSI_COND_TIMEDWAIT= 1
137};
138typedef enum PSI_cond_operation PSI_cond_operation;
139enum PSI_file_operation
140{
141  PSI_FILE_CREATE= 0,
142  PSI_FILE_CREATE_TMP= 1,
143  PSI_FILE_OPEN= 2,
144  PSI_FILE_STREAM_OPEN= 3,
145  PSI_FILE_CLOSE= 4,
146  PSI_FILE_STREAM_CLOSE= 5,
147  PSI_FILE_READ= 6,
148  PSI_FILE_WRITE= 7,
149  PSI_FILE_SEEK= 8,
150  PSI_FILE_TELL= 9,
151  PSI_FILE_FLUSH= 10,
152  PSI_FILE_STAT= 11,
153  PSI_FILE_FSTAT= 12,
154  PSI_FILE_CHSIZE= 13,
155  PSI_FILE_DELETE= 14,
156  PSI_FILE_RENAME= 15,
157  PSI_FILE_SYNC= 16
158};
159typedef enum PSI_file_operation PSI_file_operation;
160enum PSI_table_lock_operation
161{
162  PSI_TABLE_LOCK= 0,
163  PSI_TABLE_EXTERNAL_LOCK= 1
164};
165typedef enum PSI_table_lock_operation PSI_table_lock_operation;
166enum PSI_socket_state
167{
168  PSI_SOCKET_STATE_IDLE= 1,
169  PSI_SOCKET_STATE_ACTIVE= 2
170};
171typedef enum PSI_socket_state PSI_socket_state;
172enum PSI_socket_operation
173{
174  PSI_SOCKET_CREATE= 0,
175  PSI_SOCKET_CONNECT= 1,
176  PSI_SOCKET_BIND= 2,
177  PSI_SOCKET_CLOSE= 3,
178  PSI_SOCKET_SEND= 4,
179  PSI_SOCKET_RECV= 5,
180  PSI_SOCKET_SENDTO= 6,
181  PSI_SOCKET_RECVFROM= 7,
182  PSI_SOCKET_SENDMSG= 8,
183  PSI_SOCKET_RECVMSG= 9,
184  PSI_SOCKET_SEEK= 10,
185  PSI_SOCKET_OPT= 11,
186  PSI_SOCKET_STAT= 12,
187  PSI_SOCKET_SHUTDOWN= 13,
188  PSI_SOCKET_SELECT= 14
189};
190typedef enum PSI_socket_operation PSI_socket_operation;
191typedef unsigned int PSI_mutex_key;
192typedef unsigned int PSI_rwlock_key;
193typedef unsigned int PSI_cond_key;
194typedef unsigned int PSI_thread_key;
195typedef unsigned int PSI_file_key;
196typedef unsigned int PSI_stage_key;
197typedef unsigned int PSI_statement_key;
198typedef unsigned int PSI_socket_key;
199struct PSI_mutex_info_v1
200{
201  PSI_mutex_key *m_key;
202  const char *m_name;
203  int m_flags;
204};
205typedef struct PSI_mutex_info_v1 PSI_mutex_info_v1;
206struct PSI_rwlock_info_v1
207{
208  PSI_rwlock_key *m_key;
209  const char *m_name;
210  int m_flags;
211};
212typedef struct PSI_rwlock_info_v1 PSI_rwlock_info_v1;
213struct PSI_cond_info_v1
214{
215  PSI_cond_key *m_key;
216  const char *m_name;
217  int m_flags;
218};
219typedef struct PSI_cond_info_v1 PSI_cond_info_v1;
220struct PSI_thread_info_v1
221{
222  PSI_thread_key *m_key;
223  const char *m_name;
224  int m_flags;
225};
226typedef struct PSI_thread_info_v1 PSI_thread_info_v1;
227struct PSI_file_info_v1
228{
229  PSI_file_key *m_key;
230  const char *m_name;
231  int m_flags;
232};
233typedef struct PSI_file_info_v1 PSI_file_info_v1;
234struct PSI_stage_info_v1
235{
236  PSI_stage_key m_key;
237  const char *m_name;
238  int m_flags;
239};
240typedef struct PSI_stage_info_v1 PSI_stage_info_v1;
241struct PSI_statement_info_v1
242{
243  PSI_statement_key m_key;
244  const char *m_name;
245  int m_flags;
246};
247typedef struct PSI_statement_info_v1 PSI_statement_info_v1;
248struct PSI_socket_info_v1
249{
250  PSI_socket_key *m_key;
251  const char *m_name;
252  int m_flags;
253};
254typedef struct PSI_socket_info_v1 PSI_socket_info_v1;
255struct PSI_idle_locker_state_v1
256{
257  uint m_flags;
258  struct PSI_thread *m_thread;
259  ulonglong m_timer_start;
260  ulonglong (*m_timer)(void);
261  void *m_wait;
262};
263typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state_v1;
264struct PSI_mutex_locker_state_v1
265{
266  uint m_flags;
267  enum PSI_mutex_operation m_operation;
268  struct PSI_mutex *m_mutex;
269  struct PSI_thread *m_thread;
270  ulonglong m_timer_start;
271  ulonglong (*m_timer)(void);
272  void *m_wait;
273};
274typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state_v1;
275struct PSI_rwlock_locker_state_v1
276{
277  uint m_flags;
278  enum PSI_rwlock_operation m_operation;
279  struct PSI_rwlock *m_rwlock;
280  struct PSI_thread *m_thread;
281  ulonglong m_timer_start;
282  ulonglong (*m_timer)(void);
283  void *m_wait;
284};
285typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state_v1;
286struct PSI_cond_locker_state_v1
287{
288  uint m_flags;
289  enum PSI_cond_operation m_operation;
290  struct PSI_cond *m_cond;
291  struct PSI_mutex *m_mutex;
292  struct PSI_thread *m_thread;
293  ulonglong m_timer_start;
294  ulonglong (*m_timer)(void);
295  void *m_wait;
296};
297typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state_v1;
298struct PSI_file_locker_state_v1
299{
300  uint m_flags;
301  enum PSI_file_operation m_operation;
302  struct PSI_file *m_file;
303  const char *m_name;
304  void *m_class;
305  struct PSI_thread *m_thread;
306  size_t m_number_of_bytes;
307  ulonglong m_timer_start;
308  ulonglong (*m_timer)(void);
309  void *m_wait;
310};
311typedef struct PSI_file_locker_state_v1 PSI_file_locker_state_v1;
312struct PSI_metadata_locker_state_v1
313{
314  uint m_flags;
315  struct PSI_metadata_lock *m_metadata_lock;
316  struct PSI_thread *m_thread;
317  ulonglong m_timer_start;
318  ulonglong (*m_timer)(void);
319  void *m_wait;
320};
321typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state_v1;
322struct PSI_statement_locker_state_v1
323{
324  my_bool m_discarded;
325  my_bool m_in_prepare;
326  uchar m_no_index_used;
327  uchar m_no_good_index_used;
328  uint m_flags;
329  void *m_class;
330  struct PSI_thread *m_thread;
331  ulonglong m_timer_start;
332  ulonglong (*m_timer)(void);
333  void *m_statement;
334  ulonglong m_lock_time;
335  ulonglong m_rows_sent;
336  ulonglong m_rows_examined;
337  ulong m_created_tmp_disk_tables;
338  ulong m_created_tmp_tables;
339  ulong m_select_full_join;
340  ulong m_select_full_range_join;
341  ulong m_select_range;
342  ulong m_select_range_check;
343  ulong m_select_scan;
344  ulong m_sort_merge_passes;
345  ulong m_sort_range;
346  ulong m_sort_rows;
347  ulong m_sort_scan;
348  const struct sql_digest_storage *m_digest;
349  char m_schema_name[(64 * 3)];
350  uint m_schema_name_length;
351  uint m_cs_number;
352  PSI_sp_share *m_parent_sp_share;
353  PSI_prepared_stmt *m_parent_prepared_stmt;
354};
355typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state_v1;
356struct PSI_transaction_locker_state_v1
357{
358  uint m_flags;
359  void *m_class;
360  struct PSI_thread *m_thread;
361  ulonglong m_timer_start;
362  ulonglong (*m_timer)(void);
363  void *m_transaction;
364  my_bool m_read_only;
365  my_bool m_autocommit;
366  ulong m_statement_count;
367  ulong m_savepoint_count;
368  ulong m_rollback_to_savepoint_count;
369  ulong m_release_savepoint_count;
370};
371typedef struct PSI_transaction_locker_state_v1 PSI_transaction_locker_state_v1;
372struct PSI_socket_locker_state_v1
373{
374  uint m_flags;
375  struct PSI_socket *m_socket;
376  struct PSI_thread *m_thread;
377  size_t m_number_of_bytes;
378  ulonglong m_timer_start;
379  ulonglong (*m_timer)(void);
380  enum PSI_socket_operation m_operation;
381  const char* m_src_file;
382  int m_src_line;
383  void *m_wait;
384};
385typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state_v1;
386struct PSI_sp_locker_state_v1
387{
388  uint m_flags;
389  struct PSI_thread *m_thread;
390  ulonglong m_timer_start;
391  ulonglong (*m_timer)(void);
392  PSI_sp_share* m_sp_share;
393};
394typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state_v1;
395typedef void (*register_mutex_v1_t)
396  (const char *category, struct PSI_mutex_info_v1 *info, int count);
397typedef void (*register_rwlock_v1_t)
398  (const char *category, struct PSI_rwlock_info_v1 *info, int count);
399typedef void (*register_cond_v1_t)
400  (const char *category, struct PSI_cond_info_v1 *info, int count);
401typedef void (*register_thread_v1_t)
402  (const char *category, struct PSI_thread_info_v1 *info, int count);
403typedef void (*register_file_v1_t)
404  (const char *category, struct PSI_file_info_v1 *info, int count);
405typedef void (*register_stage_v1_t)
406  (const char *category, struct PSI_stage_info_v1 **info, int count);
407typedef void (*register_statement_v1_t)
408  (const char *category, struct PSI_statement_info_v1 *info, int count);
409typedef void (*register_socket_v1_t)
410  (const char *category, struct PSI_socket_info_v1 *info, int count);
411typedef struct PSI_mutex* (*init_mutex_v1_t)
412  (PSI_mutex_key key, void *identity);
413typedef void (*destroy_mutex_v1_t)(struct PSI_mutex *mutex);
414typedef struct PSI_rwlock* (*init_rwlock_v1_t)
415  (PSI_rwlock_key key, void *identity);
416typedef void (*destroy_rwlock_v1_t)(struct PSI_rwlock *rwlock);
417typedef struct PSI_cond* (*init_cond_v1_t)
418  (PSI_cond_key key, void *identity);
419typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond);
420typedef struct PSI_socket* (*init_socket_v1_t)
421  (PSI_socket_key key, const my_socket *fd,
422  const struct sockaddr *addr, socklen_t addr_len);
423typedef void (*destroy_socket_v1_t)(struct PSI_socket *socket);
424typedef struct PSI_table_share* (*get_table_share_v1_t)
425  (my_bool temporary, struct TABLE_SHARE *share);
426typedef void (*release_table_share_v1_t)(struct PSI_table_share *share);
427typedef void (*drop_table_share_v1_t)
428  (my_bool temporary, const char *schema_name, int schema_name_length,
429   const char *table_name, int table_name_length);
430typedef struct PSI_table* (*open_table_v1_t)
431  (struct PSI_table_share *share, const void *identity);
432typedef void (*unbind_table_v1_t)
433  (struct PSI_table *table);
434typedef PSI_table* (*rebind_table_v1_t)
435  (PSI_table_share *share, const void *identity, PSI_table *table);
436typedef void (*close_table_v1_t)(struct TABLE_SHARE *server_share,
437                                 struct PSI_table *table);
438typedef void (*create_file_v1_t)(PSI_file_key key, const char *name,
439                                 File file);
440typedef int (*spawn_thread_v1_t)(PSI_thread_key key,
441                                 pthread_t *thread,
442                                 const pthread_attr_t *attr,
443                                 void *(*start_routine)(void*), void *arg);
444typedef struct PSI_thread* (*new_thread_v1_t)
445  (PSI_thread_key key, const void *identity, ulonglong thread_id);
446typedef void (*set_thread_THD_v1_t)(struct PSI_thread *thread,
447                                    THD *thd);
448typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread,
449                                   ulonglong id);
450typedef void (*set_thread_os_id_v1_t)(struct PSI_thread *thread);
451typedef struct PSI_thread* (*get_thread_v1_t)(void);
452typedef void (*set_thread_user_v1_t)(const char *user, int user_len);
453typedef void (*set_thread_account_v1_t)(const char *user, int user_len,
454                                        const char *host, int host_len);
455typedef void (*set_thread_db_v1_t)(const char* db, int db_len);
456typedef void (*set_thread_command_v1_t)(int command);
457typedef void (*set_connection_type_v1_t)(opaque_vio_type conn_type);
458typedef void (*set_thread_start_time_v1_t)(time_t start_time);
459typedef void (*set_thread_state_v1_t)(const char* state);
460typedef void (*set_thread_info_v1_t)(const char* info, uint info_len);
461typedef void (*set_thread_v1_t)(struct PSI_thread *thread);
462typedef void (*delete_current_thread_v1_t)(void);
463typedef void (*delete_thread_v1_t)(struct PSI_thread *thread);
464typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t)
465  (struct PSI_file_locker_state_v1 *state,
466   PSI_file_key key, enum PSI_file_operation op, const char *name,
467   const void *identity);
468typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t)
469  (struct PSI_file_locker_state_v1 *state,
470   struct PSI_file *file, enum PSI_file_operation op);
471typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t)
472  (struct PSI_file_locker_state_v1 *state,
473   File file, enum PSI_file_operation op);
474typedef void (*unlock_mutex_v1_t)
475  (struct PSI_mutex *mutex);
476typedef void (*unlock_rwlock_v1_t)
477  (struct PSI_rwlock *rwlock);
478typedef void (*signal_cond_v1_t)
479  (struct PSI_cond *cond);
480typedef void (*broadcast_cond_v1_t)
481  (struct PSI_cond *cond);
482typedef struct PSI_idle_locker* (*start_idle_wait_v1_t)
483  (struct PSI_idle_locker_state_v1 *state, const char *src_file, uint src_line);
484typedef void (*end_idle_wait_v1_t)
485  (struct PSI_idle_locker *locker);
486typedef struct PSI_mutex_locker* (*start_mutex_wait_v1_t)
487  (struct PSI_mutex_locker_state_v1 *state,
488   struct PSI_mutex *mutex,
489   enum PSI_mutex_operation op,
490   const char *src_file, uint src_line);
491typedef void (*end_mutex_wait_v1_t)
492  (struct PSI_mutex_locker *locker, int rc);
493typedef struct PSI_rwlock_locker* (*start_rwlock_rdwait_v1_t)
494  (struct PSI_rwlock_locker_state_v1 *state,
495   struct PSI_rwlock *rwlock,
496   enum PSI_rwlock_operation op,
497   const char *src_file, uint src_line);
498typedef void (*end_rwlock_rdwait_v1_t)
499  (struct PSI_rwlock_locker *locker, int rc);
500typedef struct PSI_rwlock_locker* (*start_rwlock_wrwait_v1_t)
501  (struct PSI_rwlock_locker_state_v1 *state,
502   struct PSI_rwlock *rwlock,
503   enum PSI_rwlock_operation op,
504   const char *src_file, uint src_line);
505typedef void (*end_rwlock_wrwait_v1_t)
506  (struct PSI_rwlock_locker *locker, int rc);
507typedef struct PSI_cond_locker* (*start_cond_wait_v1_t)
508  (struct PSI_cond_locker_state_v1 *state,
509   struct PSI_cond *cond,
510   struct PSI_mutex *mutex,
511   enum PSI_cond_operation op,
512   const char *src_file, uint src_line);
513typedef void (*end_cond_wait_v1_t)
514  (struct PSI_cond_locker *locker, int rc);
515typedef struct PSI_table_locker* (*start_table_io_wait_v1_t)
516  (struct PSI_table_locker_state *state,
517   struct PSI_table *table,
518   enum PSI_table_io_operation op,
519   uint index,
520   const char *src_file, uint src_line);
521typedef void (*end_table_io_wait_v1_t)
522  (struct PSI_table_locker *locker,
523   ulonglong numrows);
524typedef struct PSI_table_locker* (*start_table_lock_wait_v1_t)
525  (struct PSI_table_locker_state *state,
526   struct PSI_table *table,
527   enum PSI_table_lock_operation op,
528   ulong flags,
529   const char *src_file, uint src_line);
530typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker);
531typedef void (*unlock_table_v1_t)(struct PSI_table *table);
532typedef void (*start_file_open_wait_v1_t)
533  (struct PSI_file_locker *locker, const char *src_file, uint src_line);
534typedef struct PSI_file* (*end_file_open_wait_v1_t)
535  (struct PSI_file_locker *locker, void *result);
536typedef void (*end_file_open_wait_and_bind_to_descriptor_v1_t)
537  (struct PSI_file_locker *locker, File file);
538typedef void (*end_temp_file_open_wait_and_bind_to_descriptor_v1_t)
539  (struct PSI_file_locker *locker, File file, const char *filename);
540typedef void (*start_file_wait_v1_t)
541  (struct PSI_file_locker *locker, size_t count,
542   const char *src_file, uint src_line);
543typedef void (*end_file_wait_v1_t)
544  (struct PSI_file_locker *locker, size_t count);
545typedef void (*start_file_close_wait_v1_t)
546  (struct PSI_file_locker *locker, const char *src_file, uint src_line);
547typedef void (*end_file_close_wait_v1_t)
548  (struct PSI_file_locker *locker, int rc);
549typedef void (*end_file_rename_wait_v1_t)
550  (struct PSI_file_locker *locker, const char *old_name,
551   const char *new_name, int rc);
552typedef PSI_stage_progress* (*start_stage_v1_t)
553  (PSI_stage_key key, const char *src_file, int src_line);
554typedef PSI_stage_progress* (*get_current_stage_progress_v1_t)(void);
555typedef void (*end_stage_v1_t) (void);
556typedef struct PSI_statement_locker* (*get_thread_statement_locker_v1_t)
557  (struct PSI_statement_locker_state_v1 *state,
558   PSI_statement_key key, const void *charset, PSI_sp_share *sp_share);
559typedef struct PSI_statement_locker* (*refine_statement_v1_t)
560  (struct PSI_statement_locker *locker,
561   PSI_statement_key key);
562typedef void (*start_statement_v1_t)
563  (struct PSI_statement_locker *locker,
564   const char *db, uint db_length,
565   const char *src_file, uint src_line);
566typedef void (*set_statement_text_v1_t)
567  (struct PSI_statement_locker *locker,
568   const char *text, uint text_len);
569typedef void (*set_statement_lock_time_t)
570  (struct PSI_statement_locker *locker, ulonglong lock_time);
571typedef void (*set_statement_rows_sent_t)
572  (struct PSI_statement_locker *locker, ulonglong count);
573typedef void (*set_statement_rows_examined_t)
574  (struct PSI_statement_locker *locker, ulonglong count);
575typedef void (*inc_statement_created_tmp_disk_tables_t)
576  (struct PSI_statement_locker *locker, ulong count);
577typedef void (*inc_statement_created_tmp_tables_t)
578  (struct PSI_statement_locker *locker, ulong count);
579typedef void (*inc_statement_select_full_join_t)
580  (struct PSI_statement_locker *locker, ulong count);
581typedef void (*inc_statement_select_full_range_join_t)
582  (struct PSI_statement_locker *locker, ulong count);
583typedef void (*inc_statement_select_range_t)
584  (struct PSI_statement_locker *locker, ulong count);
585typedef void (*inc_statement_select_range_check_t)
586  (struct PSI_statement_locker *locker, ulong count);
587typedef void (*inc_statement_select_scan_t)
588  (struct PSI_statement_locker *locker, ulong count);
589typedef void (*inc_statement_sort_merge_passes_t)
590  (struct PSI_statement_locker *locker, ulong count);
591typedef void (*inc_statement_sort_range_t)
592  (struct PSI_statement_locker *locker, ulong count);
593typedef void (*inc_statement_sort_rows_t)
594  (struct PSI_statement_locker *locker, ulong count);
595typedef void (*inc_statement_sort_scan_t)
596  (struct PSI_statement_locker *locker, ulong count);
597typedef void (*set_statement_no_index_used_t)
598  (struct PSI_statement_locker *locker);
599typedef void (*set_statement_no_good_index_used_t)
600  (struct PSI_statement_locker *locker);
601typedef void (*end_statement_v1_t)
602  (struct PSI_statement_locker *locker, void *stmt_da);
603typedef struct PSI_transaction_locker* (*get_thread_transaction_locker_v1_t)
604  (struct PSI_transaction_locker_state_v1 *state, const void *xid,
605   ulonglong trxid, int isolation_level, my_bool read_only,
606   my_bool autocommit);
607typedef void (*start_transaction_v1_t)
608  (struct PSI_transaction_locker *locker,
609   const char *src_file, uint src_line);
610typedef void (*set_transaction_xid_v1_t)
611  (struct PSI_transaction_locker *locker,
612   const void *xid, int xa_state);
613typedef void (*set_transaction_xa_state_v1_t)
614  (struct PSI_transaction_locker *locker,
615   int xa_state);
616typedef void (*set_transaction_gtid_v1_t)
617  (struct PSI_transaction_locker *locker,
618   const void *sid, const void *gtid_spec);
619typedef void (*set_transaction_trxid_v1_t)
620  (struct PSI_transaction_locker *locker,
621   const ulonglong *trxid);
622typedef void (*inc_transaction_savepoints_v1_t)
623  (struct PSI_transaction_locker *locker, ulong count);
624typedef void (*inc_transaction_rollback_to_savepoint_v1_t)
625  (struct PSI_transaction_locker *locker, ulong count);
626typedef void (*inc_transaction_release_savepoint_v1_t)
627  (struct PSI_transaction_locker *locker, ulong count);
628typedef void (*end_transaction_v1_t)
629  (struct PSI_transaction_locker *locker,
630   my_bool commit);
631typedef struct PSI_socket_locker* (*start_socket_wait_v1_t)
632  (struct PSI_socket_locker_state_v1 *state,
633   struct PSI_socket *socket,
634   enum PSI_socket_operation op,
635   size_t count,
636   const char *src_file, uint src_line);
637typedef void (*end_socket_wait_v1_t)
638  (struct PSI_socket_locker *locker, size_t count);
639typedef void (*set_socket_state_v1_t)(struct PSI_socket *socket,
640                                      enum PSI_socket_state state);
641typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket,
642                                     const my_socket *fd,
643                                     const struct sockaddr *addr,
644                                     socklen_t addr_len);
645typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket);
646typedef PSI_prepared_stmt* (*create_prepared_stmt_v1_t)
647  (void *identity, uint stmt_id, PSI_statement_locker *locker,
648   const char *stmt_name, size_t stmt_name_length);
649typedef void (*destroy_prepared_stmt_v1_t)
650  (PSI_prepared_stmt *prepared_stmt);
651typedef void (*reprepare_prepared_stmt_v1_t)
652  (PSI_prepared_stmt *prepared_stmt);
653typedef void (*execute_prepared_stmt_v1_t)
654  (PSI_statement_locker *locker, PSI_prepared_stmt* prepared_stmt);
655typedef void (*set_prepared_stmt_text_v1_t)(PSI_prepared_stmt *prepared_stmt,
656                                            const char *text,
657                                            uint text_len);
658typedef struct PSI_digest_locker * (*digest_start_v1_t)
659  (struct PSI_statement_locker *locker);
660typedef void (*digest_end_v1_t)
661  (struct PSI_digest_locker *locker, const struct sql_digest_storage *digest);
662typedef PSI_sp_locker* (*start_sp_v1_t)
663  (struct PSI_sp_locker_state_v1 *state, struct PSI_sp_share* sp_share);
664typedef void (*end_sp_v1_t)
665  (struct PSI_sp_locker *locker);
666typedef void (*drop_sp_v1_t)
667  (uint object_type,
668   const char *schema_name, uint schema_name_length,
669   const char *object_name, uint object_name_length);
670typedef struct PSI_sp_share* (*get_sp_share_v1_t)
671  (uint object_type,
672   const char *schema_name, uint schema_name_length,
673   const char *object_name, uint object_name_length);
674typedef void (*release_sp_share_v1_t)(struct PSI_sp_share *share);
675typedef PSI_metadata_lock* (*create_metadata_lock_v1_t)
676  (void *identity,
677   const MDL_key *key,
678   opaque_mdl_type mdl_type,
679   opaque_mdl_duration mdl_duration,
680   opaque_mdl_status mdl_status,
681   const char *src_file,
682   uint src_line);
683typedef void (*set_metadata_lock_status_v1_t)(PSI_metadata_lock *lock,
684                                              opaque_mdl_status mdl_status);
685typedef void (*destroy_metadata_lock_v1_t)(PSI_metadata_lock *lock);
686typedef struct PSI_metadata_locker* (*start_metadata_wait_v1_t)
687  (struct PSI_metadata_locker_state_v1 *state,
688   struct PSI_metadata_lock *mdl,
689   const char *src_file, uint src_line);
690typedef void (*end_metadata_wait_v1_t)
691  (struct PSI_metadata_locker *locker, int rc);
692typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length,
693                                             const void *from_cs);
694struct PSI_v1
695{
696  register_mutex_v1_t register_mutex;
697  register_rwlock_v1_t register_rwlock;
698  register_cond_v1_t register_cond;
699  register_thread_v1_t register_thread;
700  register_file_v1_t register_file;
701  register_stage_v1_t register_stage;
702  register_statement_v1_t register_statement;
703  register_socket_v1_t register_socket;
704  init_mutex_v1_t init_mutex;
705  destroy_mutex_v1_t destroy_mutex;
706  init_rwlock_v1_t init_rwlock;
707  destroy_rwlock_v1_t destroy_rwlock;
708  init_cond_v1_t init_cond;
709  destroy_cond_v1_t destroy_cond;
710  init_socket_v1_t init_socket;
711  destroy_socket_v1_t destroy_socket;
712  get_table_share_v1_t get_table_share;
713  release_table_share_v1_t release_table_share;
714  drop_table_share_v1_t drop_table_share;
715  open_table_v1_t open_table;
716  unbind_table_v1_t unbind_table;
717  rebind_table_v1_t rebind_table;
718  close_table_v1_t close_table;
719  create_file_v1_t create_file;
720  spawn_thread_v1_t spawn_thread;
721  new_thread_v1_t new_thread;
722  set_thread_id_v1_t set_thread_id;
723  set_thread_THD_v1_t set_thread_THD;
724  set_thread_os_id_v1_t set_thread_os_id;
725  get_thread_v1_t get_thread;
726  set_thread_user_v1_t set_thread_user;
727  set_thread_account_v1_t set_thread_account;
728  set_thread_db_v1_t set_thread_db;
729  set_thread_command_v1_t set_thread_command;
730  set_connection_type_v1_t set_connection_type;
731  set_thread_start_time_v1_t set_thread_start_time;
732  set_thread_state_v1_t set_thread_state;
733  set_thread_info_v1_t set_thread_info;
734  set_thread_v1_t set_thread;
735  delete_current_thread_v1_t delete_current_thread;
736  delete_thread_v1_t delete_thread;
737  get_thread_file_name_locker_v1_t get_thread_file_name_locker;
738  get_thread_file_stream_locker_v1_t get_thread_file_stream_locker;
739  get_thread_file_descriptor_locker_v1_t get_thread_file_descriptor_locker;
740  unlock_mutex_v1_t unlock_mutex;
741  unlock_rwlock_v1_t unlock_rwlock;
742  signal_cond_v1_t signal_cond;
743  broadcast_cond_v1_t broadcast_cond;
744  start_idle_wait_v1_t start_idle_wait;
745  end_idle_wait_v1_t end_idle_wait;
746  start_mutex_wait_v1_t start_mutex_wait;
747  end_mutex_wait_v1_t end_mutex_wait;
748  start_rwlock_rdwait_v1_t start_rwlock_rdwait;
749  end_rwlock_rdwait_v1_t end_rwlock_rdwait;
750  start_rwlock_wrwait_v1_t start_rwlock_wrwait;
751  end_rwlock_wrwait_v1_t end_rwlock_wrwait;
752  start_cond_wait_v1_t start_cond_wait;
753  end_cond_wait_v1_t end_cond_wait;
754  start_table_io_wait_v1_t start_table_io_wait;
755  end_table_io_wait_v1_t end_table_io_wait;
756  start_table_lock_wait_v1_t start_table_lock_wait;
757  end_table_lock_wait_v1_t end_table_lock_wait;
758  start_file_open_wait_v1_t start_file_open_wait;
759  end_file_open_wait_v1_t end_file_open_wait;
760  end_file_open_wait_and_bind_to_descriptor_v1_t
761    end_file_open_wait_and_bind_to_descriptor;
762  end_temp_file_open_wait_and_bind_to_descriptor_v1_t
763    end_temp_file_open_wait_and_bind_to_descriptor;
764  start_file_wait_v1_t start_file_wait;
765  end_file_wait_v1_t end_file_wait;
766  start_file_close_wait_v1_t start_file_close_wait;
767  end_file_close_wait_v1_t end_file_close_wait;
768  end_file_rename_wait_v1_t end_file_rename_wait;
769  start_stage_v1_t start_stage;
770  get_current_stage_progress_v1_t get_current_stage_progress;
771  end_stage_v1_t end_stage;
772  get_thread_statement_locker_v1_t get_thread_statement_locker;
773  refine_statement_v1_t refine_statement;
774  start_statement_v1_t start_statement;
775  set_statement_text_v1_t set_statement_text;
776  set_statement_lock_time_t set_statement_lock_time;
777  set_statement_rows_sent_t set_statement_rows_sent;
778  set_statement_rows_examined_t set_statement_rows_examined;
779  inc_statement_created_tmp_disk_tables_t inc_statement_created_tmp_disk_tables;
780  inc_statement_created_tmp_tables_t inc_statement_created_tmp_tables;
781  inc_statement_select_full_join_t inc_statement_select_full_join;
782  inc_statement_select_full_range_join_t inc_statement_select_full_range_join;
783  inc_statement_select_range_t inc_statement_select_range;
784  inc_statement_select_range_check_t inc_statement_select_range_check;
785  inc_statement_select_scan_t inc_statement_select_scan;
786  inc_statement_sort_merge_passes_t inc_statement_sort_merge_passes;
787  inc_statement_sort_range_t inc_statement_sort_range;
788  inc_statement_sort_rows_t inc_statement_sort_rows;
789  inc_statement_sort_scan_t inc_statement_sort_scan;
790  set_statement_no_index_used_t set_statement_no_index_used;
791  set_statement_no_good_index_used_t set_statement_no_good_index_used;
792  end_statement_v1_t end_statement;
793  get_thread_transaction_locker_v1_t get_thread_transaction_locker;
794  start_transaction_v1_t start_transaction;
795  set_transaction_xid_v1_t set_transaction_xid;
796  set_transaction_xa_state_v1_t set_transaction_xa_state;
797  set_transaction_gtid_v1_t set_transaction_gtid;
798  set_transaction_trxid_v1_t set_transaction_trxid;
799  inc_transaction_savepoints_v1_t inc_transaction_savepoints;
800  inc_transaction_rollback_to_savepoint_v1_t inc_transaction_rollback_to_savepoint;
801  inc_transaction_release_savepoint_v1_t inc_transaction_release_savepoint;
802  end_transaction_v1_t end_transaction;
803  start_socket_wait_v1_t start_socket_wait;
804  end_socket_wait_v1_t end_socket_wait;
805  set_socket_state_v1_t set_socket_state;
806  set_socket_info_v1_t set_socket_info;
807  set_socket_thread_owner_v1_t set_socket_thread_owner;
808  create_prepared_stmt_v1_t create_prepared_stmt;
809  destroy_prepared_stmt_v1_t destroy_prepared_stmt;
810  reprepare_prepared_stmt_v1_t reprepare_prepared_stmt;
811  execute_prepared_stmt_v1_t execute_prepared_stmt;
812  set_prepared_stmt_text_v1_t set_prepared_stmt_text;
813  digest_start_v1_t digest_start;
814  digest_end_v1_t digest_end;
815  set_thread_connect_attrs_v1_t set_thread_connect_attrs;
816  start_sp_v1_t start_sp;
817  end_sp_v1_t end_sp;
818  drop_sp_v1_t drop_sp;
819  get_sp_share_v1_t get_sp_share;
820  release_sp_share_v1_t release_sp_share;
821  register_memory_v1_t register_memory;
822  memory_alloc_v1_t memory_alloc;
823  memory_realloc_v1_t memory_realloc;
824  memory_claim_v1_t memory_claim;
825  memory_free_v1_t memory_free;
826  unlock_table_v1_t unlock_table;
827  create_metadata_lock_v1_t create_metadata_lock;
828  set_metadata_lock_status_v1_t set_metadata_lock_status;
829  destroy_metadata_lock_v1_t destroy_metadata_lock;
830  start_metadata_wait_v1_t start_metadata_wait;
831  end_metadata_wait_v1_t end_metadata_wait;
832};
833typedef struct PSI_v1 PSI;
834typedef struct PSI_mutex_info_v1 PSI_mutex_info;
835typedef struct PSI_rwlock_info_v1 PSI_rwlock_info;
836typedef struct PSI_cond_info_v1 PSI_cond_info;
837typedef struct PSI_thread_info_v1 PSI_thread_info;
838typedef struct PSI_file_info_v1 PSI_file_info;
839typedef struct PSI_stage_info_v1 PSI_stage_info;
840typedef struct PSI_statement_info_v1 PSI_statement_info;
841typedef struct PSI_transaction_info_v1 PSI_transaction_info;
842typedef struct PSI_socket_info_v1 PSI_socket_info;
843typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state;
844typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state;
845typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state;
846typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state;
847typedef struct PSI_file_locker_state_v1 PSI_file_locker_state;
848typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state;
849typedef struct PSI_transaction_locker_state_v1 PSI_transaction_locker_state;
850typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state;
851typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state;
852typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state;
853extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
854C_MODE_END
855