MySQL  8.0.19
Source Code Documentation
pfs_thread_provider.h
Go to the documentation of this file.
1 /* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
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 
108 void pfs_delete_thread_vc(PSI_thread *thread);
109 
111  const void *from_cs);
112 
113 void pfs_get_current_thread_event_id_vc(ulonglong *internal_thread_id,
114  ulonglong *event_id);
115 
117  ulonglong *internal_thread_id,
118  ulonglong *event_id);
119 
121 
124  PSI_thread_attrs *thread_attrs);
125 
127  bool with_ref_count);
128 
130 
132 
134 
136 
137 #endif /* HAVE_PSI_THREAD_INTERFACE */
138 
139 #endif
pfs_delete_thread_vc
void pfs_delete_thread_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3459
THD
Definition: sql_class.h:764
pfs_get_thread_system_attrs_by_id_vc
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:3368
THD::db
const LEX_CSTRING & db() const
Definition: sql_class.h:3470
pfs_unregister_notification_vc
int pfs_unregister_notification_vc(int handle)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3391
pfs_get_current_thread_internal_id_vc
ulonglong pfs_get_current_thread_internal_id_vc()
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2949
pfs_notify_session_connect_vc
void pfs_notify_session_connect_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3399
pfs_get_thread_event_id_vc
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:7413
thread_id
static my_thread_id thread_id
Definition: my_thr_init.cc:62
pfs_set_thread_account_vc
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:3067
my_thread_attr_t
pthread_attr_t my_thread_attr_t
Definition: my_thread_bits.h:48
psi_thread.h
PSI_thread_info_v1
Thread instrument information.
Definition: psi_thread_bits.h:78
handle
void * handle
Definition: engine_loader.c:19
opaque_vio_type
int opaque_vio_type
Definition: psi_thread_bits.h:51
my_psi_config.h
THD::start_time
struct timeval start_time
Definition: sql_class.h:1301
pfs_new_thread_vc
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:2915
pfs_set_thread_resource_group_by_id_vc
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:3267
key
static const char * key
Definition: suite_stubs.c:14
pfs_get_current_thread_event_id_vc
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:7386
pfs_set_thread_resource_group_vc
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:3257
pfs_set_thread_id_vc
void pfs_set_thread_id_vc(PSI_thread *thread, ulonglong processlist_id)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2937
pfs_set_thread_user_vc
void pfs_set_thread_user_vc(const char *user, int user_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3016
host
const char * host
Definition: mysqladmin.cc:58
pfs_get_thread_system_attrs_vc
int pfs_get_thread_system_attrs_vc(PSI_thread_attrs *thread_attrs)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3359
pfs_set_thread_THD_vc
void pfs_set_thread_THD_vc(PSI_thread *thread, THD *thd)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2983
pfs_notify_session_change_user_vc
void pfs_notify_session_change_user_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3416
my_inttypes.h
pfs_set_thread_os_id_vc
void pfs_set_thread_os_id_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2995
pfs_set_thread_info_vc
void pfs_set_thread_info_vc(const char *info, uint info_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3197
pfs_set_thread_db_vc
void pfs_set_thread_db_vc(const char *db, int db_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3126
Query_arena::state
enum_state state
Definition: sql_class.h:266
pfs_register_thread_vc
void pfs_register_thread_vc(const char *category, PSI_thread_info *info, int count)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2369
time.h
uint
unsigned int uint
Definition: uca-dump.cc:29
pfs_set_thread_command_vc
void pfs_set_thread_command_vc(int command)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3148
PSI_thread_attrs_v3
Performance Schema thread type: user/foreground or system/background.
Definition: psi_thread_bits.h:338
pfs_aggregate_thread_status_vc
void pfs_aggregate_thread_status_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3434
sha2_password::category
static const char * category
Definition: sha2_password.cc:167
command
command
Definition: version_token.cc:278
my_thread_handle
Definition: my_thread_bits.h:51
user
char * user
Definition: mysqladmin.cc:59
stdx::impl::identity
std::decay_t< T > identity
Definition: string_view.h:176
callbacks
static const sasl_callback_t callbacks[]
Definition: auth_ldap_sasl_client.h:40
pfs_set_thread_vc
void pfs_set_thread_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3425
PSI_thread_key
unsigned int PSI_thread_key
Instrumented thread key.
Definition: psi_thread_bits.h:48
count
ssize_t count
Definition: memcached.c:386
pfs_set_thread_start_time_vc
void pfs_set_thread_start_time_vc(time_t start_time)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3178
pfs_set_thread_connect_attrs_vc
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:7317
PSI_notification_v3
Registration structure for the pfs_notification service.
Definition: psi_thread_bits.h:391
pfs_set_connection_type_vc
void pfs_set_connection_type_vc(opaque_vio_type conn_type)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3163
pfs_set_thread_state_vc
void pfs_set_thread_state_vc(const char *state)
pfs_spawn_thread_vc
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:2864
gis::length
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
ulonglong
unsigned long long int ulonglong
Definition: my_inttypes.h:55
pfs_get_thread_internal_id_vc
ulonglong pfs_get_thread_internal_id_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2961
my_macros.h
pfs_delete_current_thread_vc
void pfs_delete_current_thread_vc(void)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3445
pfs_notify_session_disconnect_vc
void pfs_notify_session_disconnect_vc(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3407
PSI_thread
struct PSI_thread PSI_thread
Definition: psi_thread_bits.h:71
pfs_register_notification_vc
int pfs_register_notification_vc(const PSI_notification *callbacks, bool with_ref_count)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3382
buffer
char buffer[STRING_BUFFER]
Definition: test_sql_9_sessions.cc:57
info
Log info(cout, "NOTE")
pfs_get_thread_vc
PSI_thread * pfs_get_thread_vc(void)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3007
pfs_get_thread_by_id_vc
PSI_thread * pfs_get_thread_by_id_vc(ulonglong processlist_id)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2973