MySQL 8.0.39
Source Code Documentation
|
Classes | |
struct | PSI_thread_info_v1 |
Thread instrument information. More... | |
struct | PSI_thread_info_v5 |
Thread instrument information. More... | |
struct | PSI_thread_attrs_v3 |
Performance Schema thread type: user/foreground or system/background. More... | |
struct | PSI_notification_v3 |
Registration structure for the pfs_notification service. More... | |
struct | PSI_thread_bootstrap |
Entry point for the performance schema interface. More... | |
struct | PSI_thread_service_v4 |
Performance Schema Thread Interface, version 4. More... | |
struct | PSI_thread_service_v5 |
Performance Schema Thread Interface, version 5. More... | |
struct | PSI_thread_service_v6 |
Performance Schema Thread Interface, version 6. More... | |
struct | PSI_thread_service_v7 |
Performance Schema Thread Interface, version 7. More... | |
Macros | |
#define | PSI_USERNAME_LENGTH (32 * 3) |
#define | PSI_NAME_LEN (64 * 3) |
#define | PSI_HOSTNAME_LENGTH (255) |
#define | PSI_THREAD_VERSION_1 1 |
Performance Schema Thread Interface number for version 1. More... | |
#define | PSI_THREAD_VERSION_2 2 |
Performance Schema Thread Interface number for version 2. More... | |
#define | PSI_THREAD_VERSION_3 3 |
Performance Schema Thread Interface number for version 3. More... | |
#define | PSI_THREAD_VERSION_4 4 |
Performance Schema Thread Interface number for version 4. More... | |
#define | PSI_THREAD_VERSION_5 5 |
Performance Schema Thread Interface number for version 5. More... | |
#define | PSI_THREAD_VERSION_6 6 |
Performance Schema Thread Interface number for version 6. More... | |
#define | PSI_THREAD_VERSION_7 7 |
Performance Schema Thread Interface number for version 7. More... | |
#define | PSI_CURRENT_THREAD_VERSION 7 |
Performance Schema Thread Interface number for the most recent version. More... | |
Typedefs | |
typedef unsigned int | PSI_thread_key |
Instrumented thread key. More... | |
typedef unsigned int | PSI_thread_seqnum |
Instrumented thread sequence number. More... | |
typedef int | opaque_vio_type |
typedef struct PSI_thread | PSI_thread |
typedef struct PSI_thread_info_v1 | PSI_thread_info_v1 |
typedef struct PSI_thread_info_v5 | PSI_thread_info_v5 |
typedef void(* | register_thread_v1_t) (const char *category, struct PSI_thread_info_v1 *info, int count) |
Thread registration API. More... | |
typedef void(* | register_thread_v5_t) (const char *category, struct PSI_thread_info_v5 *info, int count) |
Thread registration API. More... | |
typedef 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. More... | |
typedef 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) |
typedef struct PSI_thread *(* | new_thread_v1_t) (PSI_thread_key key, const void *identity, unsigned long long thread_id) |
Create instrumentation for a thread. More... | |
typedef struct PSI_thread *(* | new_thread_v5_t) (PSI_thread_key key, PSI_thread_seqnum seqnum, const void *identity, unsigned long long thread_id) |
typedef void(* | set_thread_THD_v1_t) (struct PSI_thread *thread, THD *thd) |
Assign a THD to an instrumented thread. More... | |
typedef void(* | set_thread_id_v1_t) (struct PSI_thread *thread, unsigned long long id) |
Assign an id to an instrumented thread. More... | |
typedef unsigned long long(* | get_current_thread_internal_id_v2_t) () |
Read the THREAD_ID of the current thread. More... | |
typedef unsigned long long(* | get_thread_internal_id_v2_t) (struct PSI_thread *thread) |
Read the THREAD_ID of an instrumented thread. More... | |
typedef struct PSI_thread *(* | get_thread_by_id_v2_t) (unsigned long long processlist_id) |
Get the instrumentation for the thread of given PROCESSLIST_ID. More... | |
typedef void(* | set_thread_os_id_v1_t) (struct PSI_thread *thread) |
Assign the current operating system thread id to an instrumented thread. More... | |
typedef struct PSI_thread *(* | get_thread_v1_t) (void) |
Get the instrumentation for the running thread. More... | |
typedef void(* | set_thread_user_v1_t) (const char *user, int user_len) |
Assign a user name to the instrumented thread. More... | |
typedef 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. More... | |
typedef void(* | set_thread_db_v1_t) (const char *db, int db_len) |
Assign a current database to the instrumented thread. More... | |
typedef void(* | set_thread_command_v1_t) (int command) |
Assign a current command to the instrumented thread. More... | |
typedef void(* | set_connection_type_v1_t) (opaque_vio_type conn_type) |
Assign a connection type to the instrumented thread. More... | |
typedef void(* | set_thread_start_time_v1_t) (time_t start_time) |
Assign a start time to the instrumented thread. More... | |
typedef void(* | set_thread_state_v1_t) (const char *state) |
Assign a state to the instrumented thread. More... | |
typedef void(* | set_thread_info_v1_t) (const char *info, unsigned int info_len) |
Assign a process info to the instrumented thread. More... | |
typedef void(* | set_thread_secondary_engine_v6_t) (bool secondary) |
Set a thread EXECUTION_ENGINE attribute. More... | |
typedef 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. More... | |
typedef 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 instrumentation or Performance Schema thread id. More... | |
typedef void(* | set_thread_v1_t) (struct PSI_thread *thread) |
Attach a thread instrumentation to the running thread. More... | |
typedef void(* | set_thread_peer_port_v4_t) (PSI_thread *thread, unsigned int port) |
Assign the remote (peer) port to the instrumented thread. More... | |
typedef void(* | aggregate_thread_status_v2_t) (struct PSI_thread *thread) |
Aggregate the thread status variables. More... | |
typedef void(* | delete_current_thread_v1_t) (void) |
Delete the current thread instrumentation. More... | |
typedef void(* | delete_thread_v1_t) (struct PSI_thread *thread) |
Delete a thread instrumentation. More... | |
typedef int(* | set_thread_connect_attrs_v1_t) (const char *buffer, unsigned int length, const void *from_cs) |
Stores an array of connection attributes. More... | |
typedef 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. More... | |
typedef void(* | get_thread_event_id_v1_t) (unsigned long long *thread_internal_id, unsigned long long *event_id) |
Get the thread current event. More... | |
typedef 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. More... | |
typedef struct PSI_thread_attrs_v3 | PSI_thread_attrs |
typedef void(* | PSI_notification_cb_v3) (const PSI_thread_attrs_v3 *thread_attrs) |
Callback for the pfs_notification service. More... | |
typedef struct PSI_notification_v3 | PSI_notification |
typedef int(* | get_thread_system_attrs_v3_t) (PSI_thread_attrs_v3 *thread_attrs) |
Get system attributes for the current thread. More... | |
typedef 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 Performance Schema thread id. More... | |
typedef int(* | register_notification_v3_t) (const PSI_notification_v3 *callbacks, bool with_ref_count) |
Register callback functions for the Notification service. More... | |
typedef int(* | unregister_notification_v1_t) (int handle) |
Unregister callback functions for the Notification service. More... | |
typedef void(* | notify_session_connect_v1_t) (PSI_thread *thread) |
Invoke the callback function registered for a session connect event. More... | |
typedef void(* | notify_session_disconnect_v1_t) (PSI_thread *thread) |
Invoke the callback function registered for a session disconnect event. More... | |
typedef void(* | notify_session_change_user_v1_t) (PSI_thread *thread) |
Invoke the callback function registered for a change user event. More... | |
typedef struct PSI_thread_info_v5 | PSI_thread_info |
typedef void(* | thread_detect_telemetry_v7_t) (PSI_thread *thread) |
typedef void(* | thread_abort_telemetry_v7_t) (PSI_thread *thread) |
typedef struct PSI_thread_bootstrap | PSI_thread_bootstrap |
typedef void(* | set_mem_cnt_THD_v1_t) (THD *thd, THD **backup_thd) |
Set instrumented thread used for memory counting. More... | |
typedef struct PSI_thread_service_v7 | PSI_thread_service_t |
Variables | |
MYSQL_PLUGIN_IMPORT PSI_thread_service_t * | psi_thread_service |
#define PSI_CURRENT_THREAD_VERSION 7 |
Performance Schema Thread Interface number for the most recent version.
The most current version is PSI_THREAD_VERSION_7
#define PSI_HOSTNAME_LENGTH (255) |
#define PSI_NAME_LEN (64 * 3) |
#define PSI_THREAD_VERSION_1 1 |
Performance Schema Thread Interface number for version 1.
This version is obsolete.
#define PSI_THREAD_VERSION_2 2 |
Performance Schema Thread Interface number for version 2.
This version is obsolete.
#define PSI_THREAD_VERSION_3 3 |
Performance Schema Thread Interface number for version 3.
This version is obsolete.
#define PSI_THREAD_VERSION_4 4 |
Performance Schema Thread Interface number for version 4.
This version is supported.
#define PSI_THREAD_VERSION_5 5 |
Performance Schema Thread Interface number for version 5.
This version is supported.
#define PSI_THREAD_VERSION_6 6 |
Performance Schema Thread Interface number for version 6.
This version is supported.
#define PSI_THREAD_VERSION_7 7 |
Performance Schema Thread Interface number for version 7.
This version is supported.
#define PSI_USERNAME_LENGTH (32 * 3) |
typedef void(* aggregate_thread_status_v2_t) (struct PSI_thread *thread) |
Aggregate the thread status variables.
typedef void(* delete_current_thread_v1_t) (void) |
Delete the current thread instrumentation.
typedef void(* delete_thread_v1_t) (struct PSI_thread *thread) |
Delete a thread instrumentation.
typedef 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.
[out] | thread_internal_id | The thread internal id |
[out] | event_id | The per thread event id. |
typedef unsigned long long(* get_current_thread_internal_id_v2_t) () |
Read the THREAD_ID of the current thread.
typedef struct PSI_thread *(* get_thread_by_id_v2_t) (unsigned long long processlist_id) |
Get the instrumentation for the thread of given PROCESSLIST_ID.
processlist_id | the thread id |
typedef void(* get_thread_event_id_v1_t) (unsigned long long *thread_internal_id, unsigned long long *event_id) |
Get the thread current event.
[out] | thread_internal_id | The thread internal id |
[out] | event_id | The per thread event id. |
typedef 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.
psi | the instrumented thread | |
[out] | thread_internal_id | The thread internal id |
[out] | event_id | The per thread event id. |
typedef unsigned long long(* get_thread_internal_id_v2_t) (struct PSI_thread *thread) |
Read the THREAD_ID of an instrumented thread.
thread | the instrumented thread |
typedef 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 Performance Schema thread id.
thread | pointer to the thread instrumentation. Ignored if NULL. |
thread_id | thread id of the target thread. Only used if thread is NULL. |
thread_attrs | pointer to pfs_thread_attr struct |
typedef int(* get_thread_system_attrs_v3_t) (PSI_thread_attrs_v3 *thread_attrs) |
Get system attributes for the current thread.
thread_attrs | pointer to pfs_thread_attr struct |
typedef struct PSI_thread *(* get_thread_v1_t) (void) |
Get the instrumentation for the running thread.
For this function to return a result, the thread instrumentation must have been attached to the running thread using set_thread()
typedef struct PSI_thread *(* new_thread_v1_t) (PSI_thread_key key, const void *identity, unsigned long long thread_id) |
Create instrumentation for a thread.
key | the registered key |
identity | an address typical of the thread |
thread_id | PROCESSLIST_ID of the thread |
typedef struct PSI_thread *(* new_thread_v5_t) (PSI_thread_key key, PSI_thread_seqnum seqnum, const void *identity, unsigned long long thread_id) |
typedef void(* notify_session_change_user_v1_t) (PSI_thread *thread) |
Invoke the callback function registered for a change user event.
thread | the thread instrumentation |
typedef void(* notify_session_connect_v1_t) (PSI_thread *thread) |
Invoke the callback function registered for a session connect event.
thread | the thread instrumentation |
typedef void(* notify_session_disconnect_v1_t) (PSI_thread *thread) |
Invoke the callback function registered for a session disconnect event.
thread | the thread instrumentation |
typedef int opaque_vio_type |
typedef struct PSI_notification_v3 PSI_notification |
typedef void(* PSI_notification_cb_v3) (const PSI_thread_attrs_v3 *thread_attrs) |
Callback for the pfs_notification service.
thread_attrs | system attributes of the current thread. |
typedef struct PSI_thread PSI_thread |
typedef struct PSI_thread_attrs_v3 PSI_thread_attrs |
typedef struct PSI_thread_bootstrap PSI_thread_bootstrap |
typedef struct PSI_thread_info_v5 PSI_thread_info |
typedef struct PSI_thread_info_v1 PSI_thread_info_v1 |
typedef struct PSI_thread_info_v5 PSI_thread_info_v5 |
typedef unsigned int PSI_thread_key |
Instrumented thread key.
To instrument a thread, a thread key must be obtained using register_thread
. Using a zero key always disable the instrumentation.
typedef unsigned int PSI_thread_seqnum |
Instrumented thread sequence number.
This sequence number is used in conjunction with foo, to print names like "foo-NN" in ps/top/debuggers ...
typedef struct PSI_thread_service_v7 PSI_thread_service_t |
typedef int(* register_notification_v3_t) (const PSI_notification_v3 *callbacks, bool with_ref_count) |
Register callback functions for the Notification service.
For best performance, set with_ref_count = false.
callbacks | structure of user-defined callback functions |
with_ref_count | true if callbacks can be unregistered |
typedef void(* register_thread_v1_t) (const char *category, struct PSI_thread_info_v1 *info, int count) |
Thread registration API.
category | a category name (typically a plugin name) |
info | an array of thread info to register |
count | the size of the info array |
typedef void(* register_thread_v5_t) (const char *category, struct PSI_thread_info_v5 *info, int count) |
Thread registration API.
category | a category name (typically a plugin name) |
info | an array of thread info to register |
count | the size of the info array |
typedef void(* set_connection_type_v1_t) (opaque_vio_type conn_type) |
Assign a connection type to the instrumented thread.
conn_type | the connection type |
Set instrumented thread used for memory counting.
[in] | thd | the instrumented thread |
[out] | backup_thd | the backup thread |
typedef 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.
user | the user name |
user_len | the user name length |
host | the host name |
host_len | the host name length |
typedef void(* set_thread_command_v1_t) (int command) |
Assign a current command to the instrumented thread.
command | the current command |
typedef int(* set_thread_connect_attrs_v1_t) (const char *buffer, unsigned int length, const void *from_cs) |
Stores an array of connection attributes.
buffer | char array of length encoded connection attributes in network format |
length | length of the data in buffer |
from_cs | charset in which buffer is encoded |
non_0 | attributes truncated |
0 | stored the attribute |
typedef void(* set_thread_db_v1_t) (const char *db, int db_len) |
Assign a current database to the instrumented thread.
db | the database name |
db_len | the database name length |
typedef void(* set_thread_id_v1_t) (struct PSI_thread *thread, unsigned long long id) |
Assign an id to an instrumented thread.
thread | the instrumented thread |
id | the PROCESSLIST_ID to assign |
typedef void(* set_thread_info_v1_t) (const char *info, unsigned int info_len) |
Assign a process info to the instrumented thread.
info | the process into string |
info_len | the process into string length |
typedef void(* set_thread_os_id_v1_t) (struct PSI_thread *thread) |
Assign the current operating system thread id to an instrumented thread.
The operating system task id is obtained from gettid()
thread | the instrumented thread |
typedef void(* set_thread_peer_port_v4_t) (PSI_thread *thread, unsigned int port) |
Assign the remote (peer) port to the instrumented thread.
thread | pointer to the thread instrumentation |
port | the remote port |
typedef 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 instrumentation or Performance Schema thread id.
thread | pointer to the thread instrumentation. Ignored if NULL. |
thread_id | thread id of the target thread. Only used if thread is NULL. |
group_name | resource group name string |
group_name_len | resource group name string length |
user_data | user-defined data return 0 if successful, 1 otherwise |
typedef 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.
group_name | resource group name string |
group_name_len | resource group name string length |
user_data | user-defined data return 0 if successful, 1 otherwise |
typedef void(* set_thread_secondary_engine_v6_t) (bool secondary) |
Set a thread EXECUTION_ENGINE attribute.
secondary | True for SECONDARY, false for PRIMARY. |
typedef void(* set_thread_start_time_v1_t) (time_t start_time) |
Assign a start time to the instrumented thread.
start_time | the thread start time |
typedef void(* set_thread_state_v1_t) (const char *state) |
Assign a state to the instrumented thread.
state | the thread state |
typedef void(* set_thread_THD_v1_t) (struct PSI_thread *thread, THD *thd) |
Assign a THD to an instrumented thread.
thread | the instrumented thread |
thd | the sql layer THD to assign |
typedef void(* set_thread_user_v1_t) (const char *user, int user_len) |
Assign a user name to the instrumented thread.
user | the user name |
user_len | the user name length |
typedef void(* set_thread_v1_t) (struct PSI_thread *thread) |
Attach a thread instrumentation to the running thread.
In case of thread pools, this method should be called when a worker thread picks a work item and runs it. Also, this method should be called if the instrumented code does not keep the pointer returned by new_thread()
and relies on get_thread()
instead.
thread | the thread instrumentation |
typedef 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.
This method creates a new thread, with instrumentation.
key | the instrumentation key for this thread |
thread | the resulting thread |
attr | the thread attributes |
start_routine | the thread start routine |
arg | the thread start routine argument |
typedef 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) |
typedef void(* thread_abort_telemetry_v7_t) (PSI_thread *thread) |
typedef void(* thread_detect_telemetry_v7_t) (PSI_thread *thread) |
typedef int(* unregister_notification_v1_t) (int handle) |
Unregister callback functions for the Notification service.
handle | registration handle returned by register_notification() |
|
extern |