MySQL  8.0.22
Source Code Documentation
pfs_thread_provider.h
Go to the documentation of this file.
1 /* Copyright (c) 2012, 2020, 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 #include "my_psi_config.h"
32 
33 #if defined(HAVE_PSI_THREAD_INTERFACE) && defined(MYSQL_SERVER) && \
34  !defined(MYSQL_DYNAMIC_PLUGIN) && !defined(WITH_LOCK_ORDER) && \
35  defined(__cplusplus)
36 
37 #include <sys/types.h>
38 #include <time.h>
39 
40 #include "my_inttypes.h"
41 #include "my_macros.h"
42 #include "mysql/psi/psi_thread.h"
43 
44 class THD;
45 
46 /*
47  Naming current apis as _vc (version 'current'),
48  to avoid changing the names every time
49  psi_thread_v<N> is replaced by psi_thread_v<N+1>.
50 */
51 
52 #define PSI_THREAD_CALL(M) pfs_##M##_vc
53 
55  int count);
56 
58  const my_thread_attr_t *attr,
59  void *(*start_routine)(void *), void *arg);
60 
62  ulonglong processlist_id);
63 
64 void pfs_set_thread_id_vc(PSI_thread *thread, ulonglong processlist_id);
65 
67 
69 
71 
72 void pfs_set_thread_THD_vc(PSI_thread *thread, THD *thd);
74 
76 
77 void pfs_set_thread_user_vc(const char *user, int user_len);
78 
79 void pfs_set_thread_account_vc(const char *user, int user_len, const char *host,
80  int host_len);
81 
82 void pfs_set_thread_db_vc(const char *db, int db_len);
83 
85 
87 
88 void pfs_set_thread_state_vc(const char *state);
89 
91 
92 void pfs_set_thread_info_vc(const char *info, uint info_len);
93 
94 int pfs_set_thread_resource_group_vc(const char *group_name, int group_name_len,
95  void *user_data);
96 
99  const char *group_name,
100  int group_name_len, void *user_data);
101 
102 void pfs_set_thread_vc(PSI_thread *thread);
103 
105 
107 
109 
110 void pfs_delete_thread_vc(PSI_thread *thread);
111 
113  const void *from_cs);
114 
115 void pfs_get_current_thread_event_id_vc(ulonglong *internal_thread_id,
116  ulonglong *event_id);
117 
119  ulonglong *internal_thread_id,
120  ulonglong *event_id);
121 
123 
126  PSI_thread_attrs *thread_attrs);
127 
129  bool with_ref_count);
130 
132 
134 
136 
138 
139 #endif /* HAVE_PSI_THREAD_INTERFACE */
140 
141 #endif
Some common macros.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
Performance schema instrumentation interface.
void pfs_set_thread_state_vc(const char *state)
int pfs_get_thread_system_attrs_vc(PSI_thread_attrs *thread_attrs)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3378
char * user
Definition: mysqladmin.cc:59
int opaque_vio_type
Definition: psi_thread_bits.h:51
void pfs_notify_session_connect_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3418
ssize_t count
Definition: memcached.c:386
void * handle
Definition: engine_loader.c:19
char buffer[STRING_BUFFER]
Definition: test_sql_9_sessions.cc:57
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:7335
void pfs_delete_thread_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3489
Include file for Sun RPC to compile out of the box.
Some integer typedefs for easier portability.
void pfs_set_thread_id_vc(PSI_thread *thread, ulonglong processlist_id)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2963
const LEX_CSTRING & db() const
Definition: sql_class.h:3539
void pfs_set_thread_user_vc(const char *user, int user_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3042
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:3286
int pfs_spawn_thread_vc(PSI_thread_key key, 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:2890
void pfs_set_thread_command_vc(int command)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3174
void pfs_set_thread_os_id_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3021
const char * host
Definition: mysqladmin.cc:58
void pfs_register_thread_vc(const char *category, PSI_thread_info *info, int count)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2395
void pfs_delete_current_thread_vc(void)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3475
void pfs_set_connection_type_vc(opaque_vio_type conn_type)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3189
void pfs_set_thread_peer_port_vc(PSI_thread *thread, uint port)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3453
ulonglong pfs_get_thread_internal_id_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2987
static in_port_t port
Definition: testapp.c:33
void pfs_notify_session_change_user_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3435
PSI_thread * pfs_get_thread_by_id_vc(ulonglong processlist_id)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2999
Definition: my_thread_bits.h:51
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
unsigned int uint
Definition: uca-dump.cc:29
void pfs_notify_session_disconnect_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3426
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:3093
PSI_thread * pfs_new_thread_vc(PSI_thread_key key, const void *identity, ulonglong processlist_id)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2941
struct timeval start_time
Definition: sql_class.h:1347
static const char * key
Definition: suite_stubs.c:14
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:7404
enum_state state
Definition: sql_class.h:268
static const char * category
Definition: sha2_password.cc:167
command
Definition: version_token.cc:278
void pfs_set_thread_THD_vc(PSI_thread *thread, THD *thd)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3009
Performance Schema thread type: user/foreground or system/background.
Definition: psi_thread_bits.h:348
Thread instrument information.
Definition: psi_thread_bits.h:78
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:3387
unsigned int PSI_thread_key
Instrumented thread key.
Definition: psi_thread_bits.h:48
int pfs_unregister_notification_vc(int handle)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3410
pthread_attr_t my_thread_attr_t
Definition: my_thread_bits.h:48
void pfs_aggregate_thread_status_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3464
int pfs_register_notification_vc(const PSI_notification *callbacks, bool with_ref_count)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3401
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:7431
PSI_thread * pfs_get_thread_vc(void)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3033
std::decay_t< T > identity
Definition: string_view.h:176
Log info(cout, "NOTE")
Registration structure for the pfs_notification service.
Definition: psi_thread_bits.h:401
static const sasl_callback_t callbacks[]
Definition: auth_ldap_sasl_client.h:44
void pfs_set_thread_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3444
void pfs_set_thread_db_vc(const char *db, int db_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3152
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:3276
void pfs_set_thread_info_vc(const char *info, uint info_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3223
struct PSI_thread PSI_thread
Definition: psi_thread_bits.h:71
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
void pfs_set_thread_start_time_vc(time_t start_time)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3204
static my_thread_id thread_id
Definition: my_thr_init.cc:62
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:803
ulonglong pfs_get_current_thread_internal_id_vc()
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2975