MySQL 8.0.31
Source Code Documentation
table_events_waits.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 2022, 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 TABLE_EVENTS_WAITS_H
24#define TABLE_EVENTS_WAITS_H
25
26/**
27 @file storage/perfschema/table_events_waits.h
28 Table EVENTS_WAITS_xxx (declarations).
29*/
30
31#include <sys/types.h>
32
33#include "my_base.h"
34#include "my_inttypes.h"
38
39class Field;
40class Plugin_table;
41struct PFS_events_waits;
42struct PFS_thread;
43struct TABLE;
44struct THR_LOCK;
45
46/**
47 @addtogroup performance_schema_tables
48 @{
49*/
50
51/** A row of table_events_waits_common. */
53 /** Column THREAD_ID. */
55 /** Column EVENT_ID. */
57 /** Column END_EVENT_ID. */
59 /** Column NESTING_EVENT_ID. */
61 /** Column NESTING_EVENT_TYPE. */
63 /** Column EVENT_NAME. */
64 const char *m_name;
65 /** Length in bytes of @c m_name. */
67 /** Column TIMER_START. */
69 /** Column TIMER_END. */
71 /** Column TIMER_WAIT. */
73 /** Column OBJECT_TYPE. */
74 const char *m_object_type;
75 /** Length in bytes of @c m_object_type. */
77 /** Column OBJECT_SCHEMA. */
79 /** Column OBJECT_NAME. */
81 /** Length in bytes of @c m_object_name. */
83 /** Column INDEX_NAME. */
85 /** Length in bytes of @c m_index_name. */
87 /** Column OBJECT_INSTANCE_BEGIN. */
89 /** Column SOURCE. */
91 /** Length in bytes of @c m_source. */
93 /** Column OPERATION. */
95 /** Column NUMBER_OF_BYTES. */
97 /** Column FLAGS. */
99};
100
101/** Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. */
104
105 inline void reset(void) {
106 m_index_1 = 0;
107 m_index_2 = 0;
108 }
109
110 inline void next_thread(void) {
111 m_index_1++;
112 m_index_2 = 0;
113 }
114};
115
116/** Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY. */
119
120 inline void reset(void) {
121 m_index_1 = 0;
122 m_index_2 = 0;
123 }
124
125 inline void next_thread(void) {
126 m_index_1++;
127 m_index_2 = 0;
128 }
129};
130
132 public:
135 m_key_1("THREAD_ID"),
136 m_key_2("EVENT_ID") {}
137
138 ~PFS_index_events_waits() override = default;
139
140 bool match(PFS_thread *pfs);
142
143 private:
146};
147
148/**
149 Adapter, for table sharing the structure of
150 PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT.
151*/
153 protected:
154 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
155 bool read_all) override;
156
158
159 ~table_events_waits_common() override = default;
160
166
168
169 /** Current row. */
171};
172
173/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. */
175 public:
176 /** Table share */
179 static int delete_all_rows();
180 static ha_rows get_row_count();
181
182 int index_init(uint idx, bool sorted) override;
183
184 int rnd_next() override;
185 int rnd_pos(const void *pos) override;
186 int index_next() override;
187 void reset_position(void) override;
188
189 protected:
191
192 public:
193 ~table_events_waits_current() override = default;
194
195 private:
198
199 /** Table share lock. */
201 /** Table definition. */
203
204 PFS_events_waits *get_wait(PFS_thread *pfs_thread, uint index_2);
206
207 /** Current position. */
209 /** Next position. */
211
213};
214
215/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY. */
217 public:
218 /** Table share */
221 static int delete_all_rows();
222 static ha_rows get_row_count();
223
224 void reset_position(void) override;
225
226 int index_init(uint idx, bool sorted) override;
227 int index_next() override;
228
229 int rnd_next() override;
230 int rnd_pos(const void *pos) override;
231
232 protected:
234
235 public:
236 ~table_events_waits_history() override = default;
237
238 private:
239 /** Table share lock. */
241 /** Table definition. */
243
244 PFS_events_waits *get_wait(PFS_thread *pfs_thread, uint index_2);
246
247 /** Current position. */
249 /** Next position. */
251
253};
254
255/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY_LONG. */
257 public:
258 /** Table share */
261 static int delete_all_rows();
262 static ha_rows get_row_count();
263
264 int rnd_next() override;
265 int rnd_pos(const void *pos) override;
266 void reset_position(void) override;
267
268 protected:
270
271 public:
273
274 private:
275 /** Table share lock. */
277 /** Table definition. */
279
280 /** Current position. */
282 /** Next position. */
284};
285
286/** @} */
287#endif
Definition: field.h:574
Definition: pfs_engine_table.h:299
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:69
Definition: table_events_waits.h:131
bool match(PFS_thread *pfs)
Definition: table_events_waits.cc:46
PFS_index_events_waits()
Definition: table_events_waits.h:133
~PFS_index_events_waits() override=default
PFS_key_thread_id m_key_1
Definition: table_events_waits.h:144
PFS_key_event_id m_key_2
Definition: table_events_waits.h:145
Definition: table_helper.h:1266
Definition: table_helper.h:1250
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:39
Adapter, for table sharing the structure of PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT.
Definition: table_events_waits.h:152
int make_row(PFS_events_waits *wait)
Build a row.
Definition: table_events_waits.cc:563
int make_file_object_columns(PFS_events_waits *wait)
Definition: table_events_waits.cc:287
row_events_waits m_row
Current row.
Definition: table_events_waits.h:170
int make_table_object_columns(PFS_events_waits *wait)
Definition: table_events_waits.cc:222
table_events_waits_common(const PFS_engine_table_share *share, void *pos)
Definition: table_events_waits.cc:209
int make_metadata_lock_object_columns(PFS_events_waits *wait)
Definition: table_events_waits.cc:374
void clear_object_columns()
Definition: table_events_waits.cc:215
~table_events_waits_common() override=default
int make_socket_object_columns(PFS_events_waits *wait)
Definition: table_events_waits.cc:319
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_events_waits.cc:774
Table PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT.
Definition: table_events_waits.h:174
static int delete_all_rows()
Definition: table_events_waits.cc:1071
pos_events_waits_current m_pos
Current position.
Definition: table_events_waits.h:208
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_events_waits.cc:997
static PFS_engine_table_share m_share
Table share.
Definition: table_events_waits.h:177
PFS_events_waits * get_wait(PFS_thread *pfs_thread, uint index_2)
Definition: table_events_waits.cc:930
int make_row(PFS_thread *thread, PFS_events_waits *wait)
Definition: table_events_waits.cc:1053
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_events_waits.cc:918
void reset_position(void) override
Reset the cursor position to the beginning of the table.
Definition: table_events_waits.cc:925
int index_init(uint idx, bool sorted) override
Definition: table_events_waits.cc:1015
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_events_waits.cc:977
table_events_waits_current()
Definition: table_events_waits.cc:922
int index_next() override
Find key in index, read record.
Definition: table_events_waits.cc:1024
static ha_rows get_row_count()
Definition: table_events_waits.cc:1076
pos_events_waits_current m_next_pos
Next position.
Definition: table_events_waits.h:210
~table_events_waits_current() override=default
static THR_LOCK m_table_lock
Table share lock.
Definition: table_events_waits.h:200
static Plugin_table m_table_def
Table definition.
Definition: table_events_waits.h:202
PFS_index_events_waits * m_opened_index
Definition: table_events_waits.h:212
Table PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY_LONG.
Definition: table_events_waits.h:256
PFS_simple_index m_next_pos
Next position.
Definition: table_events_waits.h:283
static int delete_all_rows()
Definition: table_events_waits.cc:1298
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_events_waits.cc:1269
~table_events_waits_history_long() override=default
PFS_simple_index m_pos
Current position.
Definition: table_events_waits.h:281
table_events_waits_history_long()
Definition: table_events_waits.cc:1234
static ha_rows get_row_count()
Definition: table_events_waits.cc:1303
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_events_waits.cc:1242
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_events_waits.cc:1229
static THR_LOCK m_table_lock
Table share lock.
Definition: table_events_waits.h:276
static Plugin_table m_table_def
Table definition.
Definition: table_events_waits.h:278
static PFS_engine_table_share m_share
Table share.
Definition: table_events_waits.h:259
void reset_position(void) override
Reset the cursor position to the beginning of the table.
Definition: table_events_waits.cc:1237
Table PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY.
Definition: table_events_waits.h:216
table_events_waits_history()
Definition: table_events_waits.cc:1084
int make_row(PFS_thread *thread, PFS_events_waits *wait)
Definition: table_events_waits.cc:1201
void reset_position(void) override
Reset the cursor position to the beginning of the table.
Definition: table_events_waits.cc:1087
int index_next() override
Find key in index, read record.
Definition: table_events_waits.cc:1168
int index_init(uint idx, bool sorted) override
Definition: table_events_waits.cc:1159
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_events_waits.cc:1139
pos_events_waits_history m_next_pos
Next position.
Definition: table_events_waits.h:250
static PFS_engine_table_share m_share
Table share.
Definition: table_events_waits.h:219
PFS_events_waits * get_wait(PFS_thread *pfs_thread, uint index_2)
Definition: table_events_waits.cc:1092
PFS_index_events_waits * m_opened_index
Definition: table_events_waits.h:252
pos_events_waits_history m_pos
Current position.
Definition: table_events_waits.h:248
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_events_waits.cc:1115
~table_events_waits_history() override=default
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_events_waits.cc:1080
static THR_LOCK m_table_lock
Table share lock.
Definition: table_events_waits.h:240
static Plugin_table m_table_def
Table definition.
Definition: table_events_waits.h:242
static ha_rows get_row_count()
Definition: table_events_waits.cc:1224
static int delete_all_rows()
Definition: table_events_waits.cc:1219
char * pos
Definition: do_ctype.cc:76
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1139
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
intptr_t intptr
Definition: my_inttypes.h:69
Definition: buf0block_hint.cc:29
stdx::expected< size_t, std::error_code > wait(int epfd, epoll_event *fd_events, size_t num_fd_events, std::chrono::milliseconds timeout)
Definition: linux_epoll.h:82
Data types for columns used in the performance schema tables (declarations)
#define COL_SOURCE_SIZE
Size of the SOURCE columns, in bytes.
Definition: pfs_column_types.h:75
#define COL_INDEX_NAME_SIZE
Size of the INDEX_NAME columns, in bytes.
Definition: pfs_column_types.h:59
enum_event_type
Enum values for the NESTING_EVENT_TYPE columns.
Definition: pfs_column_types.h:270
#define COL_OBJECT_NAME_EXTENDED_SIZE
Size of the extended OBJECT_NAME columns, in bytes.
Definition: pfs_column_types.h:49
enum_operation_type
Enum values for the various OPERATION columns.
Definition: pfs_column_types.h:124
Performance schema tables (declarations).
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:65
Position of a double cursor, for iterations using 2 nested loops.
Definition: pfs_engine_table.h:593
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:595
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:597
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:357
A wait event record.
Definition: pfs_events_waits.h:68
Definition: pfs_name.h:115
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:558
Instrumented thread implementation.
Definition: pfs_instr.h:372
Definition: table.h:1396
Definition: thr_lock.h:138
Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT.
Definition: table_events_waits.h:102
pos_events_waits_current()
Definition: table_events_waits.h:103
void reset(void)
Definition: table_events_waits.h:105
void next_thread(void)
Definition: table_events_waits.h:110
Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY.
Definition: table_events_waits.h:117
pos_events_waits_history()
Definition: table_events_waits.h:118
void next_thread(void)
Definition: table_events_waits.h:125
void reset(void)
Definition: table_events_waits.h:120
A row of table_events_waits_common.
Definition: table_events_waits.h:52
uint m_flags
Column FLAGS.
Definition: table_events_waits.h:98
const char * m_name
Column EVENT_NAME.
Definition: table_events_waits.h:64
ulonglong m_end_event_id
Column END_EVENT_ID.
Definition: table_events_waits.h:58
const char * m_object_type
Column OBJECT_TYPE.
Definition: table_events_waits.h:74
ulonglong m_event_id
Column EVENT_ID.
Definition: table_events_waits.h:56
ulonglong m_number_of_bytes
Column NUMBER_OF_BYTES.
Definition: table_events_waits.h:96
char m_source[COL_SOURCE_SIZE]
Column SOURCE.
Definition: table_events_waits.h:90
ulonglong m_timer_end
Column TIMER_END.
Definition: table_events_waits.h:70
enum_operation_type m_operation
Column OPERATION.
Definition: table_events_waits.h:94
ulonglong m_thread_internal_id
Column THREAD_ID.
Definition: table_events_waits.h:54
PFS_schema_name m_object_schema
Column OBJECT_SCHEMA.
Definition: table_events_waits.h:78
ulonglong m_nesting_event_id
Column NESTING_EVENT_ID.
Definition: table_events_waits.h:60
uint m_object_type_length
Length in bytes of m_object_type.
Definition: table_events_waits.h:76
uint m_source_length
Length in bytes of m_source.
Definition: table_events_waits.h:92
ulonglong m_timer_start
Column TIMER_START.
Definition: table_events_waits.h:68
uint m_object_name_length
Length in bytes of m_object_name.
Definition: table_events_waits.h:82
char m_object_name[COL_OBJECT_NAME_EXTENDED_SIZE]
Column OBJECT_NAME.
Definition: table_events_waits.h:80
enum_event_type m_nesting_event_type
Column NESTING_EVENT_TYPE.
Definition: table_events_waits.h:62
char m_index_name[COL_INDEX_NAME_SIZE]
Column INDEX_NAME.
Definition: table_events_waits.h:84
intptr m_object_instance_addr
Column OBJECT_INSTANCE_BEGIN.
Definition: table_events_waits.h:88
uint m_name_length
Length in bytes of m_name.
Definition: table_events_waits.h:66
uint m_index_name_length
Length in bytes of m_index_name.
Definition: table_events_waits.h:86
ulonglong m_timer_wait
Column TIMER_WAIT.
Definition: table_events_waits.h:72
Helpers to implement a performance schema table.
unsigned int uint
Definition: uca-dump.cc:29