23#ifndef MYSQL_PSI_THREAD_H
24#define MYSQL_PSI_THREAD_H
49#define PSI_THREAD_VERSION_1 1
56#define PSI_THREAD_VERSION_2 2
63#define PSI_THREAD_VERSION_3 3
70#define PSI_THREAD_VERSION_4 4
77#define PSI_THREAD_VERSION_5 5
84#define PSI_THREAD_VERSION_6 6
91#define PSI_CURRENT_THREAD_VERSION 6
111#ifdef HAVE_PSI_THREAD_INTERFACE
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:945
unsigned long long(* get_thread_internal_id_v2_t)(struct PSI_thread *thread)
Read the THREAD_ID of an instrumented thread.
Definition: psi_thread_bits.h:275
void(* set_mem_cnt_THD_v1_t)(THD *thd, THD **backup_thd)
Set instrumented thread used for memory counting.
Definition: psi_thread.h:118
int(* spawn_thread_v1_t)(PSI_thread_key key, my_thread_handle *thread, const my_thread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Spawn a thread.
Definition: psi_thread_bits.h:225
void(* get_current_thread_event_id_v2_t)(unsigned long long *thread_internal_id, unsigned long long *event_id)
Get the current thread current event.
Definition: psi_thread_bits.h:438
struct PSI_thread *(* new_thread_v5_t)(PSI_thread_key key, PSI_thread_seqnum seqnum, const void *identity, unsigned long long thread_id)
Definition: psi_thread_bits.h:245
void(* set_thread_THD_v1_t)(struct PSI_thread *thread, THD *thd)
Assign a THD to an instrumented thread.
Definition: psi_thread_bits.h:255
void(* set_thread_os_id_v1_t)(struct PSI_thread *thread)
Assign the current operating system thread id to an instrumented thread.
Definition: psi_thread_bits.h:291
void(* set_thread_id_v1_t)(struct PSI_thread *thread, unsigned long long id)
Assign an id to an instrumented thread.
Definition: psi_thread_bits.h:262
void(* notify_session_change_user_v1_t)(PSI_thread *thread)
Invoke the callback function registered for a changer user event.
Definition: psi_thread_bits.h:593
void(* set_thread_start_time_v1_t)(time_t start_time)
Assign a start time to the instrumented thread.
Definition: psi_thread_bits.h:342
void(* notify_session_disconnect_v1_t)(PSI_thread *thread)
Invoke the callback function registered for a session disconnect event.
Definition: psi_thread_bits.h:586
void(* set_thread_command_v1_t)(int command)
Assign a current command to the instrumented thread.
Definition: psi_thread_bits.h:330
int(* spawn_thread_v5_t)(PSI_thread_key key, PSI_thread_seqnum seqnum, my_thread_handle *thread, const my_thread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Definition: psi_thread_bits.h:229
void(* set_thread_info_v1_t)(const char *info, unsigned int info_len)
Assign a process info to the instrumented thread.
Definition: psi_thread_bits.h:355
void(* delete_current_thread_v1_t)(void)
Delete the current thread instrumentation.
Definition: psi_thread_bits.h:414
void(* set_thread_secondary_engine_v6_t)(bool secondary)
Set a thread EXECUTION_ENGINE attribute.
Definition: psi_thread_bits.h:361
void(* register_thread_v1_t)(const char *category, struct PSI_thread_info_v1 *info, int count)
Thread registration API.
Definition: psi_thread_bits.h:202
void(* set_thread_account_v1_t)(const char *user, int user_len, const char *host, int host_len)
Assign a user name and host name to the instrumented thread.
Definition: psi_thread_bits.h:316
int(* register_notification_v3_t)(const PSI_notification_v3 *callbacks, bool with_ref_count)
Register callback functions for the Notification service.
Definition: psi_thread_bits.h:562
void(* notify_session_connect_v1_t)(PSI_thread *thread)
Invoke the callback function registered for a session connect event.
Definition: psi_thread_bits.h:579
int(* set_thread_resource_group_v1_t)(const char *group_name, int group_name_len, void *user_data)
Assign a resource group name to the current thread.
Definition: psi_thread_bits.h:371
struct PSI_thread *(* get_thread_v1_t)(void)
Get the instrumentation for the running thread.
Definition: psi_thread_bits.h:300
void(* set_thread_user_v1_t)(const char *user, int user_len)
Assign a user name to the instrumented thread.
Definition: psi_thread_bits.h:307
void(* register_thread_v5_t)(const char *category, struct PSI_thread_info_v5 *info, int count)
Thread registration API.
Definition: psi_thread_bits.h:212
struct PSI_thread *(* new_thread_v1_t)(PSI_thread_key key, const void *identity, unsigned long long thread_id)
Create instrumentation for a thread.
Definition: psi_thread_bits.h:241
void(* aggregate_thread_status_v2_t)(struct PSI_thread *thread)
Aggregate the thread status variables.
Definition: psi_thread_bits.h:411
int(* unregister_notification_v1_t)(int handle)
Unregister callback functions for the Notification service.
Definition: psi_thread_bits.h:572
void(* delete_thread_v1_t)(struct PSI_thread *thread)
Delete a thread instrumentation.
Definition: psi_thread_bits.h:417
void(* set_thread_db_v1_t)(const char *db, int db_len)
Assign a current database to the instrumented thread.
Definition: psi_thread_bits.h:324
void(* set_thread_v1_t)(struct PSI_thread *thread)
Attach a thread instrumentation to the running thread.
Definition: psi_thread_bits.h:399
unsigned long long(* get_current_thread_internal_id_v2_t)()
Read the THREAD_ID of the current thread.
Definition: psi_thread_bits.h:268
int(* get_thread_system_attrs_v3_t)(PSI_thread_attrs_v3 *thread_attrs)
Get system attributes for the current thread.
Definition: psi_thread_bits.h:538
void(* set_thread_peer_port_v4_t)(PSI_thread *thread, unsigned int port)
Assign the remote (peer) port to the instrumented thread.
Definition: psi_thread_bits.h:407
int(* set_thread_connect_attrs_v1_t)(const char *buffer, unsigned int length, const void *from_cs)
Stores an array of connection attributes.
Definition: psi_thread_bits.h:429
MYSQL_PLUGIN_IMPORT PSI_thread_service_t * psi_thread_service
Definition: psi_noop.cc:239
int(* get_thread_system_attrs_by_id_v3_t)(PSI_thread *thread, unsigned long long thread_id, PSI_thread_attrs_v3 *thread_attrs)
Get system attributes for an instrumented thread, identified either by the thread instrumentation or ...
Definition: psi_thread_bits.h:549
struct PSI_thread *(* get_thread_by_id_v2_t)(unsigned long long processlist_id)
Get the instrumentation for the thread of given PROCESSLIST_ID.
Definition: psi_thread_bits.h:283
int(* set_thread_resource_group_by_id_v1_t)(PSI_thread *thread, unsigned long long thread_id, const char *group_name, int group_name_len, void *user_data)
Assign a resource group name to an instrumented thread, identified either by the thread instrumentati...
Definition: psi_thread_bits.h:386
void(* set_connection_type_v1_t)(opaque_vio_type conn_type)
Assign a connection type to the instrumented thread.
Definition: psi_thread_bits.h:336
void(* get_thread_event_id_v2_t)(struct PSI_thread *psi, unsigned long long *thread_internal_id, unsigned long long *event_id)
Get the thread current event.
Definition: psi_thread_bits.h:456
Some integer typedefs for easier portability.
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
Functions related to handling of plugins and other dynamically loaded libraries.
#define MYSQL_PLUGIN_IMPORT
Definition: my_sharedlib.h:70
Performance schema instrumentation interface.
required uint64 version
Definition: replication_group_member_actions.proto:40
Entry point for the performance schema interface.
Definition: psi_thread.h:94
Performance Schema Thread Interface, version 4.
Definition: psi_thread.h:124
set_thread_os_id_v1_t set_thread_os_id
Definition: psi_thread.h:142
get_thread_v1_t get_thread
Definition: psi_thread.h:144
delete_current_thread_v1_t delete_current_thread
Definition: psi_thread.h:170
spawn_thread_v1_t spawn_thread
Definition: psi_thread.h:128
register_notification_v3_t register_notification
Definition: psi_thread.h:184
set_thread_v1_t set_thread
Definition: psi_thread.h:164
set_thread_peer_port_v4_t set_thread_peer_port
Definition: psi_thread.h:166
set_thread_db_v1_t set_thread_db
Definition: psi_thread.h:150
unregister_notification_v1_t unregister_notification
Definition: psi_thread.h:186
get_current_thread_event_id_v2_t get_current_thread_event_id
Definition: psi_thread.h:176
get_thread_internal_id_v2_t get_thread_internal_id
Definition: psi_thread.h:136
set_thread_command_v1_t set_thread_command
Definition: psi_thread.h:152
set_thread_user_v1_t set_thread_user
Definition: psi_thread.h:146
set_thread_info_v1_t set_thread_info
Definition: psi_thread.h:158
set_thread_resource_group_by_id_v1_t set_thread_resource_group_by_id
Definition: psi_thread.h:162
set_thread_connect_attrs_v1_t set_thread_connect_attrs
Definition: psi_thread.h:174
set_thread_start_time_v1_t set_thread_start_time
Definition: psi_thread.h:156
get_thread_system_attrs_v3_t get_thread_system_attrs
Definition: psi_thread.h:180
set_thread_THD_v1_t set_thread_THD
Definition: psi_thread.h:140
set_connection_type_v1_t set_connection_type
Definition: psi_thread.h:154
get_thread_event_id_v2_t get_thread_event_id
Definition: psi_thread.h:178
notify_session_change_user_v1_t notify_session_change_user
Definition: psi_thread.h:192
set_thread_resource_group_v1_t set_thread_resource_group
Definition: psi_thread.h:160
delete_thread_v1_t delete_thread
Definition: psi_thread.h:172
register_thread_v1_t register_thread
Definition: psi_thread.h:126
aggregate_thread_status_v2_t aggregate_thread_status
Definition: psi_thread.h:168
get_current_thread_internal_id_v2_t get_current_thread_internal_id
Definition: psi_thread.h:134
set_thread_account_v1_t set_thread_account
Definition: psi_thread.h:148
notify_session_connect_v1_t notify_session_connect
Definition: psi_thread.h:188
notify_session_disconnect_v1_t notify_session_disconnect
Definition: psi_thread.h:190
get_thread_by_id_v2_t get_thread_by_id
Definition: psi_thread.h:138
new_thread_v1_t new_thread
Definition: psi_thread.h:130
set_thread_id_v1_t set_thread_id
Definition: psi_thread.h:132
get_thread_system_attrs_by_id_v3_t get_thread_system_attrs_by_id
Definition: psi_thread.h:182
Performance Schema Thread Interface, version 5.
Definition: psi_thread.h:204
register_notification_v3_t register_notification
Definition: psi_thread.h:264
aggregate_thread_status_v2_t aggregate_thread_status
Definition: psi_thread.h:248
spawn_thread_v5_t spawn_thread
Definition: psi_thread.h:208
get_thread_system_attrs_by_id_v3_t get_thread_system_attrs_by_id
Definition: psi_thread.h:262
set_thread_start_time_v1_t set_thread_start_time
Definition: psi_thread.h:236
get_thread_system_attrs_v3_t get_thread_system_attrs
Definition: psi_thread.h:260
set_thread_id_v1_t set_thread_id
Definition: psi_thread.h:212
set_thread_resource_group_by_id_v1_t set_thread_resource_group_by_id
Definition: psi_thread.h:242
register_thread_v5_t register_thread
Definition: psi_thread.h:206
unregister_notification_v1_t unregister_notification
Definition: psi_thread.h:266
set_thread_account_v1_t set_thread_account
Definition: psi_thread.h:228
set_connection_type_v1_t set_connection_type
Definition: psi_thread.h:234
set_thread_THD_v1_t set_thread_THD
Definition: psi_thread.h:220
set_mem_cnt_THD_v1_t set_mem_cnt_THD
Definition: psi_thread.h:274
set_thread_user_v1_t set_thread_user
Definition: psi_thread.h:226
set_thread_v1_t set_thread
Definition: psi_thread.h:244
get_thread_internal_id_v2_t get_thread_internal_id
Definition: psi_thread.h:216
notify_session_connect_v1_t notify_session_connect
Definition: psi_thread.h:268
notify_session_change_user_v1_t notify_session_change_user
Definition: psi_thread.h:272
delete_thread_v1_t delete_thread
Definition: psi_thread.h:252
get_thread_event_id_v2_t get_thread_event_id
Definition: psi_thread.h:258
get_current_thread_internal_id_v2_t get_current_thread_internal_id
Definition: psi_thread.h:214
get_thread_by_id_v2_t get_thread_by_id
Definition: psi_thread.h:218
notify_session_disconnect_v1_t notify_session_disconnect
Definition: psi_thread.h:270
get_thread_v1_t get_thread
Definition: psi_thread.h:224
set_thread_command_v1_t set_thread_command
Definition: psi_thread.h:232
set_thread_db_v1_t set_thread_db
Definition: psi_thread.h:230
set_thread_os_id_v1_t set_thread_os_id
Definition: psi_thread.h:222
get_current_thread_event_id_v2_t get_current_thread_event_id
Definition: psi_thread.h:256
set_thread_info_v1_t set_thread_info
Definition: psi_thread.h:238
new_thread_v5_t new_thread
Definition: psi_thread.h:210
set_thread_peer_port_v4_t set_thread_peer_port
Definition: psi_thread.h:246
delete_current_thread_v1_t delete_current_thread
Definition: psi_thread.h:250
set_thread_resource_group_v1_t set_thread_resource_group
Definition: psi_thread.h:240
set_thread_connect_attrs_v1_t set_thread_connect_attrs
Definition: psi_thread.h:254
Performance Schema Thread Interface, version 6.
Definition: psi_thread.h:283
set_thread_secondary_engine_v6_t set_thread_secondary_engine
Definition: psi_thread.h:319
set_thread_resource_group_v1_t set_thread_resource_group
Definition: psi_thread.h:321
set_thread_peer_port_v4_t set_thread_peer_port
Definition: psi_thread.h:327
aggregate_thread_status_v2_t aggregate_thread_status
Definition: psi_thread.h:329
get_thread_internal_id_v2_t get_thread_internal_id
Definition: psi_thread.h:295
get_current_thread_internal_id_v2_t get_current_thread_internal_id
Definition: psi_thread.h:293
set_thread_command_v1_t set_thread_command
Definition: psi_thread.h:311
get_thread_event_id_v2_t get_thread_event_id
Definition: psi_thread.h:339
delete_thread_v1_t delete_thread
Definition: psi_thread.h:333
set_thread_THD_v1_t set_thread_THD
Definition: psi_thread.h:299
register_notification_v3_t register_notification
Definition: psi_thread.h:345
set_thread_id_v1_t set_thread_id
Definition: psi_thread.h:291
set_thread_connect_attrs_v1_t set_thread_connect_attrs
Definition: psi_thread.h:335
notify_session_change_user_v1_t notify_session_change_user
Definition: psi_thread.h:353
get_thread_by_id_v2_t get_thread_by_id
Definition: psi_thread.h:297
delete_current_thread_v1_t delete_current_thread
Definition: psi_thread.h:331
set_thread_start_time_v1_t set_thread_start_time
Definition: psi_thread.h:315
notify_session_disconnect_v1_t notify_session_disconnect
Definition: psi_thread.h:351
new_thread_v5_t new_thread
Definition: psi_thread.h:289
get_thread_system_attrs_by_id_v3_t get_thread_system_attrs_by_id
Definition: psi_thread.h:343
get_thread_system_attrs_v3_t get_thread_system_attrs
Definition: psi_thread.h:341
register_thread_v5_t register_thread
Definition: psi_thread.h:285
set_thread_info_v1_t set_thread_info
Definition: psi_thread.h:317
get_current_thread_event_id_v2_t get_current_thread_event_id
Definition: psi_thread.h:337
set_thread_v1_t set_thread
Definition: psi_thread.h:325
set_thread_resource_group_by_id_v1_t set_thread_resource_group_by_id
Definition: psi_thread.h:323
set_thread_account_v1_t set_thread_account
Definition: psi_thread.h:307
set_thread_os_id_v1_t set_thread_os_id
Definition: psi_thread.h:301
spawn_thread_v5_t spawn_thread
Definition: psi_thread.h:287
set_thread_db_v1_t set_thread_db
Definition: psi_thread.h:309
notify_session_connect_v1_t notify_session_connect
Definition: psi_thread.h:349
set_thread_user_v1_t set_thread_user
Definition: psi_thread.h:305
get_thread_v1_t get_thread
Definition: psi_thread.h:303
set_mem_cnt_THD_v1_t set_mem_cnt_THD
Definition: psi_thread.h:355
unregister_notification_v1_t unregister_notification
Definition: psi_thread.h:347
set_connection_type_v1_t set_connection_type
Definition: psi_thread.h:313