Coverage Report

Created: 2025-06-13 07:09

/src/server/mysys/psi_noop.c
Line
Count
Source (jump to first uncovered line)
1
/* Copyright (c) 2011, 2022, Oracle and/or its affiliates.
2
3
  This program is free software; you can redistribute it and/or modify
4
  it under the terms of the GNU General Public License, version 2.0,
5
  as published by the Free Software Foundation.
6
7
  This program is also distributed with certain software (including
8
  but not limited to OpenSSL) that is licensed under separate terms,
9
  as designated in a particular file or component or in included license
10
  documentation.  The authors of MySQL hereby grant you an additional
11
  permission to link the program and your derivative works with the
12
  separately licensed software that they have included with MySQL.
13
14
  Without limiting anything contained in the foregoing, this file,
15
  which is part of C Driver for MySQL (Connector/C), is also subject to the
16
  Universal FOSS Exception, version 1.0, a copy of which can be found at
17
  http://oss.oracle.com/licenses/universal-foss-exception.
18
19
  This program is distributed in the hope that it will be useful,
20
  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
  GNU General Public License, version 2.0, for more details.
23
24
  You should have received a copy of the GNU General Public License
25
  along with this program; if not, write to the Free Software Foundation,
26
  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
27
28
/*
29
  Always provide the noop performance interface, for plugins.
30
*/
31
32
#define USE_PSI_V1
33
#define HAVE_PSI_INTERFACE
34
35
#include "my_global.h"
36
#include "my_pthread.h"
37
#include "my_sys.h"
38
#include "mysql/psi/psi.h"
39
40
C_MODE_START
41
42
#define NNN __attribute__((unused))
43
44
static void register_mutex_noop(const char *category NNN,
45
                                PSI_mutex_info *info NNN,
46
                                int count NNN)
47
0
{
48
0
  return;
49
0
}
50
51
static void register_rwlock_noop(const char *category NNN,
52
                                 PSI_rwlock_info *info NNN,
53
                                 int count NNN)
54
0
{
55
0
  return;
56
0
}
57
58
static void register_cond_noop(const char *category NNN,
59
                               PSI_cond_info *info NNN,
60
                               int count NNN)
61
0
{
62
0
  return;
63
0
}
64
65
static void register_thread_noop(const char *category NNN,
66
                                 PSI_thread_info *info NNN,
67
                                 int count NNN)
68
0
{
69
0
  return;
70
0
}
71
72
static void register_file_noop(const char *category NNN,
73
                               PSI_file_info *info NNN,
74
                               int count NNN)
75
0
{
76
0
  return;
77
0
}
78
79
static void register_stage_noop(const char *category NNN,
80
                                PSI_stage_info **info_array NNN,
81
                                int count NNN)
82
0
{
83
0
  return;
84
0
}
85
86
static void register_statement_noop(const char *category NNN,
87
                                    PSI_statement_info *info NNN,
88
                                    int count NNN)
89
0
{
90
0
  return;
91
0
}
92
93
static void register_socket_noop(const char *category NNN,
94
                                 PSI_socket_info *info NNN,
95
                                 int count NNN)
96
0
{
97
0
  return;
98
0
}
99
100
static PSI_mutex*
101
init_mutex_noop(PSI_mutex_key key NNN, void *identity NNN)
102
0
{
103
0
  return NULL;
104
0
}
105
106
static void destroy_mutex_noop(PSI_mutex* mutex NNN)
107
0
{
108
0
  return;
109
0
}
110
111
static PSI_rwlock*
112
init_rwlock_noop(PSI_rwlock_key key NNN, void *identity NNN)
113
0
{
114
0
  return NULL;
115
0
}
116
117
static void destroy_rwlock_noop(PSI_rwlock* rwlock NNN)
118
0
{
119
0
  return;
120
0
}
121
122
static PSI_cond*
123
init_cond_noop(PSI_cond_key key NNN, void *identity NNN)
124
0
{
125
0
  return NULL;
126
0
}
127
128
static void destroy_cond_noop(PSI_cond* cond NNN)
129
0
{
130
0
  return;
131
0
}
132
133
static PSI_socket*
134
init_socket_noop(PSI_socket_key key NNN, const my_socket *fd NNN,
135
                 const struct sockaddr *addr NNN, socklen_t addr_len NNN)
136
0
{
137
0
  return NULL;
138
0
}
139
140
static void destroy_socket_noop(PSI_socket* socket NNN)
141
0
{
142
0
  return;
143
0
}
144
145
static PSI_table_share*
146
get_table_share_noop(my_bool temporary NNN, struct TABLE_SHARE *share NNN)
147
0
{
148
0
  return NULL;
149
0
}
150
151
static void release_table_share_noop(PSI_table_share* share NNN)
152
0
{
153
0
  return;
154
0
}
155
156
static void
157
drop_table_share_noop(my_bool temporary NNN, const char *schema_name NNN,
158
                      int schema_name_length NNN, const char *table_name NNN,
159
                      int table_name_length NNN)
160
0
{
161
0
  return;
162
0
}
163
164
static PSI_table*
165
open_table_noop(PSI_table_share *share NNN, const void *identity NNN)
166
0
{
167
0
  return NULL;
168
0
}
169
170
static void unbind_table_noop(PSI_table *table NNN)
171
0
{
172
0
  return;
173
0
}
174
175
static PSI_table*
176
rebind_table_noop(PSI_table_share *share NNN,
177
                  const void *identity NNN,
178
                  PSI_table *table NNN)
179
0
{
180
0
  return NULL;
181
0
}
182
183
static void close_table_noop(struct TABLE_SHARE *share NNN,
184
                             PSI_table *table NNN)
185
0
{
186
0
  return;
187
0
}
188
189
static void create_file_noop(PSI_file_key key NNN,
190
                             const char *name NNN, File file NNN)
191
0
{
192
0
  return;
193
0
}
194
195
static int spawn_thread_noop(PSI_thread_key key NNN,
196
                             pthread_t *thread NNN,
197
                             const pthread_attr_t *attr NNN,
198
                             void *(*start_routine)(void*) NNN, void *arg NNN)
199
0
{
200
0
  return pthread_create(thread, attr, start_routine, arg);
201
0
}
202
203
static PSI_thread*
204
new_thread_noop(PSI_thread_key key NNN,
205
                const void *identity NNN, ulonglong thread_id NNN)
206
0
{
207
0
  return NULL;
208
0
}
209
210
static void set_thread_id_noop(PSI_thread *thread NNN, ulonglong id NNN)
211
0
{
212
0
  return;
213
0
}
214
215
static void set_thread_THD_noop(PSI_thread *thread NNN, THD *thd NNN)
216
0
{
217
0
  return;
218
0
}
219
220
static void set_thread_os_id_noop(PSI_thread *thread NNN)
221
0
{
222
0
  return;
223
0
}
224
225
static PSI_thread*
226
get_thread_noop(void NNN)
227
0
{
228
0
  return NULL;
229
0
}
230
231
static const char* get_thread_class_name_noop(void)
232
0
{
233
0
  return NULL;
234
0
}
235
236
static void set_thread_user_noop(const char *user NNN, int user_len NNN)
237
0
{
238
0
  return;
239
0
}
240
241
static void set_thread_user_host_noop(const char *user NNN, int user_len NNN,
242
                                      const char *host NNN, int host_len NNN)
243
0
{
244
0
  return;
245
0
}
246
247
static void set_thread_db_noop(const char* db NNN, int db_len NNN)
248
0
{
249
0
  return;
250
0
}
251
252
static void set_thread_command_noop(int command NNN)
253
0
{
254
0
  return;
255
0
}
256
257
static void set_connection_type_noop(opaque_vio_type conn_type NNN)
258
0
{
259
0
  return;
260
0
}
261
262
static void set_thread_start_time_noop(time_t start_time NNN)
263
0
{
264
0
  return;
265
0
}
266
267
static void set_thread_state_noop(const char* state NNN)
268
0
{
269
0
  return;
270
0
}
271
272
static void set_thread_info_noop(const char* info NNN, uint info_len NNN)
273
0
{
274
0
  return;
275
0
}
276
277
static void set_thread_noop(PSI_thread* thread NNN)
278
0
{
279
0
  return;
280
0
}
281
282
static void set_thread_peer_port_noop(PSI_thread * thread NNN, uint port NNN)
283
0
{
284
0
  return;
285
0
}
286
287
static void delete_current_thread_noop(void)
288
0
{
289
0
  return;
290
0
}
291
292
static void delete_thread_noop(PSI_thread *thread NNN)
293
0
{
294
0
  return;
295
0
}
296
297
static PSI_file_locker*
298
get_thread_file_name_locker_noop(PSI_file_locker_state *state NNN,
299
                                 PSI_file_key key NNN,
300
                                 enum PSI_file_operation op NNN,
301
                                 const char *name NNN, const void *identity NNN)
