MySQL 9.1.0
Source Code Documentation

Instrumented thread implementation. More...

#include <pfs_instr.h>

Inheritance diagram for PFS_thread:
[legend]

Public Member Functions

void reset_session_connect_attrs ()
 Reset session connect attributes. More...
 
void rebase_memory_stats ()
 Reset all memory statistics. More...
 
void carry_memory_stat_alloc_delta (PFS_memory_stat_alloc_delta *delta, uint index)
 
void carry_memory_stat_free_delta (PFS_memory_stat_free_delta *delta, uint index)
 
void set_enabled (bool enabled)
 
void set_history (bool history)
 
void set_history_derived_flags ()
 
void set_instr_class_memory_stats (PFS_memory_safe_stat *array)
 
const PFS_memory_safe_statread_instr_class_memory_stats () const
 
PFS_memory_safe_statwrite_instr_class_memory_stats ()
 
void mem_cnt_alloc (size_t size)
 
void mem_cnt_free (size_t size)
 
- Public Member Functions inherited from PFS_connection_slice
void reset_stats ()
 Reset all statistics. More...
 
void reset_waits_stats ()
 Reset all wait statistics. More...
 
void reset_stages_stats ()
 Reset all stages statistics. More...
 
void reset_statements_stats ()
 Reset all statements statistics. More...
 
void reset_transactions_stats ()
 Reset all transactions statistics. More...
 
void reset_errors_stats ()
 Reset all errors statistics. More...
 
void reset_status_stats ()
 Reset all status variable statistics. More...
 
void set_instr_class_waits_stats (PFS_single_stat *array)
 
const PFS_single_statread_instr_class_waits_stats () const
 
PFS_single_statwrite_instr_class_waits_stats ()
 
void set_instr_class_stages_stats (PFS_stage_stat *array)
 
const PFS_stage_statread_instr_class_stages_stats () const
 
PFS_stage_statwrite_instr_class_stages_stats ()
 
void set_instr_class_statements_stats (PFS_statement_stat *array)
 
const PFS_statement_statread_instr_class_statements_stats () const
 
PFS_statement_statwrite_instr_class_statements_stats ()
 
void set_instr_class_transactions_stats (PFS_transaction_stat *array)
 
const PFS_transaction_statread_instr_class_transactions_stats () const
 
PFS_transaction_statwrite_instr_class_transactions_stats ()
 
void set_instr_class_errors_stats (PFS_error_stat *array)
 
const PFS_error_statread_instr_class_errors_stats () const
 
PFS_error_statwrite_instr_class_errors_stats ()
 
void aggregate_status_stats (const System_status_var *status_vars)
 

Static Public Member Functions

static PFS_threadget_current_thread ()
 

Public Attributes

bool m_enabled
 Thread instrumentation flag. More...
 
bool m_history
 Thread history instrumentation flag. More...
 
bool m_flag_events_waits_history
 Derived flag flag_events_waits_history, per thread. More...
 
bool m_flag_events_waits_history_long
 Derived flag flag_events_waits_history_long, per thread. More...
 
bool m_flag_events_stages_history
 Derived flag flag_events_stages_history, per thread. More...
 
bool m_flag_events_stages_history_long
 Derived flag flag_events_stages_history_long, per thread. More...
 
bool m_flag_events_statements_history
 Derived flag flag_events_statements_history, per thread. More...
 
bool m_flag_events_statements_history_long
 Derived flag flag_events_statements_history_long, per thread. More...
 
bool m_flag_events_transactions_history
 Derived flag flag_events_transactions_history, per thread. More...
 
bool m_flag_events_transactions_history_long
 Derived flag flag_events_transactions_history_long, per thread. More...
 
PFS_events_waitsm_events_waits_current
 Current wait event in the event stack. More...
 
ulonglong m_event_id
 Event ID counter. More...
 
pfs_lock m_lock
 Internal lock. More...
 
LF_PINSm_filename_hash_pins
 Pins for filename_hash. More...
 
LF_PINSm_table_share_hash_pins
 Pins for table_share_hash. More...
 
LF_PINSm_setup_actor_hash_pins
 Pins for setup_actor_hash. More...
 
LF_PINSm_setup_object_hash_pins
 Pins for setup_object_hash. More...
 
LF_PINSm_host_hash_pins
 Pins for host_hash. More...
 
LF_PINSm_user_hash_pins
 Pins for user_hash. More...
 
LF_PINSm_account_hash_pins
 Pins for account_hash. More...
 
