MySQL 8.0.40
Source Code Documentation
table_events_waits.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef TABLE_EVENTS_WAITS_H
25#define TABLE_EVENTS_WAITS_H
26
27/**
28 @file storage/perfschema/table_events_waits.h
29 Table EVENTS_WAITS_xxx (declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_base.h"
35#include "my_inttypes.h"
39
40class Field;
41class Plugin_table;
42struct PFS_events_waits;
43struct PFS_thread;
44struct TABLE;
45struct THR_LOCK;
46
47/**
48 @addtogroup performance_schema_tables
49 @{
50*/
51
52/** A row of table_events_waits_common. */
54 /** Column THREAD_ID. */
56 /** Column EVENT_ID. */
58 /** Column END_EVENT_ID. */
60 /** Column NESTING_EVENT_ID. */
62 /** Column NESTING_EVENT_TYPE. */
64 /** Column EVENT_NAME. */
65 const char *m_name;
66 /** Length in bytes of @c m_name. */
68 /** Column TIMER_START. */
70 /** Column TIMER_END. */
72 /** Column TIMER_WAIT. */
74 /** Column OBJECT_TYPE. */
75 const char *m_object_type;
76 /** Length in bytes of @c m_object_type. */
78 /** Column OBJECT_SCHEMA. */
80 /** Column OBJECT_NAME. */
82 /** Length in bytes of @c m_object_name. */
84 /** Column INDEX_NAME. */
86 /** Length in bytes of @c m_index_name. */
88 /** Column OBJECT_INSTANCE_BEGIN. */
90 /** Column SOURCE. */
92 /** Length in bytes of @c m_source. */
94 /** Column OPERATION. */
96 /** Column NUMBER_OF_BYTES. */
98 /** Column FLAGS. */
100};
101
102/** Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. */
105
106 inline void reset() {
107 m_index_1 = 0;
108 m_index_2 = 0;
109 }
110
111 inline void next_thread() {
112 m_index_1++;
113 m_index_2 = 0;
114 }
115};
116
117/** Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY. */
120
121 inline void reset() {
122 m_index_1 = 0;
123 m_index_2 = 0;
124 }
125
126 inline void next_thread() {
127 m_index_1++;
128 m_index_2 = 0;
129 }
130};
131
133 public:
136 m_key_1("THREAD_ID"),
137 m_key_2("EVENT_ID") {}
138
139 ~PFS_index_events_waits() override = default;
140
141 bool match(PFS_thread *pfs);
143
144 private:
147};
148
149/**
150 Adapter, for table sharing the structure of
151 PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT.
152*/
154 protected:
155 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
156 bool read_all) override;
157
158 table_events_waits_common(const PFS_engine_table_share *share, void *pos);
159
160 ~table_events_waits_common() override = default;
161
167
169
170 /** Current row. */
172};
173
174/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. */
176 public:
177 /** Table share */
180 static int delete_all_rows();
181 static ha_rows get_row_count();
182
183 int index_init(uint idx, bool sorted) override;
184
185 int rnd_next() override;
186 int rnd_pos(const void *pos) override;
187 int index_next() override;
188 void reset_position() override;
189
190 protected:
192
193 public:
194 ~table_events_waits_current() override = default;
195
196 private:
199
200 /** Table share lock. */
202 /** Table definition. */
204
205 PFS_events_waits *get_wait(PFS_thread *pfs_thread, uint index_2);
207
208 /** Current position. */
210 /** Next position. */
212
214};
215
216/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY. */
218 public:
219 /** Table share */
222 static int delete_all_rows();
223 static ha_rows get_row_count();
224
225 void reset_position() override;
226
227 int index_init(uint idx, bool sorted) override;
228 int index_next() override;
229
230 int rnd_next() override;
231 int rnd_pos(const void *pos) override;
232
233 protected:
235
236 public:
237 ~table_events_waits_history() override = default;
238
239 private:
240 /** Table share lock. */
242 /** Table definition. */
244
245 PFS_events_waits *get_wait(PFS_thread *pfs_thread, uint index_2);
247
248 /** Current position. */
250 /** Next position. */
252
254};
255
256/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY_LONG. */
258 public:
259 /** Table share */
262 static int delete_all_rows();
263 static ha_rows get_row_count();
264
265 int rnd_next() override;
266 int rnd_pos(const void *pos) override;
267 void reset_position() override;
268
269 protected:
271
272 public:
274
275 private:
276 /** Table share lock. */
278 /** Table definition. */
280
281 /** Current position. */
283 /** Next position. */
285};
286
287/** @} */
288#endif
Definition: field.h:575
Definition: pfs_engine_table.h:301
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_events_waits.h:132
bool match(PFS_thread *pfs)
Definition: table_events_waits.cc:47
PFS_index_events_waits()
Definition: table_events_waits.h:134
~PFS_index_events_waits() override=default
PFS_key_thread_id m_key_1
Definition: table_events_waits.h:145
PFS_key_event_id m_key_2
Definition: table_events_waits.h:146
Definition: table_helper.h:1294
Definition: table_helper.h:1278
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
Adapter, for table sharing the structure of PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT.
Definition: table_events_waits.h:153
int make_row(PFS_events_waits *wait)
Build a row.
Definition: table_events_waits.cc:559
int make_file_object_columns(PFS_events_waits *wait)
Definition: table_events_waits.cc:289
row_events_waits m_row
Current row.
Definition: table_events_waits.h:171
int make_table_object_columns(PFS_events_waits *wait)
Definition: table_events_waits.cc:223
table_events_waits_common(const PFS_engine_table_share *share, void *pos)
Definition: table_events_waits.cc:210
int make_metadata_lock_object_columns(PFS_events_waits *wait)
Definition: table_events_waits.cc:377
void clear_object_columns()
Definition: table_events_waits.cc:216
~table_events_waits_common() override=default
int make_socket_object_columns(PFS_events_waits *wait)
Definition: table_events_waits.cc:321
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:770
Table PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT.
Definition: table_events_waits.h:175
static int delete_all_rows()
Definition: table_events_waits.cc:1067
pos_events_waits_current m_pos
Current position.
Definition: table_events_waits.h:209
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_events_waits.cc:993
static PFS_engine_table_share m_share
Table share.
Definition: table_events_waits.h:178
PFS_events_waits * get_wait(PFS_thread *pfs_thread, uint index_2)
Definition: table_events_waits.cc:926
int make_row(PFS_thread *thread, PFS_events_waits *wait)
Definition: table_events_waits.cc:1049
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_events_waits.cc:914
int index_init(uint idx, bool sorted) override
Definition: table_events_waits.cc:1011
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_events_waits.cc:973
table_events_waits_current()
Definition: table_events_waits.cc:918
int index_next() override
Find key in index, read record.
Definition: table_events_waits.cc:1020
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_events_waits.cc:921
static ha_rows get_row_count()
Definition: table_events_waits.cc:1072
pos_events_waits_current m_next_pos
Next position.
Definition: table_events_waits.h:211
~table_events_waits_current() override=default
static THR_LOCK m_table_lock
Table share lock.
Definition: table_events_waits.h:201
static Plugin_table m_table_def
Table definition.
Definition: table_events_waits.h:203
PFS_index_events_waits * m_opened_index
Definition: table_events_waits.h:213
Table PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY_LONG.
Definition: table_events_waits.h:257
PFS_simple_index m_next_pos
Next position.
Definition: table_events_waits.h:284
static int delete_all_rows()
Definition: table_events_waits.cc:1294
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_events_waits.cc:1265
~table_events_waits_history_long() override=default
PFS_simple_index m_pos
Current position.
Definition: table_events_waits.h:282
table_events_waits_history_long()
Definition: table_events_waits.cc:1230
static ha_rows get_row_count()
Definition: table_events_waits.cc:1299
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_events_waits.cc:1238
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_events_waits.cc:1233
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_events_waits.cc:1225
static THR_LOCK m_table_lock
Table share lock.
Definition: table_events_waits.h:277
static Plugin_table m_table_def
Table definition.
Definition: table_events_waits.h:279
static PFS_engine_table_share m_share
Table share.
Definition: table_events_waits.h:260
Table PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY.
Definition: table_events_waits.h:217
table_events_waits_history()
Definition: table_events_waits.cc:1080
int make_row(PFS_thread *thread, PFS_events_waits *wait)
Definition: table_events_waits.cc:1197
int index_next() override
Find key in index, read record.
Definition: table_events_waits.cc:1164
int index_init(uint idx, bool sorted) override
Definition: table_events_waits.cc:1155
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_events_waits.cc:1135
pos_events_waits_history m_next_pos
Next position.
Definition: table_events_waits.h:251
static PFS_engine_table_share m_share
Table share.
Definition: table_events_waits.h:220
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_events_waits.cc:1083
PFS_events_waits * get_wait(PFS_thread *pfs_thread, uint index_2)
Definition: table_events_waits.cc:1088
PFS_index_events_waits * m_opened_index
Definition: table_events_waits.h:253
pos_events_waits_history m_pos
Current position.
Definition: table_events_waits.h:249
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_events_waits.cc:1111
~table_events_waits_history() override=default
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_events_waits.cc:1076
static THR_LOCK m_table_lock
Table share lock.
Definition: table_events_waits.h:241
static Plugin_table m_table_def
Table definition.
Definition: table_events_waits.h:243
static ha_rows get_row_count()
Definition: table_events_waits.cc:1220
static int delete_all_rows()
Definition: table_events_waits.cc:1215
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1140
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
intptr_t intptr
Definition: my_inttypes.h:70
Definition: buf0block_hint.cc:30
static int wait(mysql_cond_t *that, mysql_mutex_t *mutex_arg, const char *, unsigned int)
Definition: mysql_cond_v1_native.cc:63
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:76
#define COL_INDEX_NAME_SIZE
Size of the INDEX_NAME columns, in bytes.
Definition: pfs_column_types.h:60
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:50
enum_operation_type
Enum values for the various OPERATION columns.
Definition: pfs_column_types.h:125
Performance schema tables (declarations).
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:66
Position of a double cursor, for iterations using 2 nested loops.
Definition: pfs_engine_table.h:602
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:604
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:606
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:359
A wait event record.
Definition: pfs_events_waits.h:69
Definition: pfs_name.h:186
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:567
Instrumented thread implementation.
Definition: pfs_instr.h:373
Definition: table.h:1399
Definition: thr_lock.h:139
Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT.
Definition: table_events_waits.h:103
pos_events_waits_current()
Definition: table_events_waits.h:104
void next_thread()
Definition: table_events_waits.h:111
void reset()
Definition: table_events_waits.h:106
Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY.
Definition: table_events_waits.h:118
pos_events_waits_history()
Definition: table_events_waits.h:119
void reset()
Definition: table_events_waits.h:121
void next_thread()
Definition: table_events_waits.h:126
A row of table_events_waits_common.
Definition: table_events_waits.h:53
uint m_flags
Column FLAGS.
Definition: table_events_waits.h:99
const char * m_name
Column EVENT_NAME.
Definition: table_events_waits.h:65
ulonglong m_end_event_id
Column END_EVENT_ID.
Definition: table_events_waits.h:59
const char * m_object_type
Column OBJECT_TYPE.
Definition: table_events_waits.h:75
ulonglong m_event_id
Column EVENT_ID.
Definition: table_events_waits.h:57
ulonglong m_number_of_bytes
Column NUMBER_OF_BYTES.
Definition: table_events_waits.h:97
char m_source[COL_SOURCE_SIZE]
Column SOURCE.
Definition: table_events_waits.h:91
ulonglong m_timer_end
Column TIMER_END.
Definition: table_events_waits.h:71
enum_operation_type m_operation
Column OPERATION.
Definition: table_events_waits.h:95
ulonglong m_thread_internal_id
Column THREAD_ID.
Definition: table_events_waits.h:55
PFS_schema_name m_object_schema
Column OBJECT_SCHEMA.
Definition: table_events_waits.h:79
ulonglong m_nesting_event_id
Column NESTING_EVENT_ID.
Definition: table_events_waits.h:61
uint m_object_type_length
Length in bytes of m_object_type.
Definition: table_events_waits.h:77
uint m_source_length
Length in bytes of m_source.
Definition: table_events_waits.h:93
ulonglong m_timer_start
Column TIMER_START.
Definition: table_events_waits.h:69
uint m_object_name_length
Length in bytes of m_object_name.
Definition: table_events_waits.h:83
char m_object_name[COL_OBJECT_NAME_EXTENDED_SIZE]
Column OBJECT_NAME.
Definition: table_events_waits.h:81
enum_event_type m_nesting_event_type
Column NESTING_EVENT_TYPE.
Definition: table_events_waits.h:63
char m_index_name[COL_INDEX_NAME_SIZE]
Column INDEX_NAME.
Definition: table_events_waits.h:85
intptr m_object_instance_addr
Column OBJECT_INSTANCE_BEGIN.
Definition: table_events_waits.h:89
uint m_name_length
Length in bytes of m_name.
Definition: table_events_waits.h:67
uint m_index_name_length
Length in bytes of m_index_name.
Definition: table_events_waits.h:87
ulonglong m_timer_wait
Column TIMER_WAIT.
Definition: table_events_waits.h:73
Helpers to implement a performance schema table.
unsigned int uint
Definition: uca9-dump.cc:75