302
0
{
303
0
  return NULL;
304
0
}
305
306
static PSI_file_locker*
307
get_thread_file_stream_locker_noop(PSI_file_locker_state *state NNN,
308
                                   PSI_file *file NNN,
309
                                   enum PSI_file_operation op NNN)
310
0
{
311
0
  return NULL;
312
0
}
313
314
315
static PSI_file_locker*
316
get_thread_file_descriptor_locker_noop(PSI_file_locker_state *state NNN,
317
                                       File file NNN,
318
                                       enum PSI_file_operation op NNN)
319
0
{
320
0
  return NULL;
321
0
}
322
323
static void unlock_mutex_noop(PSI_mutex *mutex NNN)
324
0
{
325
0
  return;
326
0
}
327
328
static void unlock_rwlock_noop(PSI_rwlock *rwlock NNN)
329
0
{
330
0
  return;
331
0
}
332
333
static void signal_cond_noop(PSI_cond* cond NNN)
334
0
{
335
0
  return;
336
0
}
337
338
static void broadcast_cond_noop(PSI_cond* cond NNN)
339
0
{
340
0
  return;
341
0
}
342
343
static PSI_idle_locker*
344
start_idle_wait_noop(PSI_idle_locker_state* state NNN,
345
                     const char *src_file NNN, uint src_line NNN)
346
0
{
347
0
  return NULL;
348
0
}
349
350
static void end_idle_wait_noop(PSI_idle_locker* locker NNN)
351
0
{
352
0
  return;
353
0
}
354
355
static PSI_mutex_locker*
356
start_mutex_wait_noop(PSI_mutex_locker_state *state NNN,
357
                      PSI_mutex *mutex NNN,
358
                      PSI_mutex_operation op NNN,
359
                      const char *src_file NNN, uint src_line NNN)
360
0
{
361
0
  return NULL;
362
0
}
363
364
static void end_mutex_wait_noop(PSI_mutex_locker* locker NNN, int rc NNN)
365
0
{
366
0
  return;
367
0
}
368
369
370
static PSI_rwlock_locker*
371
start_rwlock_rdwait_noop(struct PSI_rwlock_locker_state_v1 *state NNN,
372
                         struct PSI_rwlock *rwlock NNN,
373
                         enum PSI_rwlock_operation op NNN,
374
                         const char *src_file NNN, uint src_line NNN)
375
0
{
376
0
  return NULL;
377
0
}
378
379
static void end_rwlock_rdwait_noop(PSI_rwlock_locker* locker NNN, int rc NNN)
380
0
{
381
0
  return;
382
0
}
383
384
static struct PSI_rwlock_locker*
385
start_rwlock_wrwait_noop(struct PSI_rwlock_locker_state_v1 *state NNN,
386
                         struct PSI_rwlock *rwlock NNN,
387
                         enum PSI_rwlock_operation op NNN,
388
                         const char *src_file NNN, uint src_line NNN)
389
0
{
390
0
  return NULL;
391
0
}
392
393
static void end_rwlock_wrwait_noop(PSI_rwlock_locker* locker NNN, int rc NNN)
394
0
{
395
0
  return;
396
0
}
397
398
static struct PSI_cond_locker*
399
start_cond_wait_noop(struct PSI_cond_locker_state_v1 *state NNN,
400
                     struct PSI_cond *cond NNN,
401
                     struct PSI_mutex *mutex NNN,
402
                     enum PSI_cond_operation op NNN,
403
                     const char *src_file NNN, uint src_line NNN)
404
0
{
405
0
  return NULL;
406
0
}
407
408
static void end_cond_wait_noop(PSI_cond_locker* locker NNN, int rc NNN)
409
0
{
410
0
  return;
411
0
}
412
413
static struct PSI_table_locker*
414
start_table_io_wait_noop(struct PSI_table_locker_state *state NNN,
415
                         struct PSI_table *table NNN,
416
                         enum PSI_table_io_operation op NNN,
417
                         uint index NNN,
418
                         const char *src_file NNN, uint src_line NNN)
419
0
{
420
0
  return NULL;
421
0
}
422
423
static void end_table_io_wait_noop(PSI_table_locker* locker NNN,
424
                                   ulonglong numrows NNN)
425
0
{
426
0
  return;
427
0
}
428
429
static struct PSI_table_locker*
430
start_table_lock_wait_noop(struct PSI_table_locker_state *state NNN,
431
                           struct PSI_table *table NNN,
432
                           enum PSI_table_lock_operation op NNN,
433
                           ulong flags NNN,
434
                           const char *src_file NNN, uint src_line NNN)
435
0
{
436
0
  return NULL;
437
0
}
438
439
static void end_table_lock_wait_noop(PSI_table_locker* locker NNN)
440
0
{
441
0
  return;
442
0
}
443
444
static void start_file_open_wait_noop(PSI_file_locker *locker NNN,
445
                                      const char *src_file NNN,
446
                                      uint src_line NNN)
447
0
{
448
0
  return;
449
0
}
450
451
static PSI_file* end_file_open_wait_noop(PSI_file_locker *locker NNN,
452
                                         void *result NNN)
453
0
{
454
0
  return NULL;
455
0
}
456
457
static void end_file_open_wait_and_bind_to_descriptor_noop
458
  (PSI_file_locker *locker NNN, File file NNN)
459
0
{
460
0
  return;
461
0
}
462
463
static void end_temp_file_open_wait_and_bind_to_descriptor_noop
464
  (PSI_file_locker *locker NNN, File file NNN, const char *filename NNN)
465
0
{
466
0
  return;
467
0
}
468
469
static void start_file_wait_noop(PSI_file_locker *locker NNN,
470
                                 size_t count NNN,
471
                                 const char *src_file NNN,
472
                                 uint src_line NNN)
473
0
{
474
0
  return;
475
0
}
476
477
static void end_file_wait_noop(PSI_file_locker *locker NNN,
478
                               size_t count NNN)
479
0
{
480
0
  return;
481
0
}
482
483
static void start_file_close_wait_noop(PSI_file_locker *locker NNN,
484
                                       const char *src_file NNN,
485
                                       uint src_line NNN)
486
0
{
487
0
  return;
488
0
}
489
490
static void end_file_close_wait_noop(PSI_file_locker *locker NNN,
491
                                     int result NNN)
492
0
{
493
0
  return;
494
0
}
495
496
static void end_file_rename_wait_noop(PSI_file_locker *locker NNN,
497
                                      const char *old_name NNN,
498
                                      const char *new_name NNN,
499
                                      int result NNN)
500
0
{
501
0
  return;
502
0
}
503
504
static PSI_stage_progress*
505
start_stage_noop(PSI_stage_key key NNN,
506
                 const char *src_file NNN, int src_line NNN)
507
0
{
508
0
  return NULL;
509
0
}
510
511
static PSI_stage_progress*
512
get_current_stage_progress_noop(void)
513
0
{
514
0
  return NULL;
515
0
}
516
517
static void end_stage_noop(void)
518
0
{
519
0
  return;
520
0
}
521
522
static PSI_statement_locker*
523
get_thread_statement_locker_noop(PSI_statement_locker_state *state NNN,
524
                                 PSI_statement_key key NNN,
525
                                 const void *charset NNN,
526
                                 PSI_sp_share *sp_share NNN)
527
0
{
528
0
  return NULL;
529
0
}
530
531
static PSI_statement_locker*
532
refine_statement_noop(PSI_statement_locker *locker NNN,
533
                      PSI_statement_key key NNN)
534
0
{
535
0
  return NULL;
536
0
}
537
538
static void start_statement_noop(PSI_statement_locker *locker NNN,
539
                                 const char *db NNN, uint db_len NNN,
540
                                 const char *src_file NNN, uint src_line NNN)
541
0
{
542
0
  return;
543
0
}
544
545
static void set_statement_text_noop(PSI_statement_locker *locker NNN,
546
                                    const char *text NNN, uint text_len NNN)
547
0
{
548
0
  return;
549
0
}
550
551
static void set_statement_lock_time_noop(PSI_statement_locker *locker NNN,
552
                                         ulonglong count NNN)
553
0
{
554
0
  return;
555
0
}
556
557
static void set_statement_rows_sent_noop(PSI_statement_locker *locker NNN,
558
                                         ulonglong count NNN)
559
0
{
560
0
  return;
561
0
}
562
563
static void set_statement_rows_examined_noop(PSI_statement_locker *locker NNN,
564
                                             ulonglong count NNN)
565
0
{
566
0
  return;
567
0
}
568
569
static void inc_statement_created_tmp_disk_tables_noop(PSI_statement_locker *locker NNN,
570
                                                       ulong count NNN)