LF_PINSm_digest_hash_pins
 Pins for digest_hash. More...
 
LF_PINSm_program_hash_pins
 Pins for routine_hash. More...
 
ulonglong m_thread_internal_id
 Internal thread identifier, unique. More...
 
ulonglong m_parent_thread_internal_id
 Parent internal thread identifier. More...
 
ulong m_processlist_id
 External (. More...
 
my_thread_os_id_t m_thread_os_id
 External (Operating system) thread identifier, if any. More...
 
PFS_thread_classm_class
 Thread class. More...
 
bool m_system_thread
 True if a system thread. More...
 
PFS_events_waits m_events_waits_stack [WAIT_STACK_SIZE]
 Stack of events waits. More...
 
bool m_waits_history_full
 True if the circular buffer m_waits_history is full. More...
 
uint m_waits_history_index
 Current index in the circular buffer m_waits_history. More...
 
PFS_events_waitsm_waits_history
 Waits history circular buffer. More...
 
bool m_stages_history_full
 True if the circular buffer m_stages_history is full. More...
 
uint m_stages_history_index
 Current index in the circular buffer m_stages_history. More...
 
PFS_events_stagesm_stages_history
 Stages history circular buffer. More...
 
bool m_statements_history_full
 True if the circular buffer m_statements_history is full. More...
 
uint m_statements_history_index
 Current index in the circular buffer m_statements_history. More...
 
PFS_events_statementsm_statements_history
 Statements history circular buffer. More...
 
bool m_transactions_history_full
 True if the circular buffer m_transactions_history is full. More...
 
uint m_transactions_history_index
 Current index in the circular buffer m_transactions_history. More...
 
PFS_events_transactionsm_transactions_history
 Statements history circular buffer. More...
 
pfs_lock m_session_lock
 Internal lock, for session attributes. More...
 
PFS_user_name m_user_name
 User name. More...
 
PFS_host_name m_host_name
 Host name. More...
 
PFS_schema_name m_db_name
 Database name. More...
 
char m_groupname [NAME_LEN]
 Resource group name. More...
 
uint m_groupname_length
 Length of m_groupname. More...
 
char m_os_name [PFS_MAX_OS_NAME_LENGTH]
 Operating system name. More...
 
void * m_user_data
 User-defined data. More...
 
int m_command
 Current command. More...
 
enum_vio_type m_connection_type
 Connection type. More...
 
time_t m_start_time
 Start time. More...
 
pfs_lock m_stmt_lock
 Internal lock, for statement attributes. More...
 
PFS_stage_key m_stage
 Processlist state (derived from stage). More...
 
PSI_stage_progressm_stage_progress
 Current stage progress. More...
 
char m_processlist_info [COL_INFO_SIZE]
 Processlist info. More...
 
uint m_processlist_info_length
 Length of m_processlist_info_length. More...
 
bool m_secondary
 Executed on secondary engine. More...
 
PFS_events_stages m_stage_current
 
uint m_events_statements_count
 Size of m_events_statements_stack. More...
 
PFS_events_statementsm_statement_stack
 
PFS_events_transactions m_transaction_current
 
THDm_thd
 
THDm_cnt_thd
 
PFS_hostm_host
 
PFS_userm_user
 
PFS_accountm_account
 
uint m_peer_port
 Remote (peer) port. More...
 
struct sockaddr_storage m_sock_addr
 Raw socket address. More...
 
socklen_t m_sock_addr_len
 Length of address. More...
 
char * m_session_connect_attrs
 Buffer for the connection attributes. More...
 
uint m_session_connect_attrs_length
 Length used by m_connect_attrs. More...
 
uint m_session_connect_attrs_cs_number
 Character set in which m_connect_attrs are encoded. More...
 
PFS_memory_safe_statm_instr_class_memory_stats
 Per thread memory aggregated statistics. More...
 
const char * current_key_name
 
PFS_session_all_memory_stat m_session_all_memory_stat
 
telemetry_tm_telemetry
 Copy of g_telemetry. More...
 
telemetry_session_t * m_telemetry_session
 
bool m_debug_session_notified
 
- Public Attributes inherited from PFS_connection_slice
PFS_status_stats m_status_stats
 Aggregated status variables. More...
 
PFS_opaque_container_page * m_page
 Container page. More...
 

Additional Inherited Members

- Protected Attributes inherited from PFS_connection_slice
bool m_has_memory_stats {false}
 

Detailed Description

Instrumented thread implementation.

See also
PSI_thread.

Member Function Documentation

◆ read_instr_class_memory_stats()

const PFS_memory_safe_stat * PFS_thread::read_instr_class_memory_stats ( ) const
inline

◆ set_enabled()

void PFS_thread::set_enabled ( bool  enabled)
inline

◆ set_history()

void PFS_thread::set_history ( bool  history)
inline

◆ set_instr_class_memory_stats()

void PFS_thread::set_instr_class_memory_stats ( PFS_memory_safe_stat array)
inline

◆ write_instr_class_memory_stats()

PFS_memory_safe_stat * PFS_thread::write_instr_class_memory_stats ( )
inline

Member Data Documentation

◆ current_key_name

const char* PFS_thread::current_key_name

◆ m_account

PFS_account* PFS_thread::m_account

◆ m_account_hash_pins

LF_PINS* PFS_thread::m_account_hash_pins

Pins for account_hash.

◆ m_class

PFS_thread_class* PFS_thread::m_class

Thread class.

◆ m_cnt_thd

THD* PFS_thread::m_cnt_thd

◆ m_command

int PFS_thread::m_command

Current command.

◆ m_connection_type

enum_vio_type PFS_thread::m_connection_type

Connection type.

◆ m_db_name

PFS_schema_name PFS_thread::m_db_name

Database name.

Protected by m_stmt_lock.

◆ m_debug_session_notified

bool PFS_thread::m_debug_session_notified

◆ m_digest_hash_pins

LF_PINS* PFS_thread::m_digest_hash_pins

Pins for digest_hash.

◆ m_enabled

bool PFS_thread::m_enabled

Thread instrumentation flag.

◆ m_event_id

ulonglong PFS_thread::m_event_id

Event ID counter.

◆ m_events_statements_count

uint PFS_thread::m_events_statements_count

Size of m_events_statements_stack.

◆ m_events_waits_current

PFS_events_waits* PFS_thread::m_events_waits_current

Current wait event in the event stack.

◆ m_events_waits_stack

PFS_events_waits PFS_thread::m_events_waits_stack[WAIT_STACK_SIZE]

Stack of events waits.

This member holds the data for the table PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. Note that stack[0] is a dummy record that represents the parent stage/statement/transaction. For example, assuming the following tree:

  • STAGE ID 100
    • WAIT ID 101, parent STAGE 100
      • WAIT ID 102, parent wait 101 the data in the stack will be: stack[0].m_event_id= 100, set by the stage instrumentation stack[0].m_event_type= STAGE, set by the stage instrumentation stack[0].m_nesting_event_id= unused stack[0].m_nesting_event_type= unused stack[1].m_event_id= 101 stack[1].m_event_type= WAIT stack[1].m_nesting_event_id= stack[0].m_event_id= 100 stack[1].m_nesting_event_type= stack[0].m_event_type= STAGE stack[2].m_event_id= 102 stack[2].m_event_type= WAIT stack[2].m_nesting_event_id= stack[1].m_event_id= 101 stack[2].m_nesting_event_type= stack[1].m_event_type= WAIT

The whole point of the stack[0] record is to allow this optimization in the code, in the instrumentation for wait events: wait->m_nesting_event_id= (wait-1)->m_event_id; wait->m_nesting_event_type= (wait-1)->m_event_type; This code works for both the top level wait, and nested waits, and works without if conditions, which helps performances.

◆ m_filename_hash_pins

LF_PINS* PFS_thread::m_filename_hash_pins

Pins for filename_hash.

◆ m_flag_events_stages_history

bool PFS_thread::m_flag_events_stages_history

Derived flag flag_events_stages_history, per thread.

Cached computation of TABLE SETUP_CONSUMERS[EVENTS_STAGES_HISTORY].ENABLED == 'YES' AND TABLE THREADS[THREAD_ID].HISTORY == 'YES'

◆ m_flag_events_stages_history_long

bool PFS_thread::m_flag_events_stages_history_long

Derived flag flag_events_stages_history_long, per thread.

Cached computation of TABLE SETUP_CONSUMERS[EVENTS_STAGES_HISTORY_LONG].ENABLED == 'YES' AND TABLE THREADS[THREAD_ID].HISTORY == 'YES'

◆ m_flag_events_statements_history

bool PFS_thread::m_flag_events_statements_history

Derived flag flag_events_statements_history, per thread.

Cached computation of TABLE SETUP_CONSUMERS[EVENTS_STATEMENTS_HISTORY].ENABLED == 'YES' AND TABLE THREADS[THREAD_ID].HISTORY == 'YES'

◆ m_flag_events_statements_history_long

bool PFS_thread::m_flag_events_statements_history_long

Derived flag flag_events_statements_history_long, per thread.

Cached computation of TABLE SETUP_CONSUMERS[EVENTS_STATEMENTS_HISTORY_LONG].ENABLED == 'YES' AND TABLE THREADS[THREAD_ID].HISTORY == 'YES'

◆ m_flag_events_transactions_history

bool PFS_thread::m_flag_events_transactions_history

Derived flag flag_events_transactions_history, per thread.

Cached computation of TABLE SETUP_CONSUMERS[EVENTS_TRANSACTIONS_HISTORY].ENABLED == 'YES' AND TABLE THREADS[THREAD_ID].HISTORY == 'YES'

◆ m_flag_events_transactions_history_long

bool PFS_thread::m_flag_events_transactions_history_long

Derived flag flag_events_transactions_history_long, per thread.

Cached computation of TABLE SETUP_CONSUMERS[EVENTS_TRANSACTIONS_HISTORY_LONG].ENABLED == 'YES' AND TABLE THREADS[THREAD_ID].HISTORY == 'YES'

◆ m_flag_events_waits_history

bool PFS_thread::m_flag_events_waits_history

Derived flag flag_events_waits_history, per thread.

Cached computation of TABLE SETUP_CONSUMERS[EVENTS_WAITS_HISTORY].ENABLED == 'YES' AND TABLE THREADS[THREAD_ID].HISTORY == 'YES'

◆ m_flag_events_waits_history_long

bool PFS_thread::m_flag_events_waits_history_long

Derived flag flag_events_waits_history_long, per thread.

Cached computation of TABLE SETUP_CONSUMERS[EVENTS_WAITS_HISTORY_LONG].ENABLED == 'YES' AND TABLE THREADS[THREAD_ID].HISTORY == 'YES'

◆ m_groupname

char PFS_thread::m_groupname[NAME_LEN]

Resource group name.

Protected by m_session_lock.

◆ m_groupname_length

uint PFS_thread::m_groupname_length

Length of m_groupname.

Protected by m_session_lock.

◆ m_history

bool PFS_thread::m_history

Thread history instrumentation flag.

◆ m_host

PFS_host* PFS_thread::m_host

◆ m_host_hash_pins

LF_PINS* PFS_thread::m_host_hash_pins

Pins for host_hash.

◆ m_host_name

PFS_host_name PFS_thread::m_host_name

Host name.

Protected by m_session_lock.

◆ m_instr_class_memory_stats

PFS_memory_safe_stat* PFS_thread::m_instr_class_memory_stats

Per thread memory aggregated statistics.

This member holds the data for the table PERFORMANCE_SCHEMA.MEMORY_SUMMARY_BY_THREAD_BY_EVENT_NAME. Immutable, safe to use without internal lock.

◆ m_lock

pfs_lock PFS_thread::m_lock

Internal lock.

This lock is exclusively used to protect against races when creating and destroying PFS_thread. Do not use this lock to protect thread attributes, use one of m_stmt_lock or m_session_lock instead.

◆ m_os_name

char PFS_thread::m_os_name[PFS_MAX_OS_NAME_LENGTH]

Operating system name.

◆ m_parent_thread_internal_id

ulonglong PFS_thread::m_parent_thread_internal_id

Parent internal thread identifier.

◆ m_peer_port

uint PFS_thread::m_peer_port

Remote (peer) port.

◆ m_processlist_id

ulong PFS_thread::m_processlist_id

External (.

SHOW PROCESSLIST
@ SHOW
Definition: sql_yacc.h:558

) thread identifier, not unique.

◆ m_processlist_info

char PFS_thread::m_processlist_info[COL_INFO_SIZE]

Processlist info.

Protected by m_stmt_lock.

◆ m_processlist_info_length

uint PFS_thread::m_processlist_info_length

Length of m_processlist_info_length.

Protected by m_stmt_lock.

◆ m_program_hash_pins

LF_PINS* PFS_thread::m_program_hash_pins

Pins for routine_hash.

◆ m_secondary

bool PFS_thread::m_secondary

Executed on secondary engine.

◆ m_session_all_memory_stat

PFS_session_all_memory_stat PFS_thread::m_session_all_memory_stat

◆ m_session_connect_attrs

char* PFS_thread::m_session_connect_attrs

Buffer for the connection attributes.

Protected by m_session_lock.

◆ m_session_connect_attrs_cs_number

uint PFS_thread::m_session_connect_attrs_cs_number

Character set in which m_connect_attrs are encoded.

Protected by m_session_lock.

◆ m_session_connect_attrs_length

uint PFS_thread::m_session_connect_attrs_length

Length used by m_connect_attrs.

Protected by m_session_lock.

◆ m_session_lock

pfs_lock PFS_thread::m_session_lock

Internal lock, for session attributes.

Statement attributes are expected to be updated in frequently, typically per session execution.

◆ m_setup_actor_hash_pins

LF_PINS* PFS_thread::m_setup_actor_hash_pins

Pins for setup_actor_hash.

◆ m_setup_object_hash_pins

LF_PINS* PFS_thread::m_setup_object_hash_pins

Pins for setup_object_hash.

◆ m_sock_addr

struct sockaddr_storage PFS_thread::m_sock_addr

Raw socket address.

◆ m_sock_addr_len

socklen_t PFS_thread::m_sock_addr_len

Length of address.

◆ m_stage

PFS_stage_key PFS_thread::m_stage

Processlist state (derived from stage).

◆ m_stage_current

PFS_events_stages PFS_thread::m_stage_current

◆ m_stage_progress

PSI_stage_progress* PFS_thread::m_stage_progress

Current stage progress.

◆ m_stages_history

PFS_events_stages* PFS_thread::m_stages_history

Stages history circular buffer.

This member holds the data for the table PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY.

◆ m_stages_history_full

bool PFS_thread::m_stages_history_full

True if the circular buffer m_stages_history is full.

◆ m_stages_history_index

uint PFS_thread::m_stages_history_index

Current index in the circular buffer m_stages_history.

◆ m_start_time

time_t PFS_thread::m_start_time

Start time.

◆ m_statement_stack

PFS_events_statements* PFS_thread::m_statement_stack

◆ m_statements_history

PFS_events_statements* PFS_thread::m_statements_history

Statements history circular buffer.

This member holds the data for the table PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_HISTORY.

◆ m_statements_history_full

bool PFS_thread::m_statements_history_full

True if the circular buffer m_statements_history is full.

◆ m_statements_history_index

uint PFS_thread::m_statements_history_index

Current index in the circular buffer m_statements_history.

◆ m_stmt_lock

pfs_lock PFS_thread::m_stmt_lock

Internal lock, for statement attributes.

Statement attributes are expected to be updated frequently, typically per statement execution.

◆ m_system_thread

bool PFS_thread::m_system_thread

True if a system thread.

◆ m_table_share_hash_pins

LF_PINS* PFS_thread::m_table_share_hash_pins

Pins for table_share_hash.

◆ m_telemetry

telemetry_t* PFS_thread::m_telemetry

Copy of g_telemetry.

◆ m_telemetry_session

telemetry_session_t* PFS_thread::m_telemetry_session

◆ m_thd

THD* PFS_thread::m_thd

◆ m_thread_internal_id

ulonglong PFS_thread::m_thread_internal_id

Internal thread identifier, unique.

◆ m_thread_os_id

my_thread_os_id_t PFS_thread::m_thread_os_id

External (Operating system) thread identifier, if any.

◆ m_transaction_current

PFS_events_transactions PFS_thread::m_transaction_current

◆ m_transactions_history

PFS_events_transactions* PFS_thread::m_transactions_history

Statements history circular buffer.

This member holds the data for the table PERFORMANCE_SCHEMA.EVENTS_TRANSACTIONS_HISTORY.

◆ m_transactions_history_full

bool PFS_thread::m_transactions_history_full

True if the circular buffer m_transactions_history is full.

◆ m_transactions_history_index

uint PFS_thread::m_transactions_history_index

Current index in the circular buffer m_transactions_history.

◆ m_user

PFS_user* PFS_thread::m_user

◆ m_user_data

void* PFS_thread::m_user_data

User-defined data.

◆ m_user_hash_pins

LF_PINS* PFS_thread::m_user_hash_pins

Pins for user_hash.

◆ m_user_name

PFS_user_name PFS_thread::m_user_name

User name.

Protected by m_session_lock.

◆ m_waits_history

PFS_events_waits* PFS_thread::m_waits_history

Waits history circular buffer.

This member holds the data for the table PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY.

◆ m_waits_history_full

bool PFS_thread::m_waits_history_full

True if the circular buffer m_waits_history is full.

◆ m_waits_history_index

uint PFS_thread::m_waits_history_index

Current index in the circular buffer m_waits_history.


The documentation for this struct was generated from the following files: