MySQL  8.0.23
Source Code Documentation
psi_bits.h
Go to the documentation of this file.
1 /* Copyright (c) 2008, 2020, 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 COMPONENTS_SERVICES_BITS_PSI_BITS_H
24 #define COMPONENTS_SERVICES_BITS_PSI_BITS_H
25 
26 /**
27  @file include/mysql/components/services/bits/psi_bits.h
28  Performance schema instrumentation interface.
29 
30  @defgroup instrumentation_interface Instrumentation Interface
31  @ingroup performance_schema
32  @{
33 
34  @defgroup psi_api Instrumentation Programming Interface
35  @{
36  @}
37 
38  @defgroup psi_abi Instrumentation Binary Interface
39  @{
40 */
41 
42 static constexpr unsigned PSI_INSTRUMENT_ME = 0;
43 
44 #define PSI_DOCUMENT_ME ""
45 
46 static constexpr unsigned PSI_NOT_INSTRUMENTED = 0;
47 
48 /**
49  Singleton flag.
50  This flag indicate that an instrumentation point is a singleton.
51 */
52 #define PSI_FLAG_SINGLETON (1 << 0)
53 
54 /**
55  Mutable flag.
56  This flag indicate that an instrumentation point is a general placeholder,
57  that can mutate into a more specific instrumentation point.
58 */
59 #define PSI_FLAG_MUTABLE (1 << 1)
60 
61 /**
62  Per Thread flag.
63  This flag indicates the instrumented object is per thread.
64  Reserved for future use.
65 */
66 #define PSI_FLAG_THREAD (1 << 2)
67 
68 /**
69  Stage progress flag.
70  This flag apply to the stage instruments only.
71  It indicates the instrumentation provides progress data.
72 */
73 #define PSI_FLAG_STAGE_PROGRESS (1 << 3)
74 
75 /**
76  Shared Exclusive flag.
77  Indicates that rwlock support the shared exclusive state.
78 */
79 #define PSI_FLAG_RWLOCK_SX (1 << 4)
80 
81 /**
82  Transferable flag.
83  This flag indicate that an instrumented object can
84  be created by a thread and destroyed by another thread.
85 */
86 #define PSI_FLAG_TRANSFER (1 << 5)
87 
88 /**
89  User flag.
90  This flag indicate that an instrumented object exists on a
91  user or foreground thread. If not set, then the object
92  exists on a system or background thread.
93 */
94 #define PSI_FLAG_USER (1 << 6)
95 
96 /**
97  Global stat only flag.
98  This flag indicates statistics for the instrument
99  are aggregated globally only.
100  No per thread / account / user / host aggregations
101  are available.
102 */
103 #define PSI_FLAG_ONLY_GLOBAL_STAT (1 << 7)
104 
105 /**
106  Priority lock flag.
107  Indicates that rwlock support the priority lock scheduling.
108 */
109 #define PSI_FLAG_RWLOCK_PR (1 << 8)
110 
111 /**
112  System thread flag.
113  Indicates that the instrumented object exists on a system thread.
114 */
115 #define PSI_FLAG_THREAD_SYSTEM (1 << 9)
116 
117 #define PSI_VOLATILITY_UNKNOWN 0
118 #define PSI_VOLATILITY_PERMANENT 1
119 #define PSI_VOLATILITY_PROVISIONING 2
120 #define PSI_VOLATILITY_DDL 3
121 #define PSI_VOLATILITY_CACHE 4
122 #define PSI_VOLATILITY_SESSION 5
123 #define PSI_VOLATILITY_TRANSACTION 6
124 #define PSI_VOLATILITY_QUERY 7
125 #define PSI_VOLATILITY_INTRA_QUERY 8
126 
127 #define PSI_COUNT_VOLATILITY 9
128 
131 };
132 
133 /**
134  Instrumented artifact.
135  The object instrumented can be enabled or disabled.
136  The @c m_enabled member is visible and public,
137  and must be tested by the instrumented code
138  before making low level api calls to
139  the actual instrumentation implementation.
140 */
141 struct PSI_instr {
142  /**
143  Instrumentation is enabled.
144  This flag must be checked before making calls to:
145  - @c PSI_MUTEX_CALL(start_mutex_wait)
146  - @c PSI_MUTEX_CALL(unlock_mutex)
147  - @c PSI_RWLOCK_CALL(start_rwlock_rdwait)
148  - @c PSI_RWLOCK_CALL(start_rwlock_wrwait)
149  - @c PSI_RWLOCK_CALL(unlock_rwlock)
150  - @c PSI_COND_CALL(start_cond_wait)
151  - @c PSI_COND_CALL(signal_cond)
152  - @c PSI_COND_CALL(broadcast_cond)
153  - @c PSI_SOCKET_CALL(start_socket_wait)
154  */
155  bool m_enabled;
156 };
157 
158 /**
159  @} (end of group psi_abi)
160  @} (end of group instrumentation_interface)
161 */
162 
163 #endif /* COMPONENTS_SERVICES_BITS_PSI_BITS_H */
PSI_INSTRUMENT_ME
static constexpr unsigned PSI_INSTRUMENT_ME
Definition: psi_bits.h:42
PSI_NOT_INSTRUMENTED
static constexpr unsigned PSI_NOT_INSTRUMENTED
Definition: psi_bits.h:46
PSI_placeholder::m_placeholder
int m_placeholder
Definition: psi_bits.h:130
PSI_instr::m_enabled
bool m_enabled
Instrumentation is enabled.
Definition: psi_bits.h:155
PSI_placeholder
Definition: psi_bits.h:129
PSI_instr
Instrumented artifact.
Definition: psi_bits.h:141