571
0
{
572
0
  return;
573
0
}
574
575
static void inc_statement_created_tmp_tables_noop(PSI_statement_locker *locker NNN,
576
                                                  ulong count NNN)
577
0
{
578
0
  return;
579
0
}
580
581
static void inc_statement_select_full_join_noop(PSI_statement_locker *locker NNN,
582
                                                ulong count NNN)
583
0
{
584
0
  return;
585
0
}
586
587
static void inc_statement_select_full_range_join_noop(PSI_statement_locker *locker NNN,
588
                                                      ulong count NNN)
589
0
{
590
0
  return;
591
0
}
592
593
static void inc_statement_select_range_noop(PSI_statement_locker *locker NNN,
594
                                            ulong count NNN)
595
0
{
596
0
  return;
597
0
}
598
599
static void inc_statement_select_range_check_noop(PSI_statement_locker *locker NNN,
600
                                                  ulong count NNN)
601
0
{
602
0
  return;
603
0
}
604
605
static void inc_statement_select_scan_noop(PSI_statement_locker *locker NNN,
606
                                           ulong count NNN)
607
0
{
608
0
  return;
609
0
}
610
611
static void inc_statement_sort_merge_passes_noop(PSI_statement_locker *locker NNN,
612
                                                 ulong count NNN)
613
0
{
614
0
  return;
615
0
}
616
617
static void inc_statement_sort_range_noop(PSI_statement_locker *locker NNN,
618
                                          ulong count NNN)
619
0
{
620
0
  return;
621
0
}
622
623
static void inc_statement_sort_rows_noop(PSI_statement_locker *locker NNN,
624
                                         ulong count NNN)
625
0
{
626
0
  return;
627
0
}
628
629
static void inc_statement_sort_scan_noop(PSI_statement_locker *locker NNN,
630
                                         ulong count NNN)
631
0
{
632
0
  return;
633
0
}
634
635
static void set_statement_no_index_used_noop(PSI_statement_locker *locker NNN)
636
0
{
637
0
  return;
638
0
}
639
640
static void set_statement_no_good_index_used_noop(PSI_statement_locker *locker NNN)
641
0
{
642
0
  return;
643
0
}
644
645
static void end_statement_noop(PSI_statement_locker *locker NNN,
646
                               void *stmt_da NNN)
647
0
{
648
0
  return;
649
0
}
650
651
static PSI_transaction_locker*
652
get_thread_transaction_locker_noop(PSI_transaction_locker_state *state NNN,
653
                                   const void *xid NNN,
654
                                   ulonglong trxid NNN,
655
                                   int isolation_level NNN,
656
                                   my_bool read_only NNN,
657
                                   my_bool autocommit NNN)
658
0
{
659
0
  return NULL;
660
0
}
661
662
static void start_transaction_noop(PSI_transaction_locker *locker NNN,
663
                                   const char *src_file NNN, uint src_line NNN)
664
0
{
665
0
  return;
666
0
}
667
668
static void set_transaction_xid_noop(PSI_transaction_locker *locker NNN,
669
                                     const void *xid NNN,
670
                                     int xa_state NNN)
671
0
{
672
0
  return;
673
0
}
674
675
static void set_transaction_xa_state_noop(PSI_transaction_locker *locker NNN,
676
                                          int xa_state NNN)
677
0
{
678
0
  return;
679
0
}
680
681
static void set_transaction_gtid_noop(PSI_transaction_locker *locker NNN,
682
                                      const void *sid NNN,
683
                                      const void *gtid_spec NNN)
684
0
{
685
0
  return;
686
0
}
687
688
static void set_transaction_trxid_noop(PSI_transaction_locker *locker NNN,
689
                                       const ulonglong *trxid NNN)
690
0
{
691
0
  return;
692
0
}
693
694
static void inc_transaction_savepoints_noop(PSI_transaction_locker *locker NNN,
695
                                            ulong count NNN)
696
0
{
697
0
  return;
698
0
}
699
700
static void inc_transaction_rollback_to_savepoint_noop(PSI_transaction_locker *locker NNN,
701
                                                       ulong count NNN)
702
0
{
703
0
  return;
704
0
}
705
706
static void inc_transaction_release_savepoint_noop(PSI_transaction_locker *locker NNN,
707
                                                   ulong count NNN)
