MySQL 9.0.0
Source Code Documentation
table_all_instr.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_ALL_INSTR_H
25#define TABLE_ALL_INSTR_H
26
27/**
28 @file storage/perfschema/table_all_instr.h
29 Abstract tables for all instruments (declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_compiler.h"
39
40/**
41 @addtogroup performance_schema_tables
42 @{
43*/
44
45/** Position of a cursor on table_all_instr. */
49
50 inline void reset() {
52 m_index_2 = 0;
53 }
54
55 inline bool has_more_view() { return (m_index_1 <= LAST_VIEW); }
56
57 inline void next_view() {
58 m_index_1++;
59 m_index_2 = 0;
60 }
61};
62
64 public:
66 : PFS_engine_index(key_1) {}
67
68 ~PFS_index_all_instr() override = default;
69
70 virtual bool match(PFS_mutex *) { return false; }
71 virtual bool match(PFS_rwlock *) { return false; }
72 virtual bool match(PFS_cond *) { return false; }
73 virtual bool match(PFS_file *) { return false; }
74 virtual bool match(PFS_socket *) { return false; }
75 /* All views match by default. */
76 virtual bool match_view(uint view [[maybe_unused]]) { return true; }
77};
78
79/**
80 Abstract table, a union of all instrumentations instances.
81 This table is a union of:
82 - a view on all mutex instances,
83 - a view on all rwlock instances,
84 - a view on all cond instances,
85 - a view on all file instances,
86 - a view on all socket instances
87*/
89 public:
90 static ha_rows get_row_count();
91
92 int index_init(uint, bool) override { return 0; }
93 int rnd_next() override;
94 int rnd_pos(const void *pos) override;
95 void reset_position() override;
96 int index_next() override;
97
98 protected:
99 explicit table_all_instr(const PFS_engine_table_share *share);
100
101 public:
102 ~table_all_instr() override = default;
103
104 protected:
105 /**
106 Build a row in the mutex instance view.
107 @param pfs the mutex instance
108 */
109 virtual int make_mutex_row(PFS_mutex *pfs) = 0;
110 /**
111 Build a row in the rwlock instance view.
112 @param pfs the rwlock instance
113 */
114 virtual int make_rwlock_row(PFS_rwlock *pfs) = 0;
115 /**
116 Build a row in the condition instance view.
117 @param pfs the condition instance
118 */
119 virtual int make_cond_row(PFS_cond *pfs) = 0;
120 /**
121 Build a row in the file instance view.
122 @param pfs the file instance
123 */
124 virtual int make_file_row(PFS_file *pfs) = 0;
125 /**
126 Build a row in the socket instance view.
127 @param pfs the socket instance
128 */
129 virtual int make_socket_row(PFS_socket *pfs) = 0;
130
131 /** Current position. */
133 /** Next position. */
135
137};
138
139/** @} */
140#endif
Definition: pfs_engine_table.h:300
Definition: pfs_engine_table.h:268
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_all_instr.h:63
~PFS_index_all_instr() override=default
virtual bool match(PFS_file *)
Definition: table_all_instr.h:73
virtual bool match(PFS_mutex *)
Definition: table_all_instr.h:70
PFS_index_all_instr(PFS_engine_key *key_1)
Definition: table_all_instr.h:65
virtual bool match(PFS_socket *)
Definition: table_all_instr.h:74
virtual bool match(PFS_cond *)
Definition: table_all_instr.h:72
virtual bool match_view(uint view)
Definition: table_all_instr.h:76
virtual bool match(PFS_rwlock *)
Definition: table_all_instr.h:71
Abstract table, a union of all instrumentations instances.
Definition: table_all_instr.h:88
virtual int make_file_row(PFS_file *pfs)=0
Build a row in the file instance view.
virtual int make_mutex_row(PFS_mutex *pfs)=0
Build a row in the mutex instance view.
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_all_instr.cc:110
pos_all_instr m_next_pos
Next position.
Definition: table_all_instr.h:134
static ha_rows get_row_count()
Definition: table_all_instr.cc:37
virtual int make_socket_row(PFS_socket *pfs)=0
Build a row in the socket instance view.
int index_next() override
Find key in index, read record.
Definition: table_all_instr.cc:155
table_all_instr(const PFS_engine_table_share *share)
Definition: table_all_instr.cc:45
virtual int make_cond_row(PFS_cond *pfs)=0
Build a row in the condition instance view.
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_all_instr.cc:48
pos_all_instr m_pos
Current position.
Definition: table_all_instr.h:132
virtual int make_rwlock_row(PFS_rwlock *pfs)=0
Build a row in the rwlock instance view.
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_all_instr.cc:53
int index_init(uint, bool) override
Definition: table_all_instr.h:92
~table_all_instr() override=default
PFS_index_all_instr * m_opened_index
Definition: table_all_instr.h:136
my_off_t ha_rows
Definition: my_base.h:1141
Header for compiler-dependent features.
Performance schema tables (declarations).
Performance schema instruments (declarations).
Performance schema instruments metadata (declarations).
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:66
Instrumented condition implementation.
Definition: pfs_instr.h:162
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
Instrumented File and FILE implementation.
Definition: pfs_instr.h:179
Name space, internal views used within table setup_instruments.
Definition: table_helper.h:490
static const uint LAST_VIEW
Definition: table_helper.h:502
static const uint FIRST_VIEW
Definition: table_helper.h:493
Instrumented mutex implementation.
Definition: pfs_instr.h:103
Instrumented rwlock implementation.
Definition: pfs_instr.h:129
Instrumented socket implementation.
Definition: pfs_instr.h:289
Position of a cursor on table_all_instr.
Definition: table_all_instr.h:47
bool has_more_view()
Definition: table_all_instr.h:55
void next_view()
Definition: table_all_instr.h:57
pos_all_instr()
Definition: table_all_instr.h:48
void reset()
Definition: table_all_instr.h:50
Helpers to implement a performance schema table.