MySQL 8.0.29
Source Code Documentation
table_events_stages.h
Go to the documentation of this file.
1/* Copyright (c) 2010, 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_STAGES_H
24#define TABLE_EVENTS_STAGES_H
25
26/**
27 @file storage/perfschema/table_events_stages.h
28 Table EVENTS_STAGES_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;
42struct PFS_thread;
43struct TABLE;
44struct THR_LOCK;
45
46/**
47 @addtogroup performance_schema_tables
48 @{
49*/
50
52 public:
55 m_key_1("THREAD_ID"),
56 m_key_2("EVENT_ID") {}
57
58 ~PFS_index_events_stages() override = default;
59
60 bool match(PFS_thread *pfs);
62
63 private:
66};
67
68/** A row of table_events_stages_common. */
70 /** Column THREAD_ID. */
72 /** Column EVENT_ID. */
74 /** Column END_EVENT_ID. */
76 /** Column NESTING_EVENT_ID. */
78 /** Column NESTING_EVENT_TYPE. */
80 /** Column EVENT_NAME. */
81 const char *m_name;
82 /** Length in bytes of @c m_name. */
84 /** Column TIMER_START. */
86 /** Column TIMER_END. */
88 /** Column TIMER_WAIT. */
90 /** Column SOURCE. */
92 /** Length in bytes of @c m_source. */
95 /** Column WORK_COMPLETED. */
97 /** Column WORK_ESTIMATED. */
99};
100
101/** Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY. */
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/**
117 Adapter, for table sharing the structure of
118 PERFORMANCE_SCHEMA.EVENTS_STAGES_CURRENT.
119*/
121 protected:
122 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
123 bool read_all) override;
124
126
127 ~table_events_stages_common() override = default;
128
129 int make_row(PFS_events_stages *stage);
130
131 /** Current row. */
133};
134
135/** Table PERFORMANCE_SCHEMA.EVENTS_STAGES_CURRENT. */
137 public:
138 /** Table share */
141 static int delete_all_rows();
142 static ha_rows get_row_count();
143
144 void reset_position(void) override;
145
146 int rnd_init(bool scan) override;
147 int rnd_next() override;
148 int rnd_pos(const void *pos) override;
149
150 int index_init(uint idx, bool sorted) override;
151 int index_next() override;
152
153 protected:
155
156 public:
157 ~table_events_stages_current() override = default;
158
159 private:
162
163 /** Table share lock. */
165 /** Table definition. */
167
168 /** Current position. */
170 /** Next position. */
172
174};
175
176/** Table PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY. */
178 public:
179 /** Table share */
182 static int delete_all_rows();
183 static ha_rows get_row_count();
184
185 void reset_position(void) override;
186
187 int rnd_init(bool scan) override;
188 int rnd_next() override;
189 int rnd_pos(const void *pos) override;
190
191 int index_init(uint idx, bool sorted) override;
192 int index_next() override;
193
194 protected:
196
197 public:
198 ~table_events_stages_history() override = default;
199
200 private:
201 /** Table share lock. */
203 /** Table definition. */
205
206 /** Current position. */
208 /** Next position. */
210
212};
213
214/** Table PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY_LONG. */
216 public:
217 /** Table share */
220 static int delete_all_rows();
221 static ha_rows get_row_count();
222
223 int rnd_init(bool scan) override;
224 int rnd_next() override;
225 int rnd_pos(const void *pos) override;
226 void reset_position(void) override;
227
228 protected:
230
231 public:
233
234 private:
235 /** Table share lock. */
237 /** Table definition. */
239
240 /** Current position. */
242 /** Next position. */
244};
245
246/** @} */
247#endif
Definition: field.h:573
Definition: pfs_engine_table.h:299
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:69
Definition: table_events_stages.h:51
PFS_key_event_id m_key_2
Definition: table_events_stages.h:65
PFS_index_events_stages()
Definition: table_events_stages.h:53
~PFS_index_events_stages() override=default
bool match(PFS_thread *pfs)
Definition: table_events_stages.cc:167
PFS_key_thread_id m_key_1
Definition: table_events_stages.h:64
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_STAGES_CURRENT.
Definition: table_events_stages.h:120
int make_row(PFS_events_stages *stage)
Build a row.
Definition: table_events_stages.cc:198
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:239
table_events_stages_common(const PFS_engine_table_share *share, void *pos)
Definition: table_events_stages.cc:187
~table_events_stages_common() override=default
row_events_stages m_row
Current row.
Definition: table_events_stages.h:132
Table PERFORMANCE_SCHEMA.EVENTS_STAGES_CURRENT.
Definition: table_events_stages.h:136
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_events_stages.cc:360
int index_next() override
Find key in index, read record.
Definition: table_events_stages.cc:384
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_events_stages.cc:342
PFS_simple_index m_next_pos
Next position.
Definition: table_events_stages.h:171
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_events_stages.cc:329
static THR_LOCK m_table_lock
Table share lock.
Definition: table_events_stages.h:164
static PFS_engine_table_share m_share
Table share.
Definition: table_events_stages.h:139
static ha_rows get_row_count()
Definition: table_events_stages.cc:414
table_events_stages_current()
Definition: table_events_stages.cc:334
PFS_simple_index m_pos
Current position.
Definition: table_events_stages.h:169
void reset_position(void) override
Reset the cursor position to the beginning of the table.
Definition: table_events_stages.cc:337
static Plugin_table m_table_def
Table definition.
Definition: table_events_stages.h:166
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_events_stages.cc:344
~table_events_stages_current() override=default
int index_init(uint idx, bool sorted) override
Definition: table_events_stages.cc:375
PFS_index_events_stages * m_opened_index
Definition: table_events_stages.h:173
static int delete_all_rows()
Definition: table_events_stages.cc:409
Table PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY_LONG.
Definition: table_events_stages.h:215
static ha_rows get_row_count()
Definition: table_events_stages.cc:632
void reset_position(void) override
Reset the cursor position to the beginning of the table.
Definition: table_events_stages.cc:564
static PFS_engine_table_share m_share
Table share.
Definition: table_events_stages.h:218
~table_events_stages_history_long() override=default
static Plugin_table m_table_def
Table definition.
Definition: table_events_stages.h:238
static int delete_all_rows()
Definition: table_events_stages.cc:627
PFS_simple_index m_next_pos
Next position.
Definition: table_events_stages.h:243
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_events_stages.cc:569
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_events_stages.cc:571
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_events_stages.cc:598
table_events_stages_history_long()
Definition: table_events_stages.cc:561
PFS_simple_index m_pos
Current position.
Definition: table_events_stages.h:241
static THR_LOCK m_table_lock
Table share lock.
Definition: table_events_stages.h:236
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_events_stages.cc:556
Table PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY.
Definition: table_events_stages.h:177
table_events_stages_history()
Definition: table_events_stages.cc:423
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_events_stages.cc:469
void reset_position(void) override
Reset the cursor position to the beginning of the table.
Definition: table_events_stages.cc:426
static ha_rows get_row_count()
Definition: table_events_stages.cc:551
int index_next() override
Find key in index, read record.
Definition: table_events_stages.cc:504
static Plugin_table m_table_def
Table definition.
Definition: table_events_stages.h:204
pos_events_stages_history m_next_pos
Next position.
Definition: table_events_stages.h:209
~table_events_stages_history() override=default
static int delete_all_rows()
Definition: table_events_stages.cc:546
PFS_index_events_stages * m_opened_index
Definition: table_events_stages.h:211
pos_events_stages_history m_pos
Current position.
Definition: table_events_stages.h:207
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_events_stages.cc:431
static THR_LOCK m_table_lock
Table share lock.
Definition: table_events_stages.h:202
static PFS_engine_table_share m_share
Table share.
Definition: table_events_stages.h:180
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_events_stages.cc:418
int index_init(uint idx, bool sorted) override
Definition: table_events_stages.cc:495
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_events_stages.cc:433
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
Definition: buf0block_hint.cc:29
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
enum_event_type
Enum values for the NESTING_EVENT_TYPE columns.
Definition: pfs_column_types.h:269
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 stage record.
Definition: pfs_events_stages.h:44
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:558
Instrumented thread implementation.
Definition: pfs_instr.h:372
Definition: table.h:1394
Definition: thr_lock.h:138
Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_STAGES_HISTORY.
Definition: table_events_stages.h:102
pos_events_stages_history()
Definition: table_events_stages.h:103
void reset(void)
Definition: table_events_stages.h:105
void next_thread(void)
Definition: table_events_stages.h:110
A row of table_events_stages_common.
Definition: table_events_stages.h:69
enum_event_type m_nesting_event_type
Column NESTING_EVENT_TYPE.
Definition: table_events_stages.h:79
char m_source[COL_SOURCE_SIZE]
Column SOURCE.
Definition: table_events_stages.h:91
ulonglong m_event_id
Column EVENT_ID.
Definition: table_events_stages.h:73
ulonglong m_end_event_id
Column END_EVENT_ID.
Definition: table_events_stages.h:75
uint m_source_length
Length in bytes of m_source.
Definition: table_events_stages.h:93
bool m_progress
Definition: table_events_stages.h:94
ulonglong m_nesting_event_id
Column NESTING_EVENT_ID.
Definition: table_events_stages.h:77
ulonglong m_timer_wait
Column TIMER_WAIT.
Definition: table_events_stages.h:89
ulonglong m_work_completed
Column WORK_COMPLETED.
Definition: table_events_stages.h:96
uint m_name_length
Length in bytes of m_name.
Definition: table_events_stages.h:83
const char * m_name
Column EVENT_NAME.
Definition: table_events_stages.h:81
ulonglong m_timer_start
Column TIMER_START.
Definition: table_events_stages.h:85
ulonglong m_timer_end
Column TIMER_END.
Definition: table_events_stages.h:87
ulonglong m_thread_internal_id
Column THREAD_ID.
Definition: table_events_stages.h:71
ulonglong m_work_estimated
Column WORK_ESTIMATED.
Definition: table_events_stages.h:98
Helpers to implement a performance schema table.
unsigned int uint
Definition: uca-dump.cc:29