MySQL 26.7.0
Source Code Documentation
pfs_events_waits.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 2026, 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_EVENTS_WAITS_H
25#define PFS_EVENTS_WAITS_H
26
27/**
28 @file storage/perfschema/pfs_events_waits.h
29 Events waits data structures (declarations).
30*/
31
32#include <sys/types.h>
33#include <atomic>
34
35#include "my_inttypes.h"
41
42struct PFS_mutex;
43struct PFS_rwlock;
44struct PFS_cond;
45struct PFS_table;
46struct PFS_file;
47struct PFS_thread;
48struct PFS_socket;
49struct PFS_instr_class;
50struct PFS_table_share;
51struct PFS_account;
52struct PFS_user;
53struct PFS_host;
55
56/** Class of a wait event. */
67};
68
69/** A wait event record. */
71 /**
72 The type of wait.
73 Readers:
74 - the consumer threads.
75 Writers:
76 - the producer threads, in the instrumentation.
77 Out of bound Writers:
78 - TRUNCATE EVENTS_WAITS_CURRENT
79 - TRUNCATE EVENTS_WAITS_HISTORY
80 - TRUNCATE EVENTS_WAITS_HISTORY_LONG
81 */
83 /** Object type */
85 /** Table share, for table operations only. */
87 /** File, for file operations only. */
89 /** Socket, for socket operations only. */
91 /** Metadata lock, for MDL operations only. */
93 /** For weak pointers, target object version. */
95 /** Identity of the object instance waited on. */
97 /** Operation performed. */
99 /**
100 Number of bytes/rows read/written.
101 This member is populated for FILE READ/WRITE operations, with a number of
102 bytes.
103 This member is populated for TABLE I/O operations, with a number of rows.
104 */
106 /**
107 Index used.
108 This member is populated for TABLE I/O operations only.
109 */
111 /** Flags */
112 ulong m_flags;
113};
114
115/** TIMED bit in the state flags bitfield. */
116#define STATE_FLAG_TIMED (1 << 0)
117/** THREAD bit in the state flags bitfield. */
118#define STATE_FLAG_THREAD (1 << 1)
119/** EVENT bit in the state flags bitfield. */
120#define STATE_FLAG_EVENT (1 << 2)
121/** DIGEST bit in the state flags bitfield. */
122#define STATE_FLAG_DIGEST (1 << 3)
123/** CPU bit in the state flags bitfield. */
124#define STATE_FLAG_CPU (1 << 4)
125/** BASE bit in the state flags bitfield. */
126#define STATE_FLAG_BASE (1 << 5)
127
129
131
132extern bool flag_events_waits_current;
133extern bool flag_events_waits_history;
137
142
143int init_events_waits_history_long(uint events_waits_history_long_sizing);
145
157
164
165#endif
Some integer typedefs for easier portability.
uint32_t uint32
Definition: my_inttypes.h:67
char * user
Definition: mysqladmin.cc:67
const char * host
Definition: mysqladmin.cc:66
static int wait(mysql_cond_t *that, mysql_mutex_t *mutex_arg, const char *, unsigned int)
Definition: mysql_cond_v1_native.cc:62
Data types for columns used in the performance schema tables (declarations)
enum_object_type
Enum values for the various OBJECT_TYPE columns.
Definition: pfs_column_types.h:227
enum_operation_type
Enum values for the various OPERATION columns.
Definition: pfs_column_types.h:130
Events data structures (declarations).
void reset_table_lock_waits_by_table()
Definition: pfs_events_waits.cc:257
bool flag_events_waits_current
Consumer flag for table EVENTS_WAITS_CURRENT.
Definition: pfs_events_waits.cc:47
void reset_events_waits_by_thread()
Reset table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME data.
Definition: pfs_events_waits.cc:204
void reset_events_waits_global()
void reset_table_lock_waits_by_table_handle()
Definition: pfs_events_waits.cc:281
ulong events_waits_history_long_size
Definition: pfs_events_waits.cc:45
bool flag_global_instrumentation
Consumer flag for the global instrumentation.
Definition: pfs_events_waits.cc:53
void reset_events_waits_by_account()
Reset table EVENTS_WAITS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME data.
Definition: pfs_events_waits.cc:215
void reset_table_waits_by_table_handle()
Definition: pfs_events_waits.cc:265
void reset_events_waits_history()
Reset table EVENTS_WAITS_HISTORY data.
Definition: pfs_events_waits.cc:180
bool flag_events_waits_history_long
Consumer flag for table EVENTS_WAITS_HISTORY_LONG.
Definition: pfs_events_waits.cc:51
void reset_events_waits_current()
Reset table EVENTS_WAITS_CURRENT data.
Definition: pfs_events_waits.cc:164
PFS_cacheline_atomic_uint32 events_waits_history_long_index
Index in EVENTS_WAITS_HISTORY_LONG circular buffer.
Definition: pfs_events_waits.cc:60
void insert_events_waits_history(PFS_thread *thread, PFS_events_waits *wait)
Insert a wait record in table EVENTS_WAITS_HISTORY.
Definition: pfs_events_waits.cc:109
void aggregate_account_waits(PFS_account *account)
bool flag_thread_instrumentation
Consumer flag for the per thread instrumentation.
Definition: pfs_events_waits.cc:55
void reset_table_io_waits_by_table()
Definition: pfs_events_waits.cc:249
void aggregate_host_waits(PFS_host *host)
void reset_events_waits_history_long()
Reset table EVENTS_WAITS_HISTORY_LONG data.
Definition: pfs_events_waits.cc:185
void insert_events_waits_history_long(PFS_events_waits *wait)
Insert a wait record in table EVENTS_WAITS_HISTORY_LONG.
Definition: pfs_events_waits.cc:138
int init_events_waits_history_long(uint events_waits_history_long_sizing)
Initialize table EVENTS_WAITS_HISTORY_LONG.
Definition: pfs_events_waits.cc:68
void cleanup_events_waits_history_long()
Cleanup table EVENTS_WAITS_HISTORY_LONG.
Definition: pfs_events_waits.cc:91
bool events_waits_history_long_full
True if EVENTS_WAITS_HISTORY_LONG circular buffer is full.
Definition: pfs_events_waits.cc:58
void aggregate_user_waits(PFS_user *user)
void reset_events_waits_by_host()
Reset table EVENTS_WAITS_SUMMARY_BY_HOST_BY_EVENT_NAME data.
Definition: pfs_events_waits.cc:233
PFS_events_waits * events_waits_history_long_array
EVENTS_WAITS_HISTORY_LONG circular buffer.
Definition: pfs_events_waits.cc:62
void reset_table_waits_by_table()
Definition: pfs_events_waits.cc:241
events_waits_class
Class of a wait event.
Definition: pfs_events_waits.h:57
@ WAIT_CLASS_MUTEX
Definition: pfs_events_waits.h:59
@ NO_WAIT_CLASS
Definition: pfs_events_waits.h:58
@ WAIT_CLASS_FILE
Definition: pfs_events_waits.h:63
@ WAIT_CLASS_COND
Definition: pfs_events_waits.h:61
@ WAIT_CLASS_SOCKET
Definition: pfs_events_waits.h:64
@ WAIT_CLASS_METADATA
Definition: pfs_events_waits.h:66
@ WAIT_CLASS_TABLE
Definition: pfs_events_waits.h:62
@ WAIT_CLASS_IDLE
Definition: pfs_events_waits.h:65
@ WAIT_CLASS_RWLOCK
Definition: pfs_events_waits.h:60
void reset_events_waits_by_user()
Reset table EVENTS_WAITS_SUMMARY_BY_USER_BY_EVENT_NAME data.
Definition: pfs_events_waits.cc:224
void reset_table_io_waits_by_table_handle()
Definition: pfs_events_waits.cc:273
bool flag_events_waits_history
Consumer flag for table EVENTS_WAITS_HISTORY.
Definition: pfs_events_waits.cc:49
Miscellaneous global dependencies (declarations).
Performance schema internal locks (declarations).
Performance schema instrumentation (declarations).
std::uint64_t pfs_identity
Definition: pfs.h:34
Per account statistics.
Definition: pfs_account.h:67
An atomic uint32 variable, guaranteed to be alone in a CPU cache line.
Definition: pfs_global.h:77
Instrumented condition implementation.
Definition: pfs_instr.h:163
A wait event record.
Definition: pfs_events_waits.h:70
uint32 m_weak_version
For weak pointers, target object version.
Definition: pfs_events_waits.h:94
pfs_identity m_object_instance_addr
Identity of the object instance waited on.
Definition: pfs_events_waits.h:96
size_t m_number_of_bytes
Number of bytes/rows read/written.
Definition: pfs_events_waits.h:105
PFS_table_share * m_weak_table_share
Table share, for table operations only.
Definition: pfs_events_waits.h:86
PFS_socket * m_weak_socket
Socket, for socket operations only.
Definition: pfs_events_waits.h:90
PFS_file * m_weak_file
File, for file operations only.
Definition: pfs_events_waits.h:88
events_waits_class m_wait_class
The type of wait.
Definition: pfs_events_waits.h:82
enum_operation_type m_operation
Operation performed.
Definition: pfs_events_waits.h:98
ulong m_flags
Flags.
Definition: pfs_events_waits.h:112
uint m_index
Index used.
Definition: pfs_events_waits.h:110
enum_object_type m_object_type
Object type.
Definition: pfs_events_waits.h:84
PFS_metadata_lock * m_weak_metadata_lock
Metadata lock, for MDL operations only.
Definition: pfs_events_waits.h:92
An event record.
Definition: pfs_events.h:38
Instrumented File and FILE implementation.
Definition: pfs_instr.h:180
Per host statistics.
Definition: pfs_host.h:64
Information for all instrumentation.
Definition: pfs_instr_class.h:248
Instrumented metadata lock implementation.
Definition: pfs_instr.h:319
Instrumented mutex implementation.
Definition: pfs_instr.h:104
Instrumented rwlock implementation.
Definition: pfs_instr.h:130
Instrumented socket implementation.
Definition: pfs_instr.h:290
Instrumentation metadata for a table share.
Definition: pfs_instr_class.h:513
Instrumented table implementation.
Definition: pfs_instr.h:196
Instrumented thread implementation.
Definition: pfs_instr.h:376
Per user statistics.
Definition: pfs_user.h:63