MySQL 8.4.2
Source Code Documentation
pfs_instr_class.cc File Reference

Performance schema instruments metadata (implementation). More...

Classes

class  Proc_table_share_derived_flags
 
class  Proc_program_share_derived_flags
 

Macros

#define REGISTER_CLASS_BODY_PART(INDEX, ARRAY, MAX, NAME, NAME_LENGTH)
 
#define REGISTER_CLASS_BODY_PART_V2(INDEX, ARRAY, MAX, NAME, NAME_LENGTH)
 
#define FIND_CLASS_BODY(KEY, COUNT, ARRAY)
 
#define FIND_CLASS_BODY_V2(KEY, COUNT, ARRAY)
 

Functions

std::atomic< uint32pfs_unload_plugin_ref_count (0)
 Global performance schema reference count for plugin and component events. More...
 
static void configure_instr_class (PFS_instr_class *entry)
 Set user-defined configuration values for an instrument. More...
 
static void init_instr_class (PFS_instr_class *klass, const char *name, uint name_length, int flags, int volatility, const char *documentation, PFS_class_type class_type)
 
static uint safe_strlen (const char *s, uint max_len)
 Like strlen (or POSIX strnlen), but don't read past the max_len'th character. More...
 
void init_event_name_sizing (const PFS_global_param *param)
 
void register_global_classes ()
 
int init_sync_class (uint mutex_class_sizing, uint rwlock_class_sizing, uint cond_class_sizing)
 Initialize the instrument synch class buffers. More...
 
void cleanup_sync_class ()
 Cleanup the instrument synch class buffers. More...
 
int init_thread_class (uint thread_class_sizing)
 Initialize the thread class buffer. More...
 
void cleanup_thread_class ()
 Cleanup the thread class buffers. More...
 
int init_table_share (uint table_share_sizing)
 Initialize the table share buffer. More...
 
int init_meter_class (uint meter_class_sizing)
 Initialize the meter class buffer. More...
 
void cleanup_meter_class ()
 Cleanup the meter class buffers. More...
 
int init_metric_class (uint metric_class_sizing)
 Initialize the metric class buffer. More...
 
void cleanup_metric_class ()
 Cleanup the metric class buffers. More...
 
void cleanup_table_share ()
 Cleanup the table share buffers. More...
 
static const uchartable_share_hash_get_key (const uchar *entry, size_t *length)
 get_key function for table_share_hash. More...
 
static uint table_share_hash_func (const LF_HASH *, const uchar *key, size_t key_len)
 
static int table_share_hash_cmp_func (const uchar *key1, size_t key_len1, const uchar *key2, size_t key_len2)
 
int init_table_share_hash (const PFS_global_param *param)
 Initialize the table share hash table. More...
 
void cleanup_table_share_hash ()
 Cleanup the table share hash table. More...
 
static LF_PINSget_table_share_hash_pins (PFS_thread *thread)
 Get the hash pins for. More...
 
static void set_table_share_key (PFS_table_share_key *key, bool temporary, const char *schema_name, size_t schema_name_length, const char *table_name, size_t table_name_length)
 Set a table share hash key. More...
 
int init_table_share_lock_stat (uint table_stat_sizing)
 Initialize the table lock stat buffer. More...
 
PFS_table_share_lockcreate_table_share_lock_stat ()
 Create a table share lock instrumentation. More...
 
void release_table_share_lock_stat (PFS_table_share_lock *pfs)
 Release a table share lock instrumentation. More...
 
void cleanup_table_share_lock_stat ()
 Cleanup the table stat buffers. More...
 
int init_table_share_index_stat (uint index_stat_sizing)
 Initialize table index stat buffer. More...
 
PFS_table_share_indexcreate_table_share_index_stat (const TABLE_SHARE *server_share, uint server_index)
 Create a table share index instrumentation. More...
 
void release_table_share_index_stat (PFS_table_share_index *pfs)
 Release a table share index instrumentation. More...
 
void cleanup_table_share_index_stat ()
 Cleanup the table stat buffers. More...
 
int init_file_class (uint file_class_sizing)
 Initialize the file class buffer. More...
 
void cleanup_file_class ()
 Cleanup the file class buffers. More...
 
