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