708
0
{
709
0
  return;
710
0
}
711
712
static void end_transaction_noop(PSI_transaction_locker *locker NNN,
713
                                 my_bool commit NNN)
714
0
{
715
0
  return;
716
0
}
717
718
static PSI_socket_locker*
719
start_socket_wait_noop(PSI_socket_locker_state *state NNN,
720
                       PSI_socket *socket NNN,
721
                       PSI_socket_operation op NNN,
722
                       size_t count NNN,
723
                       const char *src_file NNN,
724
                       uint src_line NNN)
725
0
{
726
0
  return NULL;
727
0
}
728
729
static void end_socket_wait_noop(PSI_socket_locker *locker NNN,
730
                                 size_t count NNN)
731
0
{
732
0
  return;
733
0
}
734
735
static void set_socket_state_noop(PSI_socket *socket NNN,
736
                                  enum PSI_socket_state state NNN)
737
0
{
738
0
  return;
739
0
}
740
741
static void set_socket_info_noop(PSI_socket *socket NNN,
742
                                 const my_socket *fd NNN,
743
                                 const struct sockaddr *addr NNN,
744
                                 socklen_t addr_len NNN)
745
0
{
746
0
  return;
747
0
}
748
749
static void set_socket_thread_owner_noop(PSI_socket *socket NNN)
750
0
{
751
0
  return;
752
0
}
753
754
static PSI_prepared_stmt*
755
create_prepare_stmt_noop(void *identity NNN, uint stmt_id NNN,
756
                         PSI_statement_locker *locker NNN, 
757
                         const char *stmt_name NNN, size_t stmt_name_length NNN)
758
0
{
759
0
  return NULL;
760
0
}
761
762
static void
763
execute_prepare_stmt_noop(PSI_statement_locker *locker NNN,
764
                        PSI_prepared_stmt *prepared_stmt NNN)
765
0
{
766
0
  return;
767
0
}
768
769
static void set_prepared_stmt_text_noop(PSI_prepared_stmt *prepared_stmt NNN,
770
                                        const char *text NNN, uint text_len NNN)
771
0
{
772
0
  return;
773
0
}
774
775
void
776
destroy_prepared_stmt_noop(PSI_prepared_stmt *prepared_stmt NNN)
777
0
{
778
0
  return;
779
0
}
780
781
void
782
reprepare_prepared_stmt_noop(PSI_prepared_stmt *prepared_stmt NNN)
783
0
{
784
0
  return;
785
0
}
786
787
static struct PSI_digest_locker*
788
digest_start_noop(PSI_statement_locker *locker NNN)
789
0
{
790
0
  return NULL;
791
0
}
792
793
static void
794
digest_end_noop(PSI_digest_locker *locker NNN,
795
                const struct sql_digest_storage *digest NNN)
796
0
{
797
0
  return;
798
0
}
799
800
static int
801
set_thread_connect_attrs_noop(const char *buffer __attribute__ ((unused)),
802
                             uint length __attribute__ ((unused)),
803
                             const void *from_cs __attribute__ ((unused)))
804
0
{
805
0
  return 0;
806
0
}
807
808
static PSI_sp_locker*
809
pfs_start_sp_noop(PSI_sp_locker_state *state NNN, PSI_sp_share *sp_share NNN)
810
0
{
811
0
  return NULL;
812
0
}
813
814
static void pfs_end_sp_noop(PSI_sp_locker *locker NNN)
815
0
{
816
0
  return;
817
0
}
818
819
static void
820
pfs_drop_sp_noop(uint object_type NNN,
821
                 const char *schema_name NNN, uint schema_name_length NNN,
822
                 const char *object_name NNN, uint object_name_length NNN)
823
0
{
824
0
  return;
825
0
}
826
827
static PSI_sp_share*
828
pfs_get_sp_share_noop(uint object_type NNN,
829
                      const char *schema_name NNN, uint schema_name_length NNN,
830
                      const char *object_name NNN, uint object_name_length NNN)
831
0
{
832
0
  return NULL;
833
0
}
834
835
static void
836
pfs_release_sp_share_noop(PSI_sp_share *sp_share NNN)
837
0
{
838
0
  return;
839
0
}
840
841
static void register_memory_noop(const char *category NNN,
842
                                 PSI_memory_info *info NNN,
843
                                 int count NNN)
844
0
{
845
0
  return;
846
0
}
847
848
static PSI_memory_key memory_alloc_noop(PSI_memory_key key NNN, size_t size NNN, struct PSI_thread ** owner NNN)
849
0
{
850
0
  *owner= NULL;
851
0
  return PSI_NOT_INSTRUMENTED;
852
0
}
853
854
static PSI_memory_key memory_realloc_noop(PSI_memory_key key NNN, size_t old_size NNN, size_t new_size NNN, struct PSI_thread ** owner NNN)
855
0
{
856
0
  *owner= NULL;
857
0
  return PSI_NOT_INSTRUMENTED;
858
0
}
859
860
static PSI_memory_key memory_claim_noop(PSI_memory_key key NNN, size_t size NNN, struct PSI_thread ** owner)
861
0
{
862
0
  *owner= NULL;
863
0
  return PSI_NOT_INSTRUMENTED;
864
0
}
865
866
static void memory_free_noop(PSI_memory_key key NNN, size_t size NNN, struct PSI_thread * owner NNN)
867
0
{
868
0
  return;
869
0
}
870
871
static void unlock_table_noop(PSI_table *table NNN)
872
0
{
873
0
  return;
874
0
}
875
876
static PSI_metadata_lock *
877
create_metadata_lock_noop(void *identity NNN,
878
                          const MDL_key *mdl_key NNN,
879
                          opaque_mdl_type mdl_type NNN,
880
                          opaque_mdl_duration mdl_duration NNN,
881
                          opaque_mdl_status mdl_status NNN,
882
                          const char *src_file NNN,
883
                          uint src_line NNN)
884
0
{
885
0
  return NULL;
886
0
}
887
888
static void
889
set_metadata_lock_status_noop(PSI_metadata_lock* lock NNN,
890
                              opaque_mdl_status mdl_status NNN)
891
0
{
892
0
}
893
894
static void
895
destroy_metadata_lock_noop(PSI_metadata_lock* lock NNN)
896
0
{
897
0
}
898
899
static PSI_metadata_locker *
900
start_metadata_wait_noop(PSI_metadata_locker_state *state NNN,
901
                         PSI_metadata_lock *mdl NNN,
902
                         const char *src_file NNN,
903
                         uint src_line NNN)
904
0
{
905
0
  return NULL;
906
0
}
907
908
static void
909
end_metadata_wait_noop(PSI_metadata_locker *locker NNN,
910
                       int rc NNN)
