MySQL 8.4.0
Source Code Documentation
table_os_global_by_type.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
25#ifndef TABLE_OBJECTS_SUMMARY_GLOBAL_BY_TYPE_H
26#define TABLE_OBJECTS_SUMMARY_GLOBAL_BY_TYPE_H
27
28/**
29 @file storage/perfschema/table_os_global_by_type.h
30 Table OBJECTS_SUMMARY_GLOBAL_BY_TYPE (declarations).
31*/
32
33#include <sys/types.h>
34
35#include "my_base.h"
38
39class Field;
40class Plugin_table;
41struct PFS_program;
42struct PFS_table_share;
43struct TABLE;
44struct THR_LOCK;
45
46/**
47 @addtogroup performance_schema_tables
48 @{
49*/
50
51/**
52 A row of table
53 PERFORMANCE_SCHEMA.OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
54*/
56 /** Column OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME. */
58
59 /** Columns COUNT_STAR, SUM/MIN/AVG/MAX TIMER_WAIT. */
61};
62
63/**
64 Position of a cursor on
65 PERFORMANCE_SCHEMA.OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
66 Index 1 on object type
67 Index 2 on object instance (0 based)
68*/
72
73 inline void reset() {
75 m_index_2 = 0;
76 }
77
78 inline bool has_more_view() { return (m_index_1 <= LAST_VIEW); }
79
80 inline void next_view() {
81 m_index_1++;
82 m_index_2 = 0;
83 }
84};
85
87 public:
90 m_key_1("OBJECT_TYPE"),
91 m_key_2("OBJECT_SCHEMA"),
92 m_key_3("OBJECT_NAME") {}
93
94 ~PFS_index_os_global_by_type() override = default;
95
96 virtual bool match(PFS_table_share *pfs);
97 virtual bool match(PFS_program *pfs);
98
99 private:
103};
104
105/** Table PERFORMANCE_SCHEMA.OBJECTS_SUMMARY_GLOBAL_BY_TYPE. */
107 public:
108 /** Table share */
111 static int delete_all_rows();
112 static ha_rows get_row_count();
113
114 void reset_position() override;
115
116 int rnd_next() override;
117 int rnd_pos(const void *pos) override;
118
119 int index_init(uint idx, bool sorted) override;
120 int index_next() override;
121
122 protected:
123 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
124 bool read_all) override;
126
127 public:
128 ~table_os_global_by_type() override = default;
129
130 protected:
131 int make_table_row(PFS_table_share *table_share);
132 int make_program_row(PFS_program *pfs_program);
133
134 private:
135 /** Table share lock. */
137 /** Table definition. */
139
140 /** Current row. */
142 /** Current position. */
144 /** Next position. */
146
147 protected:
149};
150
151/** @} */
152#endif
Definition: field.h:575
Definition: pfs_engine_table.h:300
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_os_global_by_type.h:86
PFS_key_object_type m_key_1
Definition: table_os_global_by_type.h:100
PFS_key_object_schema m_key_2
Definition: table_os_global_by_type.h:101
virtual bool match(PFS_table_share *pfs)
Definition: table_os_global_by_type.cc:83
~PFS_index_os_global_by_type() override=default
PFS_key_object_name m_key_3
Definition: table_os_global_by_type.h:102
PFS_index_os_global_by_type()
Definition: table_os_global_by_type.h:88
Definition: table_helper.h:1656
Definition: table_helper.h:1641
Definition: table_helper.h:1681
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
Table PERFORMANCE_SCHEMA.OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
Definition: table_os_global_by_type.h:106
static THR_LOCK m_table_lock
Table share lock.
Definition: table_os_global_by_type.h:136
int index_next() override
Find key in index, read record.
Definition: table_os_global_by_type.cc:228
table_os_global_by_type()
Definition: table_os_global_by_type.cc:142
static PFS_engine_table_share m_share
Table share.
Definition: table_os_global_by_type.h:109
pos_os_global_by_type m_pos
Current position.
Definition: table_os_global_by_type.h:143
row_os_global_by_type m_row
Current row.
Definition: table_os_global_by_type.h:141
static Plugin_table m_table_def
Table definition.
Definition: table_os_global_by_type.h:138
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_os_global_by_type.cc:127
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_os_global_by_type.cc:327
static int delete_all_rows()
Definition: table_os_global_by_type.cc:131
~table_os_global_by_type() override=default
static ha_rows get_row_count()
Definition: table_os_global_by_type.cc:137
pos_os_global_by_type m_next_pos
Next position.
Definition: table_os_global_by_type.h:145
int index_init(uint idx, bool sorted) override
Definition: table_os_global_by_type.cc:219
PFS_index_os_global_by_type * m_opened_index
Definition: table_os_global_by_type.h:148
int make_program_row(PFS_program *pfs_program)
Definition: table_os_global_by_type.cc:271
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_os_global_by_type.cc:153
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_os_global_by_type.cc:192
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_os_global_by_type.cc:148
int make_table_row(PFS_table_share *table_share)
Definition: table_os_global_by_type.cc:287
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 const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:66
Position of a double cursor, for iterations using 2 nested loops.
Definition: pfs_engine_table.h:593
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:595
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:597
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:358
Row fragment for columns OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME.
Definition: table_helper.h:603
Name space, internal views used within object summaries.
Definition: table_helper.h:520
static const uint LAST_VIEW
Definition: table_helper.h:524
static const uint FIRST_VIEW
Definition: table_helper.h:521
Definition: pfs_program.h:57
Row fragment for single statistics columns (COUNT, SUM, MIN, AVG, MAX)
Definition: table_helper.h:689
Instrumentation metadata for a table share.
Definition: pfs_instr_class.h:458
Definition: table.h:1405
Definition: thr_lock.h:139
Position of a cursor on PERFORMANCE_SCHEMA.OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
Definition: table_os_global_by_type.h:70
void reset()
Definition: table_os_global_by_type.h:73
bool has_more_view()
Definition: table_os_global_by_type.h:78
pos_os_global_by_type()
Definition: table_os_global_by_type.h:71
void next_view()
Definition: table_os_global_by_type.h:80
A row of table PERFORMANCE_SCHEMA.OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
Definition: table_os_global_by_type.h:55
PFS_object_row m_object
Column OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME.
Definition: table_os_global_by_type.h:57
PFS_stat_row m_stat
Columns COUNT_STAR, SUM/MIN/AVG/MAX TIMER_WAIT.
Definition: table_os_global_by_type.h:60
Helpers to implement a performance schema table.