int init_stage_class (uint stage_class_sizing)
 Initialize the stage class buffer. More...
 
void cleanup_stage_class ()
 Cleanup the stage class buffers. More...
 
int init_statement_class (uint statement_class_sizing)
 Initialize the statement class buffer. More...
 
void cleanup_statement_class ()
 Cleanup the statement class buffers. More...
 
int init_socket_class (uint socket_class_sizing)
 Initialize the socket class buffer. More...
 
void cleanup_socket_class ()
 Cleanup the socket class buffers. More...
 
int init_memory_class (uint memory_class_sizing)
 Initialize the memory class buffer. More...
 
void cleanup_memory_class ()
 Cleanup the memory class buffers. More...
 
PFS_sync_key register_mutex_class (const char *name, uint name_length, PSI_mutex_info *info)
 Register a mutex instrumentation metadata. More...
 
PFS_sync_key register_rwlock_class (const char *name, uint name_length, PSI_rwlock_info *info)
 Register a rwlock instrumentation metadata. More...
 
PFS_sync_key register_cond_class (const char *name, uint name_length, PSI_cond_info *info)
 Register a condition instrumentation metadata. More...
 
PFS_mutex_classfind_mutex_class (PFS_sync_key key)
 Find a mutex instrumentation class by key. More...
 
PFS_mutex_classsanitize_mutex_class (PFS_mutex_class *unsafe)
 
PFS_rwlock_classfind_rwlock_class (PFS_sync_key key)
 Find a rwlock instrumentation class by key. More...
 
PFS_rwlock_classsanitize_rwlock_class (PFS_rwlock_class *unsafe)
 
PFS_cond_classfind_cond_class (PFS_sync_key key)
 Find a condition instrumentation class by key. More...
 
PFS_cond_classsanitize_cond_class (PFS_cond_class *unsafe)
 
PFS_meter_classfind_meter_class (PSI_meter_key key)
 Find a meter instrumentation class by key. More...
 
PFS_meter_classsanitize_meter_class (PFS_meter_class *unsafe)
 
PFS_metric_classfind_metric_class (PSI_metric_key key)
 Find a metric instrumentation class by key. More...
 
PFS_metric_classsanitize_metric_class (PFS_metric_class *unsafe)
 
PFS_thread_key register_thread_class (const char *name, uint name_length, PSI_thread_info *info)
 Register a thread instrumentation metadata. More...
 
PFS_thread_classfind_thread_class (PFS_sync_key key)
 Find a thread instrumentation class by key. More...
 
PFS_thread_classsanitize_thread_class (PFS_thread_class *unsafe)
 
PFS_file_key register_file_class (const char *name, uint name_length, PSI_file_info *info)
 Register a file instrumentation metadata. More...
 
PFS_stage_key register_stage_class (const char *name, uint prefix_length, uint name_length, PSI_stage_info *info)
 Register a stage instrumentation metadata. More...
 
PFS_statement_key register_statement_class (const char *name, uint name_length, PSI_statement_info *info)
 Register a statement instrumentation metadata. More...
 
PFS_file_classfind_file_class (PFS_file_key key)
 Find a file instrumentation class by key. More...
 
PFS_file_classsanitize_file_class (PFS_file_class *unsafe)
 
PFS_stage_classfind_stage_class (PFS_stage_key key)
 Find a stage instrumentation class by key. More...
 
PFS_stage_classsanitize_stage_class (PFS_stage_class *unsafe)
 
PFS_statement_classfind_statement_class (PFS_stage_key key)
 Find a statement instrumentation class by key. More...
 
PFS_statement_classsanitize_statement_class (PFS_statement_class *unsafe)
 
PFS_socket_key register_socket_class (const char *name, uint name_length, PSI_socket_info *info)
 Register a socket instrumentation metadata. More...
 
PFS_socket_classfind_socket_class (PFS_socket_key key)
 Find a socket instrumentation class by key. More...
 
PFS_socket_classsanitize_socket_class (PFS_socket_class *unsafe)
 
PFS_memory_key register_memory_class (const char *name, uint name_length, PSI_memory_info *info)
 Register a memory instrumentation metadata. More...
 
PFS_memory_classfind_memory_class (PFS_memory_key key)
 Find a memory instrumentation class by key. More...
 
