MySQL  8.0.27
Source Code Documentation
pfs_thread_provider.h
Go to the documentation of this file.
1 /* Copyright (c) 2012, 2021, Oracle and/or its affiliates.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef PFS_THREAD_PROVIDER_H
24 #define PFS_THREAD_PROVIDER_H
25 
26 /**
27  @file include/pfs_thread_provider.h
28  Performance schema instrumentation (declarations).
29 */
30 
31 /* HAVE_PSI_*_INTERFACE */
32 #include "my_psi_config.h" // IWYU pragma: keep
33 
34 #ifdef HAVE_PSI_THREAD_INTERFACE
35 #if defined(MYSQL_SERVER) || defined(PFS_DIRECT_CALL)
36 #ifndef MYSQL_DYNAMIC_PLUGIN
37 #ifndef WITH_LOCK_ORDER
38 
39 #include <sys/types.h>
40 #include <time.h>
41 
42 #include "my_inttypes.h"
43 #include "my_macros.h"
44 #include "mysql/psi/psi_thread.h"
45 
46 #ifdef __cplusplus
47 class THD;
48 #endif /* __cplusplus */
49 
50 /*
51  Naming current apis as _vc (version 'current'),
52  to avoid changing the names every time
53  psi_thread_v<N> is replaced by psi_thread_v<N+1>.
54 */
55 
56 #define PSI_THREAD_CALL(M) pfs_##M##_vc
57 
59  int count);
60 
61 int pfs_spawn_thread_vc(PSI_thread_key key, unsigned int sequence_number,
62  my_thread_handle *thread, const my_thread_attr_t *attr,
63  void *(*start_routine)(void *), void *arg);
64 
65 PSI_thread *pfs_new_thread_vc(PSI_thread_key key, unsigned int sequence_number,
66  const void *identity, ulonglong processlist_id);
67 
68 void pfs_set_thread_id_vc(PSI_thread *thread, ulonglong processlist_id);
69 
71 
73 
75 
76 #ifdef __cplusplus
77 void pfs_set_thread_THD_vc(PSI_thread *thread, THD *thd);
78 #endif /* __cplusplus */
79 
81 
83 
84 void pfs_set_thread_user_vc(const char *user, int user_len);
85 
86 void pfs_set_thread_account_vc(const char *user, int user_len, const char *host,
87  int host_len);
88 
89 void pfs_set_thread_db_vc(const char *db, int db_len);
90 
92 
94 
95 void pfs_set_thread_state_vc(const char *state);
96 
98 
99 void pfs_set_thread_info_vc(const char *info, uint info_len);
100 
101 int pfs_set_thread_resource_group_vc(const char *group_name, int group_name_len,
102  void *user_data);
103 
106  const char *group_name,
107  int group_name_len, void *user_data);
108 
109 void pfs_set_thread_vc(PSI_thread *thread);
110 
112 
114 
116 
117 void pfs_delete_thread_vc(PSI_thread *thread);
118 
120  const void *from_cs);
121 
122 void pfs_get_current_thread_event_id_vc(ulonglong *internal_thread_id,
123  ulonglong *event_id);
124 
126  ulonglong *internal_thread_id,
127  ulonglong *event_id);
128 
130 
133  PSI_thread_attrs *thread_attrs);
134 
136  bool with_ref_count);
137 
139 
141 
143 
145 
146 #endif /* WITH_LOCK_ORDER */
147 #endif /* MYSQL_DYNAMIC_PLUGIN */
148 #endif /* MYSQL_SERVER || PFS_DIRECT_CALL */
149 #endif /* HAVE_PSI_THREAD_INTERFACE */
150 
151 #endif
static const sasl_callback_t callbacks[]
Definition: auth_ldap_sasl_client.h:44
enum_state state
Definition: sql_class.h:276
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:821
const LEX_CSTRING & db() const
Definition: sql_class.h:3662
struct timeval start_time
Definition: sql_class.h:1390
struct PSI_thread PSI_thread
Definition: psi_thread_bits.h:81
unsigned int PSI_thread_key
Instrumented thread key.
Definition: psi_thread_bits.h:49
int opaque_vio_type
Definition: psi_thread_bits.h:61
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
Some common macros.
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
static my_thread_id thread_id
Definition: my_thr_init.cc:62
pthread_attr_t my_thread_attr_t
Definition: my_thread_bits.h:48
static int count
Definition: myisam_ftdump.cc:42
Log info(cout, "NOTE")
char * user
Definition: mysqladmin.cc:59
const char * host
Definition: mysqladmin.cc:58
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:391
static int handle(int sql_errno, const char *sqlstate, const char *message, void *state)
Bridge function between the C++ API offered by this module and the C API of the parser service.
Definition: services.cc:64
static const char * category
Definition: sha2_password.cc:168
int pfs_get_thread_system_attrs_vc(PSI_thread_attrs *thread_attrs)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3456
PSI_thread * pfs_new_thread_vc(PSI_thread_key key, unsigned int sequence_number, const void *identity, ulonglong processlist_id)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3014
ulonglong pfs_get_current_thread_internal_id_vc()
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3053
void pfs_delete_thread_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3565
int pfs_spawn_thread_vc(PSI_thread_key key, unsigned int sequence_number, my_thread_handle *thread, const my_thread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2956
int pfs_set_thread_resource_group_vc(const char *group_name, int group_name_len, void *user_data)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3354
void pfs_register_thread_vc(const char *category, PSI_thread_info *info, int count)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2414
void pfs_set_connection_type_vc(opaque_vio_type conn_type)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3267
void pfs_get_current_thread_event_id_vc(ulonglong *internal_thread_id, ulonglong *event_id)
Implementation of the get event id interface.
Definition: pfs.cc:7513
void pfs_notify_session_change_user_vc(PSI_thread *thread)
PSI_thread * pfs_get_thread_vc(void)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3111
void pfs_set_thread_user_vc(const char *user, int user_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3120
void pfs_set_thread_id_vc(PSI_thread *thread, ulonglong processlist_id)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3041
PSI_thread * pfs_get_thread_by_id_vc(ulonglong processlist_id)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3077
void pfs_notify_session_disconnect_vc(PSI_thread *thread)
void pfs_notify_session_connect_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3496
void pfs_delete_current_thread_vc(void)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3551
void pfs_get_thread_event_id_vc(PSI_thread *thread, ulonglong *internal_thread_id, ulonglong *event_id)
Implementation of the get event id interface.
Definition: pfs.cc:7540
void pfs_set_thread_os_id_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3099
void pfs_set_thread_command_vc(int command)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3252
void pfs_set_thread_account_vc(const char *user, int user_len, const char *host, int host_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3171
void pfs_set_thread_info_vc(const char *info, uint info_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3301
int pfs_register_notification_vc(const PSI_notification *callbacks, bool with_ref_count)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3479
int pfs_get_thread_system_attrs_by_id_vc(PSI_thread *thread, ulonglong thread_id, PSI_thread_attrs *thread_attrs)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3465
void pfs_set_thread_state_vc(const char *state)
int pfs_set_thread_connect_attrs_vc(const char *buffer, uint length, const void *from_cs)
Implementation of the thread attribute connection interface.
Definition: pfs.cc:7444
void pfs_set_thread_start_time_vc(time_t start_time)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3282
void pfs_set_thread_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3520
void pfs_aggregate_thread_status_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3540
void pfs_set_thread_db_vc(const char *db, int db_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3230
void pfs_set_thread_peer_port_vc(PSI_thread *thread, uint port)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3529
void pfs_set_thread_THD_vc(PSI_thread *thread, THD *thd)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3087
int pfs_unregister_notification_vc(int handle)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3488
ulonglong pfs_get_thread_internal_id_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3065
int pfs_set_thread_resource_group_by_id_vc(PSI_thread *thread, ulonglong thread_id, const char *group_name, int group_name_len, void *user_data)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3364
Performance schema instrumentation interface.
required string key
Definition: replication_asynchronous_connection_failover.proto:59
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:32
Registration structure for the pfs_notification service.
Definition: psi_thread_bits.h:516
Performance Schema thread type: user/foreground or system/background.
Definition: psi_thread_bits.h:463
Thread instrument information.
Definition: psi_thread_bits.h:116
Definition: my_thread_bits.h:51
Include file for Sun RPC to compile out of the box.
unsigned int uint
Definition: uca-dump.cc:29
command
Definition: version_token.cc:279