MySQL 8.0.29
Source Code Documentation
pfs_instr_class.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 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 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef PFS_INSTR_CLASS_H
24#define PFS_INSTR_CLASS_H
25
26#include "my_config.h"
27
28#include <assert.h>
29#include <sys/types.h>
30#include <atomic>
31
32#include "lf.h"
33#include "my_compiler.h"
34
35#include "my_inttypes.h"
36#include "mysql_com.h" /* NAME_LEN */
37#include "mysqld_error.h"
38#include "prealloced_array.h"
45
46struct TABLE_SHARE;
47
48/**
49 @file storage/perfschema/pfs_instr_class.h
50 Performance schema instruments metadata (declarations).
51*/
52
53/**
54 Maximum length of an instrument name.
55 For example, 'wait/sync/mutex/sql/LOCK_open' is an instrument name.
56*/
57#define PFS_MAX_INFO_NAME_LENGTH 128
58
59/**
60 Maximum length of the thread os name.
61 Must include a terminating NUL character.
62 Length is 16 because of linux pthread_setname_np(3)
63 @see my_thread_self_setname()
64*/
65#define PFS_MAX_OS_NAME_LENGTH 16
66
67/**
68 Maximum length of the 'full' prefix of an instrument name.
69 For example, for the instrument name 'wait/sync/mutex/sql/LOCK_open',
70 the full prefix is 'wait/sync/mutex/sql/', which in turn derives from
71 a prefix 'wait/sync/mutex' for mutexes, and a category of 'sql' for mutexes
72 of the sql layer in the server.
73*/
74#define PFS_MAX_FULL_PREFIX_NAME_LENGTH 32
75
76struct PFS_global_param;
77struct PFS_table_share;
78class PFS_opaque_container_page;
79
80/**
81 @addtogroup performance_schema_buffers
82 @{
83*/
84
85extern bool pfs_enabled;
86
87/** Global ref count for plugin and component events. */
88extern std::atomic<uint32> pfs_unload_plugin_ref_count;
89
90/** Key, naming a synch instrument (mutex, rwlock, cond). */
91typedef unsigned int PFS_sync_key;
92/** Key, naming a thread instrument. */
93typedef unsigned int PFS_thread_key;
94/** Key, naming a file instrument. */
95typedef unsigned int PFS_file_key;
96/** Key, naming a stage instrument. */
97typedef unsigned int PFS_stage_key;
98/** Key, naming a statement instrument. */
99typedef unsigned int PFS_statement_key;
100/** Key, naming a transaction instrument. */
101typedef unsigned int PFS_transaction_key;
102/** Key, naming a socket instrument. */
103typedef unsigned int PFS_socket_key;
104/** Key, naming a memory instrument. */
105typedef unsigned int PFS_memory_key;
106
128
129/** User-defined instrument configuration. */
131 /* Instrument name. */
132 char *m_name;
133 /* Name length. */
135 /** Enabled flag. */
137 /** Timed flag. */
139};
140
143
144struct PFS_thread;
145
151extern uint wait_class_max;
152
153/**
154 Encapsulates the name of an instrumented entity.
155*/
157 public:
159 /*
160 DO NOT ACCESS THE DATA MEMBERS DIRECTLY. USE THE GETTERS AND
161 SETTTERS INSTEAD.
162
163 The data members should really have been private, but having both
164 private and public members would make the class a non-POD. We
165 need to call memset on PFS_instr_class (in init_instr_class), and
166 the behavior of memset is undefined on non-POD objects. Therefore
167 we keep the data members public, with an underscore prefix, and
168 this warning text.
169 */
170 public /*private*/:
171 /** Instrument name. */
172 char m_private_name[max_length + 1];
173 /** Length in bytes of @c m_name. */
175 /** Old instrument name, if any. */
177 /** Length in bytes of old instrument name len, if any. */
179 /** The oldest version that uses the new name. */
181
182 public:
183 /** Return the name as a string. */
184 const char *str() const;
185 /** Return the length of the string. */
186 uint length() const;
187 /**
188 Copy the specified name to this name.
189
190 @param class_type The class type of this name, i.e., whether it is
191 the name of a mutex, thread, etc.
192
193 @param name The buffer to read from.
194
195 @param max_length_arg If is given, at most that many chars are
196 copied, plus the terminating '\0'. Otherwise, up to buffer_size-1
197 characters are copied, plus the terminating '\0'.
198 */
199 void set(PFS_class_type class_type, const char *name,
200 uint max_length_arg = max_length);
201};
202
203/** Information for all instrumentation. */
205 /** Class type */
207 /** True if this instrument is enabled. */
209 /** True if this instrument is timed. */
211 /** Instrument flags. */
213 /** Volatility index. */
215 /**
216 Instrument name index.
217 Self index in:
218 - EVENTS_WAITS_SUMMARY_*_BY_EVENT_NAME for waits
219 - EVENTS_STAGES_SUMMARY_*_BY_EVENT_NAME for stages
220 - EVENTS_STATEMENTS_SUMMARY_*_BY_EVENT_NAME for statements
221 - EVENTS_TRANSACTIONS_SUMMARY_*_BY_EVENT_NAME for transactions
222 */
224 /** Instrument name. */
226 /** Documentation. */
228
229 bool is_singleton() const { return m_flags & PSI_FLAG_SINGLETON; }
230
231 bool is_mutable() const { return m_flags & PSI_FLAG_MUTABLE; }
232
233 bool is_progress() const { return m_flags & PSI_FLAG_STAGE_PROGRESS; }
234
236
237 bool is_priority() const { return m_flags & PSI_FLAG_RWLOCK_PR; }
238
239 bool is_transferable() const { return m_flags & PSI_FLAG_TRANSFER; }
240
241 bool is_user() const { return m_flags & PSI_FLAG_USER; }
242
244
245 bool is_global() const { return m_flags & PSI_FLAG_ONLY_GLOBAL_STAT; }
246
247 bool has_seqnum() const {
249 }
250
252
253 bool has_memory_cnt() const { return m_flags & PSI_FLAG_MEM_COLLECT; }
254
255 void enforce_valid_flags(uint allowed_flags) {
256 /* Reserved for future use. */
257 allowed_flags |= PSI_FLAG_THREAD | PSI_FLAG_TRANSFER;
258
259 uint valid_flags = m_flags & allowed_flags;
260 /*
261 This fails when the instrumented code is providing
262 flags that are not supported for this instrument.
263 To fix it, clean up the instrumented code.
264 */
265 assert(valid_flags == m_flags);
266 m_flags = valid_flags;
267 }
268
270 static void set_timed(PFS_instr_class *pfs, bool timed);
271
272 bool is_deferred() const {
273 switch (m_type) {
274 case PFS_CLASS_SOCKET:
275 return true;
276 break;
277 default:
278 return false;
279 break;
280 };
281 }
282
283 bool can_be_timed() const {
284 switch (m_type) {
285 case PFS_CLASS_MEMORY:
286 case PFS_CLASS_ERROR:
287 case PFS_CLASS_THREAD:
288 return false;
289 default:
290 return true;
291 };
292 }
293};
294
295struct PFS_mutex;
296
297#define PFS_MUTEX_PARTITIONS 2
298
299/** Instrumentation metadata for a mutex. */
301 /** Mutex usage statistics. */
303 /** Singleton instance. */
305};
306
307struct PFS_rwlock;
308
309/** Instrumentation metadata for a read write lock. */
311 /** Rwlock usage statistics. */
313 /** Singleton instance. */
315};
316
317struct PFS_cond;
318
319/** Instrumentation metadata for a condition. */
321 /**
322 Condition usage statistics.
323 This statistic is not exposed in user visible tables yet.
324 */
326 /** Singleton instance. */
328};
329
330/** Instrumentation metadata of a thread. */
332 /** Singleton instance. */
334 /** Thread history instrumentation flag. */
335 bool m_history{false};
336 /** Thread os name. */
337 char m_os_name[PFS_MAX_OS_NAME_LENGTH];
338 /** Thread instance sequence number counter. */
339 std::atomic<unsigned int> m_seqnum;
340};
341
342/** Key identifying a table share. */
344 /** Object type. */
346
347 /** Table schema. */
349
350 /** Table name. */
352};
353
354/** Table index or 'key' */
356 /** Index name */
358 /** Length in bytes of @c m_name. */
360};
361
362/** Index statistics of a table.*/
365 /** The index name */
367 /** The index stat */
369 /** Owner table share. To be used later. */
371 /** Container page. */
372 PFS_opaque_container_page *m_page;
373};
374
375/** Lock statistics of a table.*/
378 /** Lock stats. */
380 /** Owner table share. To be used later. */
382 /** Container page. */
383 PFS_opaque_container_page *m_page;
384};
385
386/** Instrumentation metadata for a table share. */
388 public:
389 uint32 get_version() { return m_lock.get_version(); }
390
391 enum_object_type get_object_type() { return m_key.m_type; }
392
393 void aggregate_io(void);
394 void aggregate_lock(void);
395
396 void sum_io(PFS_single_stat *result, uint key_count);
397 void sum_lock(PFS_single_stat *result);
398 void sum(PFS_single_stat *result, uint key_count);
399
400 inline void aggregate(void) {
401 aggregate_io();
402 aggregate_lock();
403 }
404
405 inline void init_refcount(void) { m_refcount.store(1); }
406
407 inline int get_refcount(void) { return m_refcount.load(); }
408
409 inline void inc_refcount(void) { ++m_refcount; }
410
411 inline void dec_refcount(void) { --m_refcount; }
412
413 void refresh_setup_object_flags(PFS_thread *thread);
414
415 /** Internal lock. */
417 /**
418 True if table instrumentation is enabled.
419 This flag is computed from the content of table setup_objects.
420 */
422 /**
423 True if table instrumentation is timed.
424 This flag is computed from the content of table setup_objects.
425 */
427
428 /** Search key. */
430
431 /** Number of indexes. */
433 /** Container page. */
434 PFS_opaque_container_page *m_page;
435
436 PFS_table_share_lock *find_lock_stat() const;
437 PFS_table_share_lock *find_or_create_lock_stat();
438 void destroy_lock_stat();
439
440 PFS_table_share_index *find_index_stat(uint index) const;
441 PFS_table_share_index *find_or_create_index_stat(
442 const TABLE_SHARE *server_share, uint index);
443 void destroy_index_stats();
444
445 private:
446 /** Number of opened table handles. */
447 std::atomic<int> m_refcount;
448 /** Table locks statistics. */
449 std::atomic<PFS_table_share_lock *> m_race_lock_stat;
450 /** Table indexes stats. */
451 std::atomic<PFS_table_share_index *> m_race_index_stat[MAX_INDEXES + 1];
452};
453
454/** Statistics for the IDLE instrument. */
456/** Statistics for dropped table I/O. */
458/** Statistics for dropped table lock. */
460/** Statistics for the METADATA instrument. */
462/** Statistics for the transaction instrument. */
464/** Statistics for the error instrument. */
466
468 if (likely(count <= MAX_INDEXES)) {
469 return count;
470 }
471 return 0;
472}
473
474#define GLOBAL_TABLE_IO_EVENT_INDEX 0
475#define GLOBAL_TABLE_LOCK_EVENT_INDEX 1
476#define GLOBAL_IDLE_EVENT_INDEX 2
477#define GLOBAL_METADATA_EVENT_INDEX 3
478/** Number of global wait events. */
479#define COUNT_GLOBAL_EVENT_INDEX 4
480
481/** Transaction events are not wait events .*/
482#define GLOBAL_TRANSACTION_INDEX 0
483
484#define GLOBAL_ERROR_INDEX 0
485
486/**
487 Instrument controlling all table I/O.
488 This instrument is used with table SETUP_OBJECTS.
489*/
491
492/**
493 Instrument controlling all table lock.
494 This instrument is used with table SETUP_OBJECTS.
495*/
497
498/**
499 Instrument controlling all idle waits.
500*/
502
503/**
504 Instrument controlling all metadata locks.
505*/
507
508/** Instrumentation metadata for an error. */
510/**
511 Instrument controlling all server errors.
512*/
514
515struct PFS_file;
516
517/** Instrumentation metadata for a file. */
519 /** File usage statistics. */
521 /** Singleton instance. */
523};
524
525/** Instrumentation metadata for a stage. */
527 /**
528 Length of the @c "stage/<component>/" prefix.
529 This is to extract @c "foo" from @c "stage/sql/foo".
530 */
532 /** Stage usage statistics. */
534};
535
536/** Instrumentation metadata for a statement. */
538
539/** Instrumentation metadata for a transaction. */
541
543
544struct PFS_socket;
545
546/** Instrumentation metadata for a socket. */
548 /** Socket usage statistics. */
550 /** Singleton instance. */
552};
553
554/** Instrumentation metadata for a memory. */
556
558
560
561int init_sync_class(uint mutex_class_sizing, uint rwlock_class_sizing,
562 uint cond_class_sizing);
563
564void cleanup_sync_class();
565int init_thread_class(uint thread_class_sizing);
567int init_table_share(uint table_share_sizing);
569
570int init_table_share_lock_stat(uint table_stat_sizing);
574
575int init_table_share_index_stat(uint index_stat_sizing);
578 uint index);
580
583int init_file_class(uint file_class_sizing);
584void cleanup_file_class();
585int init_stage_class(uint stage_class_sizing);
587int init_statement_class(uint statement_class_sizing);
589int init_socket_class(uint socket_class_sizing);
591int init_memory_class(uint memory_class_sizing);
593
594PFS_sync_key register_mutex_class(const char *name, uint name_length,
596
597PFS_sync_key register_rwlock_class(const char *name, uint name_length,
599
600PFS_sync_key register_cond_class(const char *name, uint name_length,
602
603PFS_thread_key register_thread_class(const char *name, uint name_length,
605
606PFS_file_key register_file_class(const char *name, uint name_length,
608
609PFS_stage_key register_stage_class(const char *name, uint prefix_length,
610 uint name_length, PSI_stage_info *info);
611
612PFS_statement_key register_statement_class(const char *name, uint name_length,
614
615PFS_socket_key register_socket_class(const char *name, uint name_length,
617
618PFS_memory_key register_memory_class(const char *name, uint name_length,
620
649 PFS_transaction_class *unsafe);
650
652 const TABLE_SHARE *share);
654void drop_table_share(PFS_thread *thread, bool temporary,
655 const char *schema_name, uint schema_name_length,
656 const char *table_name, uint table_name_length);
657
659
660extern ulong mutex_class_max;
661extern ulong mutex_class_lost;
662extern ulong rwlock_class_max;
663extern ulong rwlock_class_lost;
664extern ulong cond_class_max;
665extern ulong cond_class_lost;
666extern ulong thread_class_max;
667extern ulong thread_class_lost;
668extern ulong file_class_max;
669extern ulong file_class_lost;
670extern ulong stage_class_max;
671extern ulong stage_class_lost;
672extern ulong statement_class_max;
673extern ulong statement_class_lost;
674extern ulong transaction_class_max;
675extern ulong socket_class_max;
676extern ulong socket_class_lost;
677extern ulong memory_class_max;
678extern ulong memory_class_lost;
679extern ulong error_class_max;
680
681/* Exposing the data directly, for iterators. */
682
687
691
692/** Update derived flags for all table shares. */
694
695/** Update derived flags for all stored procedure shares. */
697
699
700/**
701 Get current time for GTID monitoring.
702
703 @return my_getsystime() when PFS monitoring is enabled.
704 @return 0 when PFS monitoring is disabled.
705*/
707
708/** @} */
709#endif
Encapsulates the name of an instrumented entity.
Definition: pfs_instr_class.h:156
const char * m_private_old_name
Old instrument name, if any.
Definition: pfs_instr_class.h:176
terminology_use_previous::enum_compatibility_version m_private_version
The oldest version that uses the new name.
Definition: pfs_instr_class.h:180
uint m_private_old_name_length
Length in bytes of old instrument name len, if any.
Definition: pfs_instr_class.h:178
uint m_private_name_length
Length in bytes of m_name.
Definition: pfs_instr_class.h:174
A typesafe replacement for DYNAMIC_ARRAY.
Definition: prealloced_array.h:70
#define PSI_FLAG_SINGLETON
Singleton flag.
Definition: component_common.h:34
void release_table_share(TABLE_SHARE *share)
Mark that we are not using table share anymore.
Definition: sql_base.cc:980
PFS_instr_class global_metadata_class
Instrument controlling all metadata locks.
Definition: pfs_instr_class.cc:176
LF_HASH table_share_hash
Hash index for instrumented table shares.
Definition: pfs_instr_class.cc:189
PFS_sync_key register_rwlock_class(const char *name, uint name_length, PSI_rwlock_info *info)
Register a rwlock instrumentation metadata.
Definition: pfs_instr_class.cc:1209
PFS_thread_class * sanitize_thread_class(PFS_thread_class *unsafe)
Definition: pfs_instr_class.cc:1412
uint socket_class_start
Definition: pfs_instr_class.cc:223
void cleanup_table_share_index_stat(void)
Cleanup the table stat buffers.
Definition: pfs_instr_class.cc:824
PFS_socket_class * sanitize_socket_class(PFS_socket_class *unsafe)
Definition: pfs_instr_class.cc:1645
unsigned int PFS_transaction_key
Key, naming a transaction instrument.
Definition: pfs_instr_class.h:101
PFS_rwlock_class * find_rwlock_class(PFS_sync_key key)
Find a rwlock instrumentation class by key.
Definition: pfs_instr_class.cc:1316
ulong error_class_max
Number of error classes.
Definition: pfs_instr_class.cc:150
PFS_socket_key register_socket_class(const char *name, uint name_length, PSI_socket_info *info)
Register a socket instrumentation metadata.
Definition: pfs_instr_class.cc:1601
void cleanup_sync_class(void)
Cleanup the instrument synch class buffers.
Definition: pfs_instr_class.cc:391
ulong stage_class_max
Size of the stage class array.
Definition: pfs_instr_class.cc:122
PFS_stage_key register_stage_class(const char *name, uint prefix_length, uint name_length, PSI_stage_info *info)
Register a stage instrumentation metadata.
Definition: pfs_instr_class.cc:1467
unsigned int PFS_file_key
Key, naming a file instrument.
Definition: pfs_instr_class.h:95
unsigned int PFS_sync_key
Key, naming a synch instrument (mutex, rwlock, cond).
Definition: pfs_instr_class.h:91
PFS_rwlock_class * rwlock_class_array
Definition: pfs_instr_class.cc:153
void drop_table_share(PFS_thread *thread, bool temporary, const char *schema_name, uint schema_name_length, const char *table_name, uint table_name_length)
Drop the instrumented table share associated with a table.
Definition: pfs_instr_class.cc:2006
int init_table_share(uint table_share_sizing)
Initialize the table share buffer.
Definition: pfs_instr_class.cc:476
ulonglong gtid_monitoring_getsystime()
Get current time for GTID monitoring.
Definition: pfs_instr_class.cc:2108
PFS_instr_class global_table_lock_class
Instrument controlling all table lock.
Definition: pfs_instr_class.cc:174
uint mutex_class_start
Definition: pfs_instr_class.cc:218
PFS_instr_class global_idle_class
Instrument controlling all idle waits.
Definition: pfs_instr_class.cc:175
ulong thread_class_max
Size of the thread class array.
Definition: pfs_instr_class.cc:114
ulong socket_class_lost
Number of socket class lost.
Definition: pfs_instr_class.cc:132
PFS_table_share * find_or_create_table_share(PFS_thread *thread, bool temporary, const TABLE_SHARE *share)
Find or create a table share instrumentation.
Definition: pfs_instr_class.cc:1816
PFS_instr_class * find_metadata_class(uint index)
Definition: pfs_instr_class.cc:1737
uint sanitize_index_count(uint count)
Definition: pfs_instr_class.h:467
ulong socket_class_max
Size of the socket class array.
Definition: pfs_instr_class.cc:130
unsigned int PFS_socket_key
Key, naming a socket instrument.
Definition: pfs_instr_class.h:103
void reset_file_class_io(void)
Reset the I/O statistics per file class.
Definition: pfs_instr_class.cc:2051
ulong rwlock_class_lost
Number of rwlock class lost.
Definition: pfs_instr_class.cc:108
void cleanup_file_class(void)
Cleanup the file class buffers.
Definition: pfs_instr_class.cc:854
int init_table_share_lock_stat(uint table_stat_sizing)
Initialize the table lock stat buffer.
Definition: pfs_instr_class.cc:728
PFS_stage_class * sanitize_stage_class(PFS_stage_class *unsafe)
Definition: pfs_instr_class.cc:1575
PFS_cond_class * find_cond_class(PFS_sync_key key)
Find a condition instrumentation class by key.
Definition: pfs_instr_class.cc:1330
Prealloced_array< PFS_instr_config *, 10 > Pfs_instr_config_array
Definition: pfs_instr_class.h:141
int init_file_class(uint file_class_sizing)
Initialize the file class buffer.
Definition: pfs_instr_class.cc:833
uint length() const
Return the length of the string.
Definition: pfs_instr_class.cc:234
PFS_file_key register_file_class(const char *name, uint name_length, PSI_file_info *info)
Register a file instrumentation metadata.
Definition: pfs_instr_class.cc:1424
Pfs_instr_config_array * pfs_instr_config_array
PFS_INSTRUMENT option settings array.
Definition: pfs_instr_class.cc:79
void cleanup_socket_class(void)
Cleanup the socket class buffers.
Definition: pfs_instr_class.cc:980
ulong memory_class_lost
Number of memory class lost.
Definition: pfs_instr_class.cc:136
ulong statement_class_lost
Number of statement class lost.
Definition: pfs_instr_class.cc:128
PFS_stage_class * find_stage_class(PFS_stage_key key)
Find a stage instrumentation class by key.
Definition: pfs_instr_class.cc:1571
uint cond_class_start
Definition: pfs_instr_class.cc:220
PFS_statement_class * find_statement_class(PFS_stage_key key)
Find a statement instrumentation class by key.
Definition: pfs_instr_class.cc:1585
ulong cond_class_max
Size of the condition class array.
Definition: pfs_instr_class.cc:110
ulong mutex_class_lost
Number of mutex class lost.
Definition: pfs_instr_class.cc:104
PFS_statement_class * sanitize_statement_class(PFS_statement_class *unsafe)
Definition: pfs_instr_class.cc:1589
unsigned int PFS_memory_key
Key, naming a memory instrument.
Definition: pfs_instr_class.h:105
PFS_table_lock_stat global_table_lock_stat
Statistics for dropped table lock.
Definition: pfs_instr_class.cc:169
void register_global_classes()
Definition: pfs_instr_class.cc:290
ulong memory_class_max
Size of the memory class array.
Definition: pfs_instr_class.cc:134
void cleanup_stage_class(void)
Cleanup the stage class buffers.
Definition: pfs_instr_class.cc:896
uint wait_class_max
Definition: pfs_instr_class.cc:222
PFS_table_share_lock * create_table_share_lock_stat()
Create a table share lock instrumentation.
Definition: pfs_instr_class.cc:740
PFS_transaction_class * find_transaction_class(uint index)
Definition: pfs_instr_class.cc:1765
PFS_statement_key register_statement_class(const char *name, uint name_length, PSI_statement_info *info)
Register a statement instrumentation metadata.
Definition: pfs_instr_class.cc:1518
void update_table_share_derived_flags(PFS_thread *thread)
Update derived flags for all table shares.
Definition: pfs_instr_class.cc:2084
ulong stage_class_lost
Number of stage class lost.
Definition: pfs_instr_class.cc:124
PFS_thread_key register_thread_class(const char *name, uint name_length, PSI_thread_info *info)
Register a thread instrumentation metadata.
Definition: pfs_instr_class.cc:1345
PFS_cond_class * sanitize_cond_class(PFS_cond_class *unsafe)
Definition: pfs_instr_class.cc:1334
PFS_instr_class * sanitize_idle_class(PFS_instr_class *unsafe)
Definition: pfs_instr_class.cc:1730
PFS_error_stat global_error_stat
Statistics for the error instrument.
Definition: pfs_instr_class.cc:172
PFS_thread_class * find_thread_class(PFS_sync_key key)
Find a thread instrumentation class by key.
Definition: pfs_instr_class.cc:1408
PFS_table_io_stat global_table_io_stat
Statistics for dropped table I/O.
Definition: pfs_instr_class.cc:168
void cleanup_table_share(void)
Cleanup the table share buffers.
Definition: pfs_instr_class.cc:485
PFS_sync_key register_cond_class(const char *name, uint name_length, PSI_cond_info *info)
Register a condition instrumentation metadata.
Definition: pfs_instr_class.cc:1257
PFS_instr_class * sanitize_metadata_class(PFS_instr_class *unsafe)
Definition: pfs_instr_class.cc:1744
PFS_mutex_class * sanitize_mutex_class(PFS_mutex_class *unsafe)
Definition: pfs_instr_class.cc:1306
PFS_error_class global_error_class
Instrument controlling all server errors.
Definition: pfs_instr_class.cc:177
uint file_class_start
Definition: pfs_instr_class.cc:221
PFS_transaction_stat global_transaction_stat
Statistics for the transaction instrument.
Definition: pfs_instr_class.cc:171
PFS_cond_class * cond_class_array
Definition: pfs_instr_class.cc:154
PFS_rwlock_class * sanitize_rwlock_class(PFS_rwlock_class *unsafe)
Definition: pfs_instr_class.cc:1320
ulong file_class_lost
Number of file class lost.
Definition: pfs_instr_class.cc:120
PFS_error_class * sanitize_error_class(PFS_instr_class *unsafe)
int init_stage_class(uint stage_class_sizing)
Initialize the stage class buffer.
Definition: pfs_instr_class.cc:875
void cleanup_table_share_hash(void)
Cleanup the table share hash table.
Definition: pfs_instr_class.cc:566
PFS_instr_class * find_idle_class(uint index)
Definition: pfs_instr_class.cc:1723
void cleanup_memory_class(void)
Cleanup the memory class buffers.
Definition: pfs_instr_class.cc:1022
int init_thread_class(uint thread_class_sizing)
Initialize the thread class buffer.
Definition: pfs_instr_class.cc:434
void cleanup_statement_class(void)
Cleanup the statement class buffers.
Definition: pfs_instr_class.cc:938
void init_event_name_sizing(const PFS_global_param *param)
Definition: pfs_instr_class.cc:280
int init_socket_class(uint socket_class_sizing)
Initialize the socket class buffer.
Definition: pfs_instr_class.cc:959
PFS_socket_class * find_socket_class(PFS_socket_key key)
Find a socket instrumentation class by key.
Definition: pfs_instr_class.cc:1641
void update_program_share_derived_flags(PFS_thread *thread)
Update derived flags for all stored procedure shares.
Definition: pfs_instr_class.cc:2103
PFS_error_class * find_error_class(uint index)
Definition: pfs_instr_class.cc:1751
PFS_file_class * sanitize_file_class(PFS_file_class *unsafe)
Definition: pfs_instr_class.cc:1562
unsigned int PFS_stage_key
Key, naming a stage instrument.
Definition: pfs_instr_class.h:97
std::atomic< uint32 > pfs_unload_plugin_ref_count
Global ref count for plugin and component events.
int init_statement_class(uint statement_class_sizing)
Initialize the statement class buffer.
Definition: pfs_instr_class.cc:917
ulong file_class_max
Size of the file class array.
Definition: pfs_instr_class.cc:118
ulong thread_class_lost
Number of thread class lost.
Definition: pfs_instr_class.cc:116
void reset_events_waits_by_class()
Reset the wait statistics per instrument class.
Definition: pfs_instr_class.cc:2041
PFS_table_share * sanitize_table_share(PFS_table_share *unsafe)
Sanitize an unsafe table_share pointer.
Definition: pfs_instr_class.cc:2036
void cleanup_table_share_lock_stat(void)
Cleanup the table stat buffers.
Definition: pfs_instr_class.cc:765
PFS_memory_key register_memory_class(const char *name, uint name_length, PSI_memory_info *info)
Register a memory instrumentation metadata.
Definition: pfs_instr_class.cc:1657
PFS_transaction_class global_transaction_class
Definition: pfs_instr_class.cc:178
unsigned int PFS_statement_key
Key, naming a statement instrument.
Definition: pfs_instr_class.h:99
PFS_single_stat global_idle_stat
Statistics for the IDLE instrument.
Definition: pfs_instr_class.cc:167
unsigned int PFS_thread_key
Key, naming a thread instrument.
Definition: pfs_instr_class.h:93
int init_table_share_index_stat(uint index_stat_sizing)
Initialize table index stat buffer.
Definition: pfs_instr_class.cc:774
PFS_sync_key register_mutex_class(const char *name, uint name_length, PSI_mutex_info *info)
Register a mutex instrumentation metadata.
Definition: pfs_instr_class.cc:1112
PFS_memory_class * sanitize_memory_class(PFS_memory_class *unsafe)
Definition: pfs_instr_class.cc:1700
void reset_socket_class_io(void)
Reset the I/O statistics per socket class.
Definition: pfs_instr_class.cc:2061
bool pfs_enabled
Global performance schema flag.
Definition: pfs_instr_class.cc:67
uint rwlock_class_start
Definition: pfs_instr_class.cc:219
PFS_class_type
Definition: pfs_instr_class.h:107
ulong mutex_class_max
Size of the mutex class array.
Definition: pfs_instr_class.cc:102
PFS_single_stat global_metadata_stat
Statistics for the METADATA instrument.
Definition: pfs_instr_class.cc:170
ulong statement_class_max
Size of the statement class array.
Definition: pfs_instr_class.cc:126
const char * str() const
Return the name as a string.
Definition: pfs_instr_class.cc:225
PFS_instr_class global_table_io_class
Instrument controlling all table I/O.
Definition: pfs_instr_class.cc:173
PFS_instr_class * sanitize_table_class(PFS_instr_class *unsafe)
Definition: pfs_instr_class.cc:1715
int init_table_share_hash(const PFS_global_param *param)
Initialize the table share hash table.
Definition: pfs_instr_class.cc:555
ulong rwlock_class_max
Size of the rwlock class array.
Definition: pfs_instr_class.cc:106
void set(PFS_class_type class_type, const char *name, uint max_length_arg=max_length)
Copy the specified name to this name.
Definition: pfs_instr_class.cc:262
ulong cond_class_lost
Number of condition class lost.
Definition: pfs_instr_class.cc:112
PFS_memory_class * find_memory_class(PFS_memory_key key)
Find a memory instrumentation class by key.
Definition: pfs_instr_class.cc:1696
PFS_transaction_class * sanitize_transaction_class(PFS_transaction_class *unsafe)
Definition: pfs_instr_class.cc:1772
ulong transaction_class_max
Number of transaction classes.
Definition: pfs_instr_class.cc:143
int init_memory_class(uint memory_class_sizing)
Initialize the memory class buffer.
Definition: pfs_instr_class.cc:1001
static constexpr uint max_length
Definition: pfs_instr_class.h:158
void release_table_share_lock_stat(PFS_table_share_lock *pfs)
Release a table share lock instrumentation.
Definition: pfs_instr_class.cc:758
void cleanup_thread_class(void)
Cleanup the thread class buffers.
Definition: pfs_instr_class.cc:455
void release_table_share_index_stat(PFS_table_share_index *pfs)
Release a table share index instrumentation.
Definition: pfs_instr_class.cc:817
PFS_mutex_class * mutex_class_array
Definition: pfs_instr_class.cc:152
PFS_instr_class * find_table_class(uint index)
Definition: pfs_instr_class.cc:1705
PFS_table_share_index * create_table_share_index_stat(const TABLE_SHARE *server_share, uint server_index)
Create a table share index instrumentation.
Definition: pfs_instr_class.cc:786
int init_sync_class(uint mutex_class_sizing, uint rwlock_class_sizing, uint cond_class_sizing)
Initialize the instrument synch class buffers.
Definition: pfs_instr_class.cc:346
PFS_mutex_class * find_mutex_class(PFS_sync_key key)
Find a mutex instrumentation class by key.
Definition: pfs_instr_class.cc:1302
PFS_file_class * file_class_array
Definition: pfs_instr_class.cc:196
PFS_file_class * find_file_class(PFS_file_key key)
Find a file instrumentation class by key.
Definition: pfs_instr_class.cc:1558
@ PFS_CLASS_MAX
Definition: pfs_instr_class.h:126
@ PFS_CLASS_IDLE
Definition: pfs_instr_class.h:120
@ PFS_CLASS_LAST
Definition: pfs_instr_class.h:125
@ PFS_CLASS_MUTEX
Definition: pfs_instr_class.h:109
@ PFS_CLASS_STAGE
Definition: pfs_instr_class.h:114
@ PFS_CLASS_NONE
Definition: pfs_instr_class.h:108
@ PFS_CLASS_TABLE
Definition: pfs_instr_class.h:113
@ PFS_CLASS_TABLE_LOCK
Definition: pfs_instr_class.h:119
@ PFS_CLASS_FILE
Definition: pfs_instr_class.h:112
@ PFS_CLASS_TABLE_IO
Definition: pfs_instr_class.h:118
@ PFS_CLASS_METADATA
Definition: pfs_instr_class.h:122
@ PFS_CLASS_RWLOCK
Definition: pfs_instr_class.h:110
@ PFS_CLASS_COND
Definition: pfs_instr_class.h:111
@ PFS_CLASS_MEMORY
Definition: pfs_instr_class.h:121
@ PFS_CLASS_THREAD
Definition: pfs_instr_class.h:124
@ PFS_CLASS_ERROR
Definition: pfs_instr_class.h:123
@ PFS_CLASS_STATEMENT
Definition: pfs_instr_class.h:115
@ PFS_CLASS_SOCKET
Definition: pfs_instr_class.h:117
@ PFS_CLASS_TRANSACTION
Definition: pfs_instr_class.h:116
unsigned int PSI_cond_key
Instrumented cond key.
Definition: psi_cond_bits.h:43
unsigned int PSI_file_key
Instrumented file key.
Definition: psi_file_bits.h:47
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:48
unsigned int PSI_mutex_key
Instrumented mutex key.
Definition: psi_mutex_bits.h:51
unsigned int PSI_rwlock_key
Instrumented rwlock key.
Definition: psi_rwlock_bits.h:43
unsigned int PSI_socket_key
Instrumented socket key.
Definition: psi_socket_bits.h:48
unsigned int PSI_stage_key
Instrumented stage key.
Definition: psi_stage_bits.h:42
unsigned int PSI_statement_key
Instrumented statement key.
Definition: psi_statement_bits.h:47
unsigned int PSI_thread_key
Instrumented thread key.
Definition: psi_thread_bits.h:49
#define PSI_FLAG_USER
User flag.
Definition: psi_bits.h:102
#define PSI_FLAG_TRANSFER
Transferable flag.
Definition: psi_bits.h:94
#define PSI_FLAG_MUTABLE
Mutable flag.
Definition: psi_bits.h:67
#define PSI_FLAG_STAGE_PROGRESS
Stage progress flag.
Definition: psi_bits.h:81
#define PSI_FLAG_RWLOCK_SX
Shared Exclusive flag.
Definition: psi_bits.h:87
#define PSI_FLAG_NO_SEQNUM
No sequence number flag.
Definition: psi_bits.h:135
#define PSI_FLAG_THREAD
Per Thread flag.
Definition: psi_bits.h:74
#define PSI_FLAG_AUTO_SEQNUM
Automatic sequence number flag.
Definition: psi_bits.h:129
#define PSI_FLAG_MEM_COLLECT
Enable collecting the memory consumed by threads.
Definition: psi_bits.h:140
#define PSI_FLAG_THREAD_SYSTEM
System thread flag.
Definition: psi_bits.h:123
#define PSI_FLAG_RWLOCK_PR
Priority lock flag.
Definition: psi_bits.h:117
#define PSI_FLAG_ONLY_GLOBAL_STAT
Global stat only flag.
Definition: psi_bits.h:111
#define MAX_INDEXES
Definition: config.h:209
Header for compiler-dependent features.
constexpr bool likely(bool expr)
Definition: my_compiler.h:54
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
uint32_t uint32
Definition: my_inttypes.h:66
static int count
Definition: myisam_ftdump.cc:42
Common definition between mysql server & client.
#define NAME_LEN
Definition: mysql_com.h:66
Log info(cout, "NOTE")
const char * table_name
Definition: rules_table_service.cc:55
enum_compatibility_version
Enumeration holding the possible values for @terminology_use_previous.
Definition: terminology_use_previous_enum.h:47
Data types for columns used in the performance schema tables (declarations)
enum_object_type
Enum values for the various OBJECT_TYPE columns.
Definition: pfs_column_types.h:221
Miscellaneous global dependencies (declarations).
#define PFS_ALIGNED
Definition: pfs_global.h:54
#define PFS_MAX_OS_NAME_LENGTH
Maximum length of the thread os name.
Definition: pfs_instr_class.h:65
#define PFS_MAX_INFO_NAME_LENGTH
Maximum length of an instrument name.
Definition: pfs_instr_class.h:57
Performance schema internal locks (declarations).
Object names (declarations).
Statistics (declarations).
required string key
Definition: replication_asynchronous_connection_failover.proto:59
required bool enabled
Definition: replication_group_member_actions.proto:32
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:65
case opt name
Definition: sslopt-case.h:32
Definition: lf.h:184
Instrumentation metadata for a condition.
Definition: pfs_instr_class.h:320
PFS_cond_stat m_cond_stat
Condition usage statistics.
Definition: pfs_instr_class.h:325
PFS_cond * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:327
Statistics for conditions usage.
Definition: pfs_stat.h:237
Instrumented condition implementation.
Definition: pfs_instr.h:159
Instrumentation metadata for an error.
Definition: pfs_instr_class.h:509
Statistics for all server errors.
Definition: pfs_stat.h:539
Instrumentation metadata for a file.
Definition: pfs_instr_class.h:518
PFS_file * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:522
PFS_file_stat m_file_stat
File usage statistics.
Definition: pfs_instr_class.h:520
Statistics for FILE usage.
Definition: pfs_stat.h:307
Instrumented File and FILE implementation.
Definition: pfs_instr.h:176
Performance schema global sizing parameters.
Definition: pfs_server.h:112
Information for all instrumentation.
Definition: pfs_instr_class.h:204
bool is_deferred() const
Definition: pfs_instr_class.h:272
bool m_enabled
True if this instrument is enabled.
Definition: pfs_instr_class.h:208
static void set_enabled(PFS_instr_class *pfs, bool enabled)
uint m_flags
Instrument flags.
Definition: pfs_instr_class.h:212
bool is_singleton() const
Definition: pfs_instr_class.h:229
PFS_class_type m_type
Class type.
Definition: pfs_instr_class.h:206
bool is_priority() const
Definition: pfs_instr_class.h:237
static void set_timed(PFS_instr_class *pfs, bool timed)
bool has_memory_cnt() const
Definition: pfs_instr_class.h:253
bool is_progress() const
Definition: pfs_instr_class.h:233
bool can_be_timed() const
Definition: pfs_instr_class.h:283
bool is_transferable() const
Definition: pfs_instr_class.h:239
PFS_instr_name m_name
Instrument name.
Definition: pfs_instr_class.h:225
uint m_event_name_index
Instrument name index.
Definition: pfs_instr_class.h:223
bool has_auto_seqnum() const
Definition: pfs_instr_class.h:251
bool m_timed
True if this instrument is timed.
Definition: pfs_instr_class.h:210
bool is_global() const
Definition: pfs_instr_class.h:245
char * m_documentation
Documentation.
Definition: pfs_instr_class.h:227
bool is_user() const
Definition: pfs_instr_class.h:241
bool is_mutable() const
Definition: pfs_instr_class.h:231
bool is_shared_exclusive() const
Definition: pfs_instr_class.h:235
int m_volatility
Volatility index.
Definition: pfs_instr_class.h:214
void enforce_valid_flags(uint allowed_flags)
Definition: pfs_instr_class.h:255
bool is_system_thread() const
Definition: pfs_instr_class.h:243
bool has_seqnum() const
Definition: pfs_instr_class.h:247
User-defined instrument configuration.
Definition: pfs_instr_class.h:130
uint m_name_length
Definition: pfs_instr_class.h:134
bool m_enabled
Enabled flag.
Definition: pfs_instr_class.h:136
bool m_timed
Timed flag.
Definition: pfs_instr_class.h:138
char * m_name
Definition: pfs_instr_class.h:132
Instrumentation metadata for a memory.
Definition: pfs_instr_class.h:555
Instrumentation metadata for a mutex.
Definition: pfs_instr_class.h:300
PFS_mutex_stat m_mutex_stat
Mutex usage statistics.
Definition: pfs_instr_class.h:302
PFS_mutex * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:304
Statistics for mutex usage.
Definition: pfs_stat.h:176
Instrumented mutex implementation.
Definition: pfs_instr.h:100
Instrumentation metadata for a read write lock.
Definition: pfs_instr_class.h:310
PFS_rwlock * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:314
PFS_rwlock_stat m_rwlock_stat
Rwlock usage statistics.
Definition: pfs_instr_class.h:312
Statistics for rwlock usage.
Definition: pfs_stat.h:203
Instrumented rwlock implementation.
Definition: pfs_instr.h:126
Definition: pfs_name.h:113
Single statistic.
Definition: pfs_stat.h:51
Instrumentation metadata for a socket.
Definition: pfs_instr_class.h:547
PFS_socket_stat m_socket_stat
Socket usage statistics.
Definition: pfs_instr_class.h:549
PFS_socket * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:551
Statistics for SOCKET usage.
Definition: pfs_stat.h:857
Instrumented socket implementation.
Definition: pfs_instr.h:286
Instrumentation metadata for a stage.
Definition: pfs_instr_class.h:526
uint m_prefix_length
Length of the "stage/<component>/" prefix.
Definition: pfs_instr_class.h:531
PFS_stage_stat m_stage_stat
Stage usage statistics.
Definition: pfs_instr_class.h:533
Statistics for stage usage.
Definition: pfs_stat.h:322
Instrumentation metadata for a statement.
Definition: pfs_instr_class.h:537
Single table I/O statistic.
Definition: pfs_stat.h:628
Table index or 'key'.
Definition: pfs_instr_class.h:355
uint m_name_length
Length in bytes of m_name.
Definition: pfs_instr_class.h:359
char m_name[NAME_LEN]
Index name.
Definition: pfs_instr_class.h:357
Statistics for table locks.
Definition: pfs_stat.h:690
Definition: pfs_name.h:134
Index statistics of a table.
Definition: pfs_instr_class.h:363
PFS_table_key m_key
The index name.
Definition: pfs_instr_class.h:366
PFS_table_io_stat m_stat
The index stat.
Definition: pfs_instr_class.h:368
pfs_lock m_lock
Definition: pfs_instr_class.h:364
PFS_table_share * m_owner
Owner table share.
Definition: pfs_instr_class.h:370
PFS_opaque_container_page * m_page
Container page.
Definition: pfs_instr_class.h:372
Key identifying a table share.
Definition: pfs_instr_class.h:343
PFS_schema_name m_schema_name
Table schema.
Definition: pfs_instr_class.h:348
PFS_table_name m_table_name
Table name.
Definition: pfs_instr_class.h:351
enum_object_type m_type
Object type.
Definition: pfs_instr_class.h:345
Lock statistics of a table.
Definition: pfs_instr_class.h:376
PFS_opaque_container_page * m_page
Container page.
Definition: pfs_instr_class.h:383
pfs_lock m_lock
Definition: pfs_instr_class.h:377
PFS_table_share * m_owner
Owner table share.
Definition: pfs_instr_class.h:381
PFS_table_lock_stat m_stat
Lock stats.
Definition: pfs_instr_class.h:379
Instrumentation metadata for a table share.
Definition: pfs_instr_class.h:387
PFS_table_share_key m_key
Search key.
Definition: pfs_instr_class.h:429
std::atomic< PFS_table_share_lock * > m_race_lock_stat
Table locks statistics.
Definition: pfs_instr_class.h:449
void dec_refcount(void)
Definition: pfs_instr_class.h:411
enum_object_type get_object_type()
Definition: pfs_instr_class.h:391
uint32 get_version()
Definition: pfs_instr_class.h:389
void inc_refcount(void)
Definition: pfs_instr_class.h:409
bool m_timed
True if table instrumentation is timed.
Definition: pfs_instr_class.h:426
bool m_enabled
True if table instrumentation is enabled.
Definition: pfs_instr_class.h:421
PFS_opaque_container_page * m_page
Container page.
Definition: pfs_instr_class.h:434
void init_refcount(void)
Definition: pfs_instr_class.h:405
int get_refcount(void)
Definition: pfs_instr_class.h:407
std::atomic< int > m_refcount
Number of opened table handles.
Definition: pfs_instr_class.h:447
uint m_key_count
Number of indexes.
Definition: pfs_instr_class.h:432
void aggregate(void)
Definition: pfs_instr_class.h:400
pfs_lock m_lock
Internal lock.
Definition: pfs_instr_class.h:416
Instrumentation metadata of a thread.
Definition: pfs_instr_class.h:331
PFS_thread * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:333
std::atomic< unsigned int > m_seqnum
Thread instance sequence number counter.
Definition: pfs_instr_class.h:339
Instrumented thread implementation.
Definition: pfs_instr.h:372
Instrumentation metadata for a transaction.
Definition: pfs_instr_class.h:540
Statistics for transaction usage.
Definition: pfs_stat.h:441
Condition information.
Definition: psi_cond_bits.h:87
File instrument information.
Definition: psi_file_bits.h:113
Memory instrument information.
Definition: psi_memory_bits.h:57
Mutex information.
Definition: psi_mutex_bits.h:72
Rwlock information.
Definition: psi_rwlock_bits.h:161
Socket instrument information.
Definition: psi_socket_bits.h:127
Stage instrument information.
Definition: psi_stage_bits.h:73
Statement instrument information.
Definition: psi_statement_bits.h:117
Thread instrument information.
Definition: psi_thread_bits.h:116
This structure is shared between different table objects.
Definition: table.h:688
A 'lock' protecting performance schema internal buffers.
Definition: pfs_lock.h:151
Definition: result.h:29
unsigned int uint
Definition: uca-dump.cc:29