MySQL 9.0.0
Source Code Documentation
table_setup_instruments.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_SETUP_INSTRUMENTS_H
25#define TABLE_SETUP_INSTRUMENTS_H
26
27/**
28 @file storage/perfschema/table_setup_instruments.h
29 Table SETUP_INSTRUMENTS (declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_base.h"
37
38class Field;
39class Plugin_table;
40struct PFS_instr_class;
41struct TABLE;
42struct THR_LOCK;
43
44/**
45 @addtogroup performance_schema_tables
46 @{
47*/
48
49/** A row of PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS. */
51 /** Columns NAME, ENABLED, TIMED. */
53 /** True if column ENABLED can be updated. */
55 /** True if column TIMED can be updated. */
57 /** True if column FLAGS can be updated. */
59};
60
61/** Position of a cursor on PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS. */
65
66 inline void reset() {
68 m_index_2 = 1;
69 }
70
71 inline bool has_more_view() { return (m_index_1 <= LAST_INSTRUMENT); }
72
73 inline void next_view() {
74 m_index_1++;
75 m_index_2 = 1;
76 }
77};
78
80 public:
82
83 ~PFS_index_setup_instruments() override = default;
84
85 bool match_view(uint view);
86 bool match(PFS_instr_class *klass);
87
88 private:
90};
91
92/** Table PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS. */
94 public:
95 /** Table share. */
98 static ha_rows get_row_count();
99
100 void reset_position() override;
101
102 int rnd_next() override;
103 int rnd_pos(const void *pos) override;
104
105 int index_init(uint idx, bool sorted) override;
106 int index_next() override;
107
108 protected:
109 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
110 bool read_all) override;
111
112 int update_row_values(TABLE *table, const unsigned char *old_buf,
113 unsigned char *new_buf, Field **fields) override;
114
116
117 public:
118 ~table_setup_instruments() override = default;
119
120 private:
121 int make_row(PFS_instr_class *klass, bool update_enabled);
122
123 /** Table share lock. */
125 /** Table definition. */
127
128 /** Current row. */
130 /** Current position. */
132 /** Next position. */
134
136};
137
138/** @} */
139#endif
Definition: field.h:577
Definition: pfs_engine_table.h:300
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_setup_instruments.h:79
bool match_view(uint view)
Definition: table_setup_instruments.cc:83
PFS_index_setup_instruments()
Definition: table_setup_instruments.h:81
~PFS_index_setup_instruments() override=default
bool match(PFS_instr_class *klass)
Definition: table_setup_instruments.cc:90
PFS_key_event_name m_key
Definition: table_setup_instruments.h:89
Definition: table_helper.h:1461
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
Table PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS.
Definition: table_setup_instruments.h:93
row_setup_instruments m_row
Current row.
Definition: table_setup_instruments.h:129
pos_setup_instruments m_next_pos
Next position.
Definition: table_setup_instruments.h:133
~table_setup_instruments() override=default
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_setup_instruments.cc:365
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_setup_instruments.cc:115
static THR_LOCK m_table_lock
Table share lock.
Definition: table_setup_instruments.h:124
table_setup_instruments()
Definition: table_setup_instruments.cc:107
int index_next() override
Find key in index, read record.
Definition: table_setup_instruments.cc:271
static Plugin_table m_table_def
Table definition.
Definition: table_setup_instruments.h:126
int make_row(PFS_instr_class *klass, bool update_enabled)
Definition: table_setup_instruments.cc:355
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_setup_instruments.cc:188
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_setup_instruments.cc:98
int index_init(uint idx, bool sorted) override
Definition: table_setup_instruments.cc:260
static PFS_engine_table_share m_share
Table share.
Definition: table_setup_instruments.h:96
pos_setup_instruments m_pos
Current position.
Definition: table_setup_instruments.h:131
PFS_index_setup_instruments * m_opened_index
Definition: table_setup_instruments.h:135
int update_row_values(TABLE *table, const unsigned char *old_buf, unsigned char *new_buf, Field **fields) override
Update the current row values.
Definition: table_setup_instruments.cc:453
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_setup_instruments.cc:110
static ha_rows get_row_count()
Definition: table_setup_instruments.cc:102
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1141
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
Performance schema tables (declarations).
static void update_enabled(MYSQL_THD, SYS_VAR *, void *, const void *value)
Updater function for the status variable ..._enabled.
Definition: rewriter_plugin.cc:167
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
Information for all instrumentation.
Definition: pfs_instr_class.h:212
Name space, internal views used within table setup_instruments.
Definition: table_helper.h:490
static const uint FIRST_INSTRUMENT
Definition: table_helper.h:491
static const uint LAST_INSTRUMENT
Definition: table_helper.h:516
Definition: table.h:1407
Definition: thr_lock.h:139
Position of a cursor on PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS.
Definition: table_setup_instruments.h:63
pos_setup_instruments()
Definition: table_setup_instruments.h:64
void next_view()
Definition: table_setup_instruments.h:73
bool has_more_view()
Definition: table_setup_instruments.h:71
void reset()
Definition: table_setup_instruments.h:66
A row of PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS.
Definition: table_setup_instruments.h:50
PFS_instr_class * m_instr_class
Columns NAME, ENABLED, TIMED.
Definition: table_setup_instruments.h:52
bool m_update_timed
True if column TIMED can be updated.
Definition: table_setup_instruments.h:56
bool m_update_enabled
True if column ENABLED can be updated.
Definition: table_setup_instruments.h:54
bool m_update_flags
True if column FLAGS can be updated.
Definition: table_setup_instruments.h:58
Helpers to implement a performance schema table.