MySQL 9.0.0
Source Code Documentation
pfs_con_slice.h
Go to the documentation of this file.
1/* Copyright (c) 2010, 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 PFS_CON_SLICE_H
25#define PFS_CON_SLICE_H
26
27/**
28 @file storage/perfschema/pfs_con_slice.h
29 Performance schema connection slice (declarations).
30*/
31
32#include <stddef.h>
33
34#include "lf.h"
37
38struct PFS_single_stat;
39struct PFS_stage_stat;
42struct PFS_error_stat;
43class PFS_opaque_container_page;
44
45/**
46 @addtogroup performance_schema_buffers
47 @{
48*/
49
50/**
51 A connection slice, an arbitrary grouping of several connections.
52 This structure holds statistics for grouping of connections.
53*/
55 /** Reset all statistics. */
56 inline void reset_stats() {
57 m_has_waits_stats = false;
58 m_has_stages_stats = false;
61 m_has_errors_stats = false;
62 m_has_memory_stats = false;
64 }
65
66 /** Reset all wait statistics. */
67 void reset_waits_stats();
68 /** Reset all stages statistics. */
69 void reset_stages_stats();
70 /** Reset all statements statistics. */
72 /** Reset all transactions statistics. */
74 /** Reset all errors statistics. */
75 void reset_errors_stats();
76 /** Reset all status variable statistics. */
78
80 m_has_waits_stats = false;
82 }
83
85 if (!m_has_waits_stats) {
86 return nullptr;
87 }
89 }
90
92 if (!m_has_waits_stats) {
94 m_has_waits_stats = true;
95 }
97 }
98
100 m_has_stages_stats = false;
102 }
103
105 if (!m_has_stages_stats) {
106 return nullptr;
107 }
109 }
110
112 if (!m_has_stages_stats) {
114 m_has_stages_stats = true;
115 }
117 }
118
122 }
123
126 return nullptr;
127 }
129 }
130
135 }
137 }
138
142 }
143
146 return nullptr;
147 }
149 }
150
155 }
157 }
158
160 m_has_errors_stats = false;
162 }
163
165 if (!m_has_errors_stats) {
166 return nullptr;
167 }
169 }
170
172 if (!m_has_errors_stats) {
174 m_has_errors_stats = true;
175 }
177 }
178
179 protected:
181
182 private:
183 bool m_has_waits_stats{false};
188
189 /**
190 Per connection slice waits aggregated statistics.
191 This member holds the data for the table
192 PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_*_BY_EVENT_NAME.
193 Immutable, safe to use without internal lock.
194 */
196
197 /**
198 Per connection slice stages aggregated statistics.
199 This member holds the data for the table
200 PERFORMANCE_SCHEMA.EVENTS_STAGES_SUMMARY_BY_*_BY_EVENT_NAME.
201 Immutable, safe to use without internal lock.
202 */
204
205 /**
206 Per connection slice statements aggregated statistics.
207 This member holds the data for the table
208 PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_*_BY_EVENT_NAME.
209 Immutable, safe to use without internal lock.
210 */
212
213 /**
214 Per connection slice transactions aggregated statistics.
215 This member holds the data for the table
216 PERFORMANCE_SCHEMA.EVENTS_TRANSACTIONS_SUMMARY_BY_*_BY_EVENT_NAME.
217 Immutable, safe to use without internal lock.
218 */
220
221 /**
222 Per connection slice error aggregated statistics.
223 This member holds the data for the table
224 PERFORMANCE_SCHEMA.EVENTS_ERRORS_SUMMARY_BY_*_BY_ERROR.
225 Immutable, safe to use without internal lock.
226 */
228
229 public:
232 }
233
234 /**
235 Aggregated status variables.
236 */
238
239 /** Container page. */
240 PFS_opaque_container_page *m_page;
241};
242
243/** @} */
244#endif
void reset_stages_stats()
Reset all stages statistics.
Definition: pfs_con_slice.cc:49
void reset_errors_stats()
Reset all errors statistics.
Definition: pfs_con_slice.cc:73
void reset_statements_stats()
Reset all statements statistics.
Definition: pfs_con_slice.cc:57
void reset_waits_stats()
Reset all wait statistics.
Definition: pfs_con_slice.cc:41
void reset_transactions_stats()
Reset all transactions statistics.
Definition: pfs_con_slice.cc:65
SHOW_VAR status_vars[]
Definition: mysqld.cc:11335
Performance schema internal locks (declarations).
Status variables statistics (declarations).
A connection slice, an arbitrary grouping of several connections.
Definition: pfs_con_slice.h:54
bool m_has_memory_stats
Definition: pfs_con_slice.h:180
PFS_error_stat * m_instr_class_errors_stats
Per connection slice error aggregated statistics.
Definition: pfs_con_slice.h:227
bool m_has_stages_stats
Definition: pfs_con_slice.h:184
PFS_single_stat * write_instr_class_waits_stats()
Definition: pfs_con_slice.h:91
const PFS_error_stat * read_instr_class_errors_stats() const
Definition: pfs_con_slice.h:164
void aggregate_status_stats(const System_status_var *status_vars)
Definition: pfs_con_slice.h:230
PFS_single_stat * m_instr_class_waits_stats
Per connection slice waits aggregated statistics.
Definition: pfs_con_slice.h:195
bool m_has_transactions_stats
Definition: pfs_con_slice.h:186
const PFS_single_stat * read_instr_class_waits_stats() const
Definition: pfs_con_slice.h:84
const PFS_transaction_stat * read_instr_class_transactions_stats() const
Definition: pfs_con_slice.h:144
void set_instr_class_waits_stats(PFS_single_stat *array)
Definition: pfs_con_slice.h:79
PFS_error_stat * write_instr_class_errors_stats()
Definition: pfs_con_slice.h:171
void set_instr_class_stages_stats(PFS_stage_stat *array)
Definition: pfs_con_slice.h:99
void reset_status_stats()
Reset all status variable statistics.
Definition: pfs_con_slice.h:77
void set_instr_class_statements_stats(PFS_statement_stat *array)
Definition: pfs_con_slice.h:119
PFS_transaction_stat * m_instr_class_transactions_stats
Per connection slice transactions aggregated statistics.
Definition: pfs_con_slice.h:219
PFS_stage_stat * m_instr_class_stages_stats
Per connection slice stages aggregated statistics.
Definition: pfs_con_slice.h:203
PFS_opaque_container_page * m_page
Container page.
Definition: pfs_con_slice.h:240
PFS_statement_stat * m_instr_class_statements_stats
Per connection slice statements aggregated statistics.
Definition: pfs_con_slice.h:211
const PFS_statement_stat * read_instr_class_statements_stats() const
Definition: pfs_con_slice.h:124
bool m_has_waits_stats
Definition: pfs_con_slice.h:183
PFS_status_stats m_status_stats
Aggregated status variables.
Definition: pfs_con_slice.h:237
PFS_transaction_stat * write_instr_class_transactions_stats()
Definition: pfs_con_slice.h:151
bool m_has_errors_stats
Definition: pfs_con_slice.h:187
void set_instr_class_errors_stats(PFS_error_stat *array)
Definition: pfs_con_slice.h:159
const PFS_stage_stat * read_instr_class_stages_stats() const
Definition: pfs_con_slice.h:104
bool m_has_statements_stats
Definition: pfs_con_slice.h:185
PFS_stage_stat * write_instr_class_stages_stats()
Definition: pfs_con_slice.h:111
void reset_stats()
Reset all statistics.
Definition: pfs_con_slice.h:56
void set_instr_class_transactions_stats(PFS_transaction_stat *array)
Definition: pfs_con_slice.h:139
PFS_statement_stat * write_instr_class_statements_stats()
Definition: pfs_con_slice.h:131
Statistics for all server errors.
Definition: pfs_stat.h:557
Single statistic.
Definition: pfs_stat.h:52
Statistics for stage usage.
Definition: pfs_stat.h:323
Statistics for statement usage.
Definition: pfs_stat.h:376
Definition: pfs_status.h:35
void aggregate_from(const System_status_var *from)
Definition: pfs_status.cc:60
void reset()
Definition: pfs_status.cc:46
Statistics for transaction usage.
Definition: pfs_stat.h:459
Per thread status variables.
Definition: system_variables.h:525