MySQL  8.0.16
Source Code Documentation
pfs_thread_provider.h
Go to the documentation of this file.
1 /* Copyright (c) 2012, 2018, 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(__cplusplus)
35 
36 #include <sys/types.h>
37 #include <time.h>
38 
39 #include "my_inttypes.h"
40 #include "my_macros.h"
41 #include "my_thread.h"
42 #include "mysql/psi/psi_thread.h"
43 
44 class THD;
45 
46 #define PSI_THREAD_CALL(M) pfs_##M##_v2
47 
49  int count);
50 
52  const my_thread_attr_t *attr,
53  void *(*start_routine)(void *), void *arg);
54 
55 PSI_thread *pfs_new_thread_v2(PSI_thread_key key, const void *identity,
56  ulonglong processlist_id);
57 
58 void pfs_set_thread_id_v2(PSI_thread *thread, ulonglong processlist_id);
59 
61 
63 
65 
66 void pfs_set_thread_THD_v2(PSI_thread *thread, THD *thd);
68 
70 
71 void pfs_set_thread_user_v2(const char *user, int user_len);
72 
73 void pfs_set_thread_account_v2(const char *user, int user_len, const char *host,
74  int host_len);
75 
76 void pfs_set_thread_db_v2(const char *db, int db_len);
77 
79 
81 
82 void pfs_set_thread_state_v2(const char *state);
83 
85 
86 void pfs_set_thread_info_v2(const char *info, uint info_len);
87 
88 int pfs_set_thread_resource_group_v2(const char *group_name, int group_name_len,
89  void *user_data);
90 
93  const char *group_name,
94  int group_name_len, void *user_data);
95 
96 void pfs_set_thread_v2(PSI_thread *thread);
97 
99 
101 
102 void pfs_delete_thread_v2(PSI_thread *thread);
103 
105  const void *from_cs);
106 
107 void pfs_get_current_thread_event_id_v2(ulonglong *internal_thread_id,
108  ulonglong *event_id);
109 
111  ulonglong *internal_thread_id,
112  ulonglong *event_id);
113 
115 
118  PSI_thread_attrs *thread_attrs);
119 
121  bool with_ref_count);
122 
124 
126 
128 
130 
131 #endif /* HAVE_PSI_THREAD_INTERFACE */
132 
133 #endif
Some common macros.
unsigned long long int ulonglong
Definition: my_inttypes.h:69
Performance schema instrumentation interface.
void pfs_set_thread_info_v2(const char *info, uint info_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3179
int opaque_vio_type
Definition: psi_thread_bits.h:51
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
void pfs_notify_session_change_user_v2(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3398
void pfs_aggregate_thread_status_v2(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3416
Some integer typedefs for easier portability.
const LEX_CSTRING & db() const
Definition: sql_class.h:3383
void pfs_delete_current_thread_v2(void)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3427
void pfs_set_thread_os_id_v2(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2977
void pfs_set_thread_command_v2(int command)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3130
void pfs_set_thread_state_v2(const char *state)
void pfs_get_thread_event_id_v2(PSI_thread *thread, ulonglong *internal_thread_id, ulonglong *event_id)
Implementation of the get event id interface.
Definition: pfs.cc:7304
void pfs_set_thread_THD_v2(PSI_thread *thread, THD *thd)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2965
void pfs_set_thread_account_v2(const char *user, int user_len, const char *host, int host_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3049
void pfs_register_thread_v2(const char *category, PSI_thread_info *info, int count)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2351
int pfs_get_thread_system_attrs_v2(PSI_thread_attrs *thread_attrs)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3341
char * host
Definition: mysqladmin.cc:57
Performance Schema thread type: user/foreground or system/background.
Definition: psi_thread_bits.h:338
void pfs_set_thread_user_v2(const char *user, int user_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2998
char * user
Definition: mysqladmin.cc:57
void pfs_notify_session_connect_v2(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3381
int pfs_spawn_thread_v2(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:2846
PSI_thread * pfs_get_thread_v2(void)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2989
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
PSI_thread * pfs_new_thread_v2(PSI_thread_key key, const void *identity, ulonglong processlist_id)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2897
ulonglong pfs_get_thread_internal_id_v2(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2943
int pfs_get_thread_system_attrs_by_id_v2(PSI_thread *thread, ulonglong thread_id, PSI_thread_attrs *thread_attrs)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3350
Defines to make different thread packages compatible.
struct timeval start_time
Definition: sql_class.h:1295
static const char * key
Definition: suite_stubs.c:14
enum_state state
Definition: sql_class.h:267
static const char * category
Definition: sha2_password.cc:168
void pfs_set_thread_db_v2(const char *db, int db_len)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3108
command
Definition: version_token.cc:278
void pfs_set_connection_type_v2(opaque_vio_type conn_type)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3145
Registration structure for the pfs_notification service.
Definition: psi_thread_bits.h:391
Thread instrument information.
Definition: psi_thread_bits.h:78
unsigned int PSI_thread_key
Instrumented thread key.
Definition: psi_thread_bits.h:48
pthread_attr_t my_thread_attr_t
Definition: my_thread_bits.h:48
PSI_thread * pfs_get_thread_by_id_v2(ulonglong processlist_id)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2955
int pfs_set_thread_connect_attrs_v2(const char *buffer, uint length, const void *from_cs)
Implementation of the thread attribute connection interface.
Definition: pfs.cc:7208
int pfs_set_thread_resource_group_by_id_v2(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:3249
void pfs_set_thread_start_time_v2(time_t start_time)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3160
int pfs_set_thread_resource_group_v2(const char *group_name, int group_name_len, void *user_data)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3239
void pfs_notify_session_disconnect_v2(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3389
void pfs_set_thread_v2(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3407
void pfs_set_thread_id_v2(PSI_thread *thread, ulonglong processlist_id)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2919
Log info(cout, "NOTE")
void pfs_get_current_thread_event_id_v2(ulonglong *internal_thread_id, ulonglong *event_id)
Implementation of the get event id interface.
Definition: pfs.cc:7277
static const sasl_callback_t callbacks[]
Definition: auth_ldap_sasl_client.h:40
void pfs_delete_thread_v2(PSI_thread *thread)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3441
int pfs_register_notification_v2(const PSI_notification *callbacks, bool with_ref_count)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3364
int pfs_unregister_notification_v2(int handle)
Implementation of the thread instrumentation interface.
Definition: pfs.cc:3373
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
ulonglong pfs_get_current_thread_internal_id_v2()
Implementation of the thread instrumentation interface.
Definition: pfs.cc:2931
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:776