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