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