MySQL 9.0.0
Source Code Documentation
table_events_stages.h
Go to the documentation of this file.
1/* Copyright (c) 2010, 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_STAGES_H
25#define TABLE_EVENTS_STAGES_H
26
27/**
28 @file storage/perfschema/table_events_stages.h
29 Table EVENTS_STAGES_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;
43struct PFS_thread;
44struct TABLE;
45struct THR_LOCK;
46
47/**
48 @addtogroup performance_schema_tables
49 @{
50*/
51
53 public:
56 m_key_1("THREAD_ID"),
57 m_key_2("EVENT_ID") {}
58
59 ~PFS_index_events_stages() override = default;
60
61 bool match(PFS_thread *pfs);
63
64 private:
67};
68
69/** A row of table_events_stages_common. */
71 /** Column THREAD_ID. */
73 /** Column EVENT_ID. */
75 /** Column END_EVENT_ID. */
77 /** Column NESTING_EVENT_ID. */
79 /** Column NESTING_EVENT_TYPE. */
81 /** Column EVENT_NAME. */
82 const char *m_name;
83 /** Length in bytes of @c m_name. */
85 /** Column TIMER_START. */
87 /** Column TIMER_END. */
89 /** Column TIMER_WAIT. */
91 /** Column SOURCE. */
93 /** Length in bytes of @c m_source. */
96 /** Column WORK_COMPLETED. */
98 /** Column WORK_ESTIMATED. */
100};
101
102/** Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY. */
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/**
118 Adapter, for table sharing the structure of
119 PERFORMANCE_SCHEMA.EVENTS_STAGES_CURRENT.
120*/
122 protected:
123 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
124 bool read_all) override;
125
126 table_events_stages_common(const PFS_engine_table_share *share, void *pos);
127
128 ~table_events_stages_common() override = default;
129
130 int make_row(PFS_events_stages *stage);
131
132 /** Current row. */
134};
135
136/** Table PERFORMANCE_SCHEMA.EVENTS_STAGES_CURRENT. */
138 public:
139 /** Table share */
142 static int delete_all_rows();
143 static ha_rows get_row_count();
144
145 void reset_position() override;
146
147 int rnd_init(bool scan) override;
148 int rnd_next() override;
149 int rnd_pos(const void *pos) override;
150
151 int index_init(uint idx, bool sorted) override;
152 int index_next() override;
153
154 protected:
156
157 public:
158 ~table_events_stages_current() override = default;
159
160 private:
163
164 /** Table share lock. */
166 /** Table definition. */
168
169 /** Current position. */
171 /** Next position. */
173
175};
176
177/** Table PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY. */
179 public:
180 /** Table share */
183 static int delete_all_rows();
184 static ha_rows get_row_count();
185
186 void reset_position() override;
187
188 int rnd_init(bool scan) override;
189 int rnd_next() override;
190 int rnd_pos(const void *pos) override;
191
192 int index_init(uint idx, bool sorted) override;
193 int index_next() override;
194
195 protected:
197
198 public:
199 ~table_events_stages_history() override = default;
200
201 private:
202 /** Table share lock. */
204 /** Table definition. */
206
207 /** Current position. */
209 /** Next position. */
211
213};
214
215/** Table PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY_LONG. */
217 public:
218 /** Table share */
221 static int delete_all_rows();
222 static ha_rows get_row_count();
223
224 int rnd_init(bool scan) override;
225 int rnd_next() override;
226 int rnd_pos(const void *pos) override;
227 void reset_position() override;
228
229 protected:
231
232 public:
234
235 private:
236 /** Table share lock. */
238 /** Table definition. */
240
241 /** Current position. */
243 /** Next position. */
245};
246
247/** @} */
248#endif
Definition: field.h:577
Definition: pfs_engine_table.h:300
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_events_stages.h:52
PFS_key_event_id m_key_2
Definition: table_events_stages.h:66
PFS_index_events_stages()
Definition: table_events_stages.h:54
~PFS_index_events_stages() override=default
bool match(PFS_thread *pfs)
Definition: table_events_stages.cc:168
PFS_key_thread_id m_key_1
Definition: table_events_stages.h:65
Definition: table_helper.h:1295
Definition: table_helper.h:1279
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_STAGES_CURRENT.
Definition: table_events_stages.h:121
int make_row(PFS_events_stages *stage)
Build a row.
Definition: table_events_stages.cc:199
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_events_stages.cc:240
table_events_stages_common(const PFS_engine_table_share *share, void *pos)
Definition: table_events_stages.cc:188
~table_events_stages_common() override=default
row_events_stages m_row
Current row.
Definition: table_events_stages.h:133
Table PERFORMANCE_SCHEMA.EVENTS_STAGES_CURRENT.
Definition: table_events_stages.h:137
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_events_stages.cc:362
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_events_stages.cc:341
int index_next() override
Find key in index, read record.
Definition: table_events_stages.cc:383
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_events_stages.cc:346
PFS_simple_index m_next_pos
Next position.
Definition: table_events_stages.h:172
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_events_stages.cc:330
static THR_LOCK m_table_lock
Table share lock.
Definition: table_events_stages.h:165
static PFS_engine_table_share m_share
Table share.
Definition: table_events_stages.h:140
static ha_rows get_row_count()
Definition: table_events_stages.cc:413
table_events_stages_current()
Definition: table_events_stages.cc:335
PFS_simple_index m_pos
Current position.
Definition: table_events_stages.h:170
static Plugin_table m_table_def
Table definition.
Definition: table_events_stages.h:167
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_events_stages.cc:348
~table_events_stages_current() override=default
int index_init(uint idx, bool sorted) override
Definition: table_events_stages.cc:374
PFS_index_events_stages * m_opened_index
Definition: table_events_stages.h:174
static int delete_all_rows()
Definition: table_events_stages.cc:408
Table PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY_LONG.
Definition: table_events_stages.h:216
static ha_rows get_row_count()
Definition: table_events_stages.cc:628
static PFS_engine_table_share m_share
Table share.
Definition: table_events_stages.h:219
~table_events_stages_history_long() override=default
static Plugin_table m_table_def
Table definition.
Definition: table_events_stages.h:239
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_events_stages.cc:560
static int delete_all_rows()
Definition: table_events_stages.cc:623
PFS_simple_index m_next_pos
Next position.
Definition: table_events_stages.h:244
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_events_stages.cc:565
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_events_stages.cc:567
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_events_stages.cc:594
table_events_stages_history_long()
Definition: table_events_stages.cc:557
PFS_simple_index m_pos
Current position.
Definition: table_events_stages.h:242
static THR_LOCK m_table_lock
Table share lock.
Definition: table_events_stages.h:237
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_events_stages.cc:552
Table PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY.
Definition: table_events_stages.h:178
table_events_stages_history()
Definition: table_events_stages.cc:422
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_events_stages.cc:468
static ha_rows get_row_count()
Definition: table_events_stages.cc:547
int index_next() override
Find key in index, read record.
Definition: table_events_stages.cc:500
static Plugin_table m_table_def
Table definition.
Definition: table_events_stages.h:205
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_events_stages.cc:425
pos_events_stages_history m_next_pos
Next position.
Definition: table_events_stages.h:210
~table_events_stages_history() override=default
static int delete_all_rows()
Definition: table_events_stages.cc:542
PFS_index_events_stages * m_opened_index
Definition: table_events_stages.h:212
pos_events_stages_history m_pos
Current position.
Definition: table_events_stages.h:208
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_events_stages.cc:430
static THR_LOCK m_table_lock
Table share lock.
Definition: table_events_stages.h:203
static PFS_engine_table_share m_share
Table share.
Definition: table_events_stages.h:181
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_events_stages.cc:417
int index_init(uint idx, bool sorted) override
Definition: table_events_stages.cc:491
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_events_stages.cc:432
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1141
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
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
enum_event_type
Enum values for the NESTING_EVENT_TYPE columns.
Definition: pfs_column_types.h:275
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:601
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:603
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:605
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:358
A stage record.
Definition: pfs_events_stages.h:45
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:566
Instrumented thread implementation.
Definition: pfs_instr.h:375
Definition: table.h:1407
Definition: thr_lock.h:139
Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY.
Definition: table_events_stages.h:103
pos_events_stages_history()
Definition: table_events_stages.h:104
void next_thread()
Definition: table_events_stages.h:111
void reset()
Definition: table_events_stages.h:106
A row of table_events_stages_common.
Definition: table_events_stages.h:70
enum_event_type m_nesting_event_type
Column NESTING_EVENT_TYPE.
Definition: table_events_stages.h:80
char m_source[COL_SOURCE_SIZE]
Column SOURCE.
Definition: table_events_stages.h:92
ulonglong m_event_id
Column EVENT_ID.
Definition: table_events_stages.h:74
ulonglong m_end_event_id
Column END_EVENT_ID.
Definition: table_events_stages.h:76
uint m_source_length
Length in bytes of m_source.
Definition: table_events_stages.h:94
bool m_progress
Definition: table_events_stages.h:95
ulonglong m_nesting_event_id
Column NESTING_EVENT_ID.
Definition: table_events_stages.h:78
ulonglong m_timer_wait
Column TIMER_WAIT.
Definition: table_events_stages.h:90
ulonglong m_work_completed
Column WORK_COMPLETED.
Definition: table_events_stages.h:97
uint m_name_length
Length in bytes of m_name.
Definition: table_events_stages.h:84
const char * m_name
Column EVENT_NAME.
Definition: table_events_stages.h:82
ulonglong m_timer_start
Column TIMER_START.
Definition: table_events_stages.h:86
ulonglong m_timer_end
Column TIMER_END.
Definition: table_events_stages.h:88
ulonglong m_thread_internal_id
Column THREAD_ID.
Definition: table_events_stages.h:72
ulonglong m_work_estimated
Column WORK_ESTIMATED.
Definition: table_events_stages.h:99
Helpers to implement a performance schema table.