PFS_memory_classsanitize_memory_class (PFS_memory_class *unsafe)
 
PFS_meter_key register_meter_class (const char *name, uint name_length, PSI_meter_info_v1 *info)
 Register a meter instrumentation metadata. More...
 
void unregister_meter_class (PSI_meter_info_v1 *info)
 
uint32 meter_class_count ()
 
PFS_metric_key register_metric_class (const char *name, uint name_length, PSI_metric_info_v1 *info, const char *meter)
 Register a metric instrumentation metadata. More...
 
void unregister_metric_class (PSI_metric_info_v1 *info)
 
uint32 metric_class_count ()
 
PFS_instr_classfind_table_class (uint index)
 
PFS_instr_classsanitize_table_class (PFS_instr_class *unsafe)
 
PFS_instr_classfind_idle_class (uint index)
 
PFS_instr_classsanitize_idle_class (PFS_instr_class *unsafe)
 
PFS_instr_classfind_metadata_class (uint index)
 
PFS_instr_classsanitize_metadata_class (PFS_instr_class *unsafe)
 
PFS_error_classfind_error_class (uint index)
 
PFS_error_classsanitize_error_class (PFS_error_class *unsafe)
 
PFS_transaction_classfind_transaction_class (uint index)
 
PFS_transaction_classsanitize_transaction_class (PFS_transaction_class *unsafe)
 
static int compare_keys (PFS_table_share *pfs, const TABLE_SHARE *share)
 
PFS_table_sharefind_or_create_table_share (PFS_thread *thread, bool temporary, const TABLE_SHARE *share)
 Find or create a table share instrumentation. More...
 
void release_table_share (PFS_table_share *pfs)
 
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. More...
 
PFS_table_sharesanitize_table_share (PFS_table_share *unsafe)
 Sanitize an unsafe table_share pointer. More...
 
void reset_events_waits_by_class ()
 Reset the wait statistics per instrument class. More...
 
void reset_file_class_io ()
 Reset the I/O statistics per file class. More...
 
void reset_socket_class_io ()
 Reset the I/O statistics per socket class. More...
 
void update_table_share_derived_flags (PFS_thread *thread)
 Update derived flags for all table shares. More...
 
void update_program_share_derived_flags (PFS_thread *thread)
 Update derived flags for all stored procedure shares. More...
 
ulonglong gtid_monitoring_getsystime ()
 Get current time for GTID monitoring. More...
 

Variables

bool pfs_enabled = true
 Global performance schema flag. More...
 
Pfs_instr_config_arraypfs_instr_config_array = nullptr
 PFS_INSTRUMENT option settings array. More...
 
static std::atomic< uint32mutex_class_dirty_count {0}
 Current number of elements in mutex_class_array. More...
 
static std::atomic< uint32mutex_class_allocated_count {0}
 
static std::atomic< uint32rwlock_class_dirty_count {0}
 
static std::atomic< uint32rwlock_class_allocated_count {0}
 
static std::atomic< uint32cond_class_dirty_count {0}
 
static std::atomic< uint32cond_class_allocated_count {0}
 
static std::atomic< uint32meter_class_dirty_count {0}
 
static std::atomic< uint32meter_class_allocated_count {0}
 
static std::atomic< uint32metric_class_dirty_count {0}
 
static std::atomic< uint32metric_class_allocated_count {0}
 
ulong mutex_class_max = 0
 Size of the mutex class array. More...
 
ulong mutex_class_lost = 0
 Number of mutex class lost. More...
 
ulong rwlock_class_max = 0
 Size of the rwlock class array. More...
 
ulong rwlock_class_lost = 0
 Number of rwlock class lost. More...
 
ulong cond_class_max = 0
 Size of the condition class array. More...
 
ulong cond_class_lost = 0
 Number of condition class lost. More...
 
ulong thread_class_max = 0
 Size of the thread class array. More...
 
ulong thread_class_lost = 0
 Number of thread class lost. More...
 
ulong file_class_max = 0
 Size of the file class array. More...
 
ulong file_class_lost = 0
 Number of file class lost. More...
 
ulong stage_class_max = 0
 Size of the stage class array. More...
 
ulong stage_class_lost = 0
 Number of stage class lost. More...
 
ulong statement_class_max = 0
 Size of the statement class array. More...
 
ulong statement_class_lost = 0
 Number of statement class lost. More...
 
ulong socket_class_max = 0
 Size of the socket class array. More...
 
ulong socket_class_lost = 0
 Number of socket class lost. More...
 
ulong memory_class_max = 0
 Size of the memory class array. More...
 
ulong memory_class_lost = 0
 Number of memory class lost. More...
 
ulong meter_class_max = 0
 Size of the meter class array. More...
 
ulong meter_class_lost = 0
 Number of meter class lost. More...
 
ulong metric_class_max = 0
 Size of the metric class array. More...
 
ulong metric_class_lost = 0
 Number of metric class lost. More...
 
ulong transaction_class_max = 0
 Number of transaction classes. More...
 
ulong error_class_max = 0
 Number of error classes. More...
 
PFS_mutex_classmutex_class_array = nullptr
 
PFS_rwlock_classrwlock_class_array = nullptr
 
PFS_cond_classcond_class_array = nullptr
 
PFS_meter_classmeter_class_array = nullptr
 
PFS_metric_classmetric_class_array = nullptr
 
static std::atomic< uint32thread_class_dirty_count {0}
 Current number or elements in thread_class_array. More...
 
static std::atomic< uint32thread_class_allocated_count {0}
 
static PFS_thread_classthread_class_array = nullptr
 
PFS_ALIGNED PFS_single_stat global_idle_stat
 Statistics for the IDLE instrument. More...
 
PFS_ALIGNED PFS_table_io_stat global_table_io_stat
 Statistics for dropped table I/O. More...
 
PFS_ALIGNED PFS_table_lock_stat global_table_lock_stat
 Statistics for dropped table lock. More...
 
PFS_ALIGNED PFS_single_stat global_metadata_stat
 Statistics for the METADATA instrument. More...
 
PFS_ALIGNED PFS_transaction_stat global_transaction_stat
 Statistics for the transaction instrument. More...
 
PFS_ALIGNED PFS_error_stat global_error_stat
 Statistics for the error instrument. More...
 
PFS_ALIGNED PFS_instr_class global_table_io_class
 Instrument controlling all table I/O. More...
 
PFS_ALIGNED PFS_instr_class global_table_lock_class
 Instrument controlling all table lock. More...
 
PFS_ALIGNED PFS_instr_class global_idle_class
 Instrument controlling all idle waits. More...
 
PFS_ALIGNED PFS_instr_class global_metadata_class
 Instrument controlling all metadata locks. More...
 
PFS_ALIGNED PFS_error_class global_error_class
 Instrument controlling all server errors. More...
 
PFS_ALIGNED PFS_transaction_class global_transaction_class
 
PFS_ALIGNED PFS_meter_class global_meter_class
 
PFS_ALIGNED PFS_metric_class global_metric_class
 
LF_HASH table_share_hash
 Hash index for instrumented table shares. More...
 
static bool table_share_hash_inited = false
 True if table_share_hash is initialized. More...
 
static std::atomic< uint32file_class_dirty_count {0}
 
static std::atomic< uint32file_class_allocated_count {0}
 
PFS_file_classfile_class_array = nullptr
 
static std::atomic< uint32stage_class_dirty_count {0}
 
static std::atomic< uint32stage_class_allocated_count {0}
 
static PFS_stage_classstage_class_array = nullptr
 
static std::atomic< uint32statement_class_dirty_count {0}
 
static std::atomic< uint32statement_class_allocated_count {0}
 
static PFS_statement_classstatement_class_array = nullptr
 
static std::atomic< uint32socket_class_dirty_count {0}
 
static std::atomic< uint32socket_class_allocated_count {0}
 
static PFS_socket_classsocket_class_array = nullptr
 
static std::atomic< uint32memory_class_dirty_count {0}
 
static std::atomic< uint32memory_class_allocated_count {0}
 
static std::atomic< PFS_memory_class * > memory_class_array {nullptr}
 
uint mutex_class_start = 0
 
uint rwlock_class_start = 0
 
uint cond_class_start = 0
 
uint file_class_start = 0
 
uint wait_class_max = 0
 
uint socket_class_start = 0
 

Detailed Description

Performance schema instruments metadata (implementation).