MySQL 8.0.39
Source Code Documentation
|
Performance schema instruments (implementation). More...
#include "storage/perfschema/pfs_instr.h"
#include <assert.h>
#include <string.h>
#include <atomic>
#include "my_compiler.h"
#include "my_psi_config.h"
#include "my_sys.h"
#include "sql/mysqld.h"
#include "storage/perfschema/pfs.h"
#include "storage/perfschema/pfs_account.h"
#include "storage/perfschema/pfs_buffer_container.h"
#include "storage/perfschema/pfs_builtin_memory.h"
#include "storage/perfschema/pfs_global.h"
#include "storage/perfschema/pfs_host.h"
#include "storage/perfschema/pfs_instr_class.h"
#include "storage/perfschema/pfs_stat.h"
#include "storage/perfschema/pfs_user.h"
Functions | |
int | init_instruments (const PFS_global_param *param) |
Initialize all the instruments instance buffers. More... | |
void | cleanup_instruments () |
Cleanup all the instruments buffers. More... | |
static const uchar * | filename_hash_get_key (const uchar *entry, size_t *length) |
Get hash table key for instrumented files. More... | |
static uint | filename_hash_func (const LF_HASH *, const uchar *key, size_t key_len) |
static int | filename_hash_cmp_func (const uchar *key1, size_t key_len1, const uchar *key2, size_t key_len2) |
int | init_file_hash (const PFS_global_param *param) |
Initialize the file name hash. More... | |
void | cleanup_file_hash () |
Cleanup the file name hash. More... | |
PFS_mutex * | create_mutex (PFS_mutex_class *klass, const void *identity) |
Create instrumentation for a mutex instance. More... | |
void | destroy_mutex (PFS_mutex *pfs) |
Destroy instrumentation for a mutex instance. More... | |
PFS_rwlock * | create_rwlock (PFS_rwlock_class *klass, const void *identity) |
Create instrumentation for a rwlock instance. More... | |
void | destroy_rwlock (PFS_rwlock *pfs) |
Destroy instrumentation for a rwlock instance. More... | |
PFS_cond * | create_cond (PFS_cond_class *klass, const void *identity) |
Create instrumentation for a condition instance. More... | |
void | destroy_cond (PFS_cond *pfs) |
Destroy instrumentation for a condition instance. More... | |
void | carry_global_memory_stat_alloc_delta (PFS_memory_stat_alloc_delta *delta, uint index) |
void | carry_global_memory_stat_free_delta (PFS_memory_stat_free_delta *delta, uint index) |
PFS_thread * | create_thread (PFS_thread_class *klass, PSI_thread_seqnum seqnum, const void *identity, ulonglong processlist_id) |
Create instrumentation for a thread instance. More... | |
PFS_thread * | find_thread_by_internal_id (ulonglong thread_id) |
Find a PFS thread given an internal thread id. More... | |
PFS_thread * | find_thread_by_processlist_id (ulonglong processlist_id) |
Find a PFS thread given a processlist id. More... | |
PFS_mutex * | sanitize_mutex (PFS_mutex *unsafe) |
PFS_rwlock * | sanitize_rwlock (PFS_rwlock *unsafe) |
PFS_cond * | sanitize_cond (PFS_cond *unsafe) |
PFS_thread * | sanitize_thread (PFS_thread *unsafe) |
Sanitize a PFS_thread pointer. More... | |
PFS_file * | sanitize_file (PFS_file *unsafe) |
PFS_socket * | sanitize_socket (PFS_socket *unsafe) |
PFS_metadata_lock * | sanitize_metadata_lock (PFS_metadata_lock *unsafe) |
void | destroy_thread (PFS_thread *pfs) |
Destroy instrumentation for a thread instance. More... | |
static LF_PINS * | get_filename_hash_pins (PFS_thread *thread) |
Get the hash pins for filename_hash . More... | |
int | normalize_filename (const char *filename, uint name_len, PFS_file_name &normalized) |
Normalize a filename with fully qualified path. More... | |
PFS_file * | find_or_create_file (PFS_thread *thread, PFS_file_class *klass, const char *filename, uint len, bool create) |
Find or create instrumentation for a file instance by file name. More... | |
PFS_file * | start_file_rename (PFS_thread *thread, const char *old_name) |
Before the rename operation: Find the file instrumentation by name, then delete the filename from the filename hash. More... | |
int | end_file_rename (PFS_thread *thread, PFS_file *pfs, const char *new_name, int rename_result) |
After the rename operation: Assign the new filename to the file instrumentation instance, then add to the filename hash. More... | |
PFS_file * | find_file (PFS_thread *thread, PFS_file_class *klass, const char *filename, uint len) |
Find a file instrumentation instance by name. More... | |
void | release_file (PFS_file *pfs) |
Release instrumentation for a file instance. More... | |
void | delete_file_name (PFS_thread *thread, PFS_file *pfs) |
Delete file name from the hash table. More... | |
void | destroy_file (PFS_thread *thread, PFS_file *pfs, bool delete_name) |
Destroy instrumentation for a file instance. More... | |
PFS_table * | create_table (PFS_table_share *share, PFS_thread *opening_thread, const void *identity) |
Create instrumentation for a table instance. More... | |
void | destroy_table (PFS_table *pfs) |
Destroy instrumentation for a table instance. More... | |
PFS_socket * | create_socket (PFS_socket_class *klass, const my_socket *fd, const struct sockaddr *addr, socklen_t addr_len) |
Create instrumentation for a socket instance. More... | |
void | destroy_socket (PFS_socket *pfs) |
Destroy instrumentation for a socket instance. More... | |
PFS_metadata_lock * | create_metadata_lock (void *identity, const MDL_key *mdl_key, opaque_mdl_type mdl_type, opaque_mdl_duration mdl_duration, opaque_mdl_status mdl_status, const char *src_file, uint src_line) |
void | destroy_metadata_lock (PFS_metadata_lock *pfs) |
static void | fct_reset_mutex_waits (PFS_mutex *pfs) |
static void | reset_mutex_waits_by_instance () |
static void | fct_reset_rwlock_waits (PFS_rwlock *pfs) |
static void | reset_rwlock_waits_by_instance () |
static void | fct_reset_cond_waits (PFS_cond *pfs) |
static void | reset_cond_waits_by_instance () |
static void | fct_reset_file_waits (PFS_file *pfs) |
static void | reset_file_waits_by_instance () |
static void | fct_reset_socket_waits (PFS_socket *pfs) |
static void | reset_socket_waits_by_instance () |
void | reset_events_waits_by_instance () |
Reset the wait statistics per object instance. More... | |
static void | fct_reset_file_io (PFS_file *pfs) |
void | reset_file_instance_io () |
Reset the I/O statistics per file instance. More... | |
static void | fct_reset_socket_io (PFS_socket *pfs) |
void | reset_socket_instance_io () |
Reset the I/O statistics per socket instance. More... | |
void | reset_histogram_global () |
void | aggregate_all_event_names (PFS_single_stat *from_array, PFS_single_stat *to_array) |
void | aggregate_all_event_names (PFS_single_stat *from_array, PFS_single_stat *to_array_1, PFS_single_stat *to_array_2) |
void | aggregate_all_stages (PFS_stage_stat *from_array, PFS_stage_stat *to_array) |
void | aggregate_all_stages (PFS_stage_stat *from_array, PFS_stage_stat *to_array_1, PFS_stage_stat *to_array_2) |
void | aggregate_all_statements (PFS_statement_stat *from_array, PFS_statement_stat *to_array) |
void | aggregate_all_statements (PFS_statement_stat *from_array, PFS_statement_stat *to_array_1, PFS_statement_stat *to_array_2) |
void | aggregate_all_transactions (PFS_transaction_stat *from_array, PFS_transaction_stat *to_array) |
void | aggregate_all_transactions (PFS_transaction_stat *from_array, PFS_transaction_stat *to_array_1, PFS_transaction_stat *to_array_2) |
void | aggregate_all_errors (PFS_error_stat *from_array, PFS_error_stat *to_array) |
void | aggregate_all_errors (PFS_error_stat *from_array, PFS_error_stat *to_array_1, PFS_error_stat *to_array_2) |
void | aggregate_all_memory_with_reassign (bool alive, PFS_memory_safe_stat *from_array, PFS_memory_shared_stat *to_array, PFS_memory_shared_stat *global_array) |
void | aggregate_all_memory (bool alive, PFS_memory_safe_stat *from_array, PFS_memory_shared_stat *to_array) |
void | aggregate_all_memory (bool alive, PFS_memory_shared_stat *from_array, PFS_memory_shared_stat *to_array) |
void | aggregate_all_memory_with_reassign (bool alive, PFS_memory_safe_stat *from_array, PFS_memory_shared_stat *to_array_1, PFS_memory_shared_stat *to_array_2, PFS_memory_shared_stat *global_array) |
void | aggregate_all_memory (bool alive, PFS_memory_shared_stat *from_array, PFS_memory_shared_stat *to_array_1, PFS_memory_shared_stat *to_array_2) |
void | aggregate_thread_status (PFS_thread *thread, PFS_account *safe_account, PFS_user *safe_user, PFS_host *safe_host) |
static void | aggregate_thread_stats (PFS_thread *thread, PFS_account *safe_account, PFS_user *safe_user, PFS_host *safe_host) |
void | aggregate_thread (PFS_thread *thread, PFS_account *safe_account, PFS_user *safe_user, PFS_host *safe_host) |
void | aggregate_thread_waits (PFS_thread *thread, PFS_account *safe_account, PFS_user *safe_user, PFS_host *safe_host) |
void | aggregate_thread_stages (PFS_thread *thread, PFS_account *safe_account, PFS_user *safe_user, PFS_host *safe_host) |
void | aggregate_thread_statements (PFS_thread *thread, PFS_account *safe_account, PFS_user *safe_user, PFS_host *safe_host) |
void | aggregate_thread_transactions (PFS_thread *thread, PFS_account *safe_account, PFS_user *safe_user, PFS_host *safe_host) |
void | aggregate_thread_errors (PFS_thread *thread, PFS_account *safe_account, PFS_user *safe_user, PFS_host *safe_host) |
void | aggregate_thread_memory (bool alive, PFS_thread *thread, PFS_account *safe_account, PFS_user *safe_user, PFS_host *safe_host) |
void | clear_thread_account (PFS_thread *thread) |
void | set_thread_account (PFS_thread *thread) |
static void | fct_update_mutex_derived_flags (PFS_mutex *pfs) |
void | update_mutex_derived_flags () |
Update derived flags for all mutex instances. More... | |
static void | fct_update_rwlock_derived_flags (PFS_rwlock *pfs) |
void | update_rwlock_derived_flags () |
Update derived flags for all rwlock instances. More... | |
static void | fct_update_cond_derived_flags (PFS_cond *pfs) |
void | update_cond_derived_flags () |
Update derived flags for all condition instances. More... | |
static void | fct_update_file_derived_flags (PFS_file *pfs) |
void | update_file_derived_flags () |
Update derived flags for all file handles. More... | |
static void | fct_update_table_derived_flags (PFS_table *pfs) |
void | update_table_derived_flags () |
Update derived flags for all table handles. More... | |
static void | fct_update_socket_derived_flags (PFS_socket *pfs) |
void | update_socket_derived_flags () |
Update derived flags for all socket instances. More... | |
static void | fct_reset_metadata_source_file_pointers (PFS_metadata_lock *pfs) |
static void | fct_update_metadata_derived_flags (PFS_metadata_lock *pfs) |
void | update_metadata_derived_flags () |
Update derived flags for all metadata instances. More... | |
static void | fct_update_thread_derived_flags (PFS_thread *pfs) |
void | update_thread_derived_flags () |
Update derived flags for all thread instances. More... | |
void | update_instruments_derived_flags () |
Update derived flags for all instruments. More... | |
static void | fct_reset_source_file_pointers (PFS_thread *pfs_thread) |
For each thread, clear the source file pointers from all waits, stages, statements and transaction events. More... | |
void | reset_source_file_pointers () |
Clear the source file pointers from all waits, stages, statements and transaction events. More... | |
Variables | |
ulong | nested_statement_lost = 0 |
long | file_handle_max = 0 |
Size of the file handle array. More... | |
bool | file_handle_full |
True when file_handle_array is full. More... | |
ulong | file_handle_lost = 0 |
Number of file handle lost. More... | |
ulong | events_waits_history_per_thread = 0 |
Number of EVENTS_WAITS_HISTORY records per thread. More... | |
ulong | events_stages_history_per_thread = 0 |
Number of EVENTS_STAGES_HISTORY records per thread. More... | |
ulong | events_statements_history_per_thread = 0 |
Number of EVENTS_STATEMENTS_HISTORY records per thread. More... | |
uint | statement_stack_max = 0 |
Max size of the statements stack. More... | |
size_t | pfs_max_digest_length = 0 |
Max size of the digests token array. More... | |
size_t | pfs_max_sqltext = 0 |
Max size of SQL TEXT. More... | |
ulong | locker_lost = 0 |
Number of locker lost. More... | |
ulong | statement_lost = 0 |
Number of statements lost. More... | |
ulong | session_connect_attrs_size_per_thread |
Size of connection attribute storage per thread. More... | |
ulong | session_connect_attrs_longest_seen = 0 |
Longest connection attributes string seen so far, pre-truncation. More... | |
ulong | session_connect_attrs_lost = 0 |
Number of connection attributes lost. More... | |
ulong | events_transactions_history_per_thread = 0 |
Number of EVENTS_TRANSACTIONS_HISTORY records per thread. More... | |
PFS_file ** | file_handle_array = nullptr |
File instrumentation handle array. More... | |
PFS_stage_stat * | global_instr_class_stages_array = nullptr |
PFS_statement_stat * | global_instr_class_statements_array = nullptr |
PFS_histogram | global_statements_histogram |
std::atomic< PFS_memory_shared_stat * > | global_instr_class_memory_array {nullptr} |
static PFS_cacheline_atomic_uint64 | thread_internal_id_counter |
LF_HASH | filename_hash |
Hash table for instrumented files. More... | |
static bool | filename_hash_inited = false |
True if filename_hash is initialized. More... | |
Performance schema instruments (implementation).
ulong nested_statement_lost = 0 |