911
0
{
912
0
}
913
914
static PSI PSI_noop=
915
{
916
  register_mutex_noop,
917
  register_rwlock_noop,
918
  register_cond_noop,
919
  register_thread_noop,
920
  register_file_noop,
921
  register_stage_noop,
922
  register_statement_noop,
923
  register_socket_noop,
924
  init_mutex_noop,
925
  destroy_mutex_noop,
926
  init_rwlock_noop,
927
  destroy_rwlock_noop,
928
  init_cond_noop,
929
  destroy_cond_noop,
930
  init_socket_noop,
931
  destroy_socket_noop,
932
  get_table_share_noop,
933
  release_table_share_noop,
934
  drop_table_share_noop,
935
  open_table_noop,
936
  unbind_table_noop,
937
  rebind_table_noop,
938
  close_table_noop,
939
  create_file_noop,
940
  spawn_thread_noop,
941
  new_thread_noop,
942
  set_thread_id_noop,
943
  set_thread_THD_noop,
944
  set_thread_os_id_noop,
945
  get_thread_noop,
946
  get_thread_class_name_noop,
947
  set_thread_user_noop,
948
  set_thread_user_host_noop,
949
  set_thread_db_noop,
950
  set_thread_command_noop,
951
  set_connection_type_noop,
952
  set_thread_start_time_noop,
953
  set_thread_state_noop,
954
  set_thread_info_noop,
955
  set_thread_noop,
956
  delete_current_thread_noop,
957
  delete_thread_noop,
958
  get_thread_file_name_locker_noop,
959
  get_thread_file_stream_locker_noop,
960
  get_thread_file_descriptor_locker_noop,
961
  unlock_mutex_noop,
962
  unlock_rwlock_noop,
963
  signal_cond_noop,
964
  broadcast_cond_noop,
965
  start_idle_wait_noop,
966
  end_idle_wait_noop,
967
  start_mutex_wait_noop,
968
  end_mutex_wait_noop,
969
  start_rwlock_rdwait_noop,
970
  end_rwlock_rdwait_noop,
971
  start_rwlock_wrwait_noop,
972
  end_rwlock_wrwait_noop,
973
  start_cond_wait_noop,
974
  end_cond_wait_noop,
975
  start_table_io_wait_noop,
976
  end_table_io_wait_noop,
977
  start_table_lock_wait_noop,
978
  end_table_lock_wait_noop,
979
  start_file_open_wait_noop,
980
  end_file_open_wait_noop,
981
  end_file_open_wait_and_bind_to_descriptor_noop,
982
  end_temp_file_open_wait_and_bind_to_descriptor_noop,
983
  start_file_wait_noop,
984
  end_file_wait_noop,
985
  start_file_close_wait_noop,
986
  end_file_close_wait_noop,
987
  end_file_rename_wait_noop,
988
  start_stage_noop,
989
  get_current_stage_progress_noop,
990
  end_stage_noop,
991
  get_thread_statement_locker_noop,
992
  refine_statement_noop,
993
  start_statement_noop,
994
  set_statement_text_noop,
995
  set_statement_lock_time_noop,
996
  set_statement_rows_sent_noop,
997
  set_statement_rows_examined_noop,
998
  inc_statement_created_tmp_disk_tables_noop,
999
  inc_statement_created_tmp_tables_noop,
1000
  inc_statement_select_full_join_noop,
1001
  inc_statement_select_full_range_join_noop,
1002
  inc_statement_select_range_noop,
1003
  inc_statement_select_range_check_noop,
1004
  inc_statement_select_scan_noop,
1005
  inc_statement_sort_merge_passes_noop,
1006
  inc_statement_sort_range_noop,
1007
  inc_statement_sort_rows_noop,
1008
  inc_statement_sort_scan_noop,
1009
  set_statement_no_index_used_noop,
1010
  set_statement_no_good_index_used_noop,
1011
  end_statement_noop,
1012
  get_thread_transaction_locker_noop,
1013
  start_transaction_noop,
1014
  set_transaction_xid_noop,
1015
  set_transaction_xa_state_noop,
1016
  set_transaction_gtid_noop,
1017
  set_transaction_trxid_noop,
1018
  inc_transaction_savepoints_noop,
1019
  inc_transaction_rollback_to_savepoint_noop,
1020
  inc_transaction_release_savepoint_noop,
1021
  end_transaction_noop,
1022
  start_socket_wait_noop,
1023
  end_socket_wait_noop,
1024
  set_socket_state_noop,
1025
  set_socket_info_noop,
1026
  set_socket_thread_owner_noop,
1027
  create_prepare_stmt_noop,
1028
  destroy_prepared_stmt_noop,
1029
  reprepare_prepared_stmt_noop,
1030
  execute_prepare_stmt_noop,
1031
  set_prepared_stmt_text_noop,
1032
  digest_start_noop,
1033
  digest_end_noop,
1034
  set_thread_connect_attrs_noop,
1035
  pfs_start_sp_noop,
1036
  pfs_end_sp_noop,
1037
  pfs_drop_sp_noop,
1038
  pfs_get_sp_share_noop,
1039
  pfs_release_sp_share_noop,
1040
  register_memory_noop,
1041
  memory_alloc_noop,
1042
  memory_realloc_noop,
1043
  memory_claim_noop,
1044
  memory_free_noop,
1045
1046
  unlock_table_noop,
1047
  create_metadata_lock_noop,
1048
  set_metadata_lock_status_noop,
1049
  destroy_metadata_lock_noop,
1050
  start_metadata_wait_noop,
1051
  end_metadata_wait_noop,
1052
1053
  set_thread_peer_port_noop
1054
};
1055
1056
/**
1057
  Hook for the instrumentation interface.
1058
  Code implementing the instrumentation interface should register here.
1059
*/
1060
struct PSI_bootstrap *PSI_hook= NULL;
1061
1062
/**
1063
  Instance of the instrumentation interface for the MySQL server.
1064
  @todo This is currently a global variable, which is handy when
1065
  compiling instrumented code that is bundled with the server.
1066
  When dynamic plugin are truly supported, this variable will need
1067
  to be replaced by a macro, so that each XYZ plugin can have it's own
1068
  xyz_psi_server variable, obtained from PSI_bootstrap::get_interface()
1069
  with the version used at compile time for plugin XYZ.
1070
*/
1071
1072
PSI *PSI_server= & PSI_noop;
1073
1074
void set_psi_server(PSI *psi)
1075
0
{
1076
0
  PSI_server= psi;
1077
0
}
1078
1079
C_MODE_END
1080