1/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
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 as published by
5 the Free Software Foundation; version 2 of the License.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software Foundation,
14 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15
16#ifndef MYSQL_PSI_BASE_H
17#define MYSQL_PSI_BASE_H
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/**
24 @file mysql/psi/psi_base.h
25 Performance schema instrumentation interface.
26
27 @defgroup Instrumentation_interface Instrumentation Interface
28 @ingroup Performance_schema
29 @{
30*/
31
32#define PSI_INSTRUMENT_ME 0
33
34#define PSI_NOT_INSTRUMENTED 0
35
36/**
37 Global flag.
38 This flag indicate that an instrumentation point is a global variable,
39 or a singleton.
40*/
41#define PSI_FLAG_GLOBAL (1 << 0)
42
43/**
44 Mutable flag.
45 This flag indicate that an instrumentation point is a general placeholder,
46 that can mutate into a more specific instrumentation point.
47*/
48#define PSI_FLAG_MUTABLE (1 << 1)
49
50#define PSI_FLAG_THREAD (1 << 2)
51
52/**
53 Stage progress flag.
54 This flag apply to the stage instruments only.
55 It indicates the instrumentation provides progress data.
56*/
57#define PSI_FLAG_STAGE_PROGRESS (1 << 3)
58
59/**
60 Shared Exclusive flag.
61 Indicates that rwlock support the shared exclusive state.
62*/
63#define PSI_RWLOCK_FLAG_SX (1 << 4)
64
65/**
66 Transferable flag.
67 This flag indicate that an instrumented object can
68 be created by a thread and destroyed by another thread.
69*/
70#define PSI_FLAG_TRANSFER (1 << 5)
71
72#ifdef HAVE_PSI_INTERFACE
73
74/**
75 @def PSI_VERSION_1
76 Performance Schema Interface number for version 1.
77 This version is supported.
78*/
79#define PSI_VERSION_1 1
80
81/**
82 @def PSI_VERSION_2
83 Performance Schema Interface number for version 2.
84 This version is not implemented, it's a placeholder.
85*/
86#define PSI_VERSION_2 2
87
88/**
89 @def PSI_CURRENT_VERSION
90 Performance Schema Interface number for the most recent version.
91 The most current version is @c PSI_VERSION_1
92*/
93#define PSI_CURRENT_VERSION 1
94
95/**
96 @def USE_PSI_1
97 Define USE_PSI_1 to use the interface version 1.
98*/
99
100/**
101 @def USE_PSI_2
102 Define USE_PSI_2 to use the interface version 2.
103*/
104
105/**
106 @def HAVE_PSI_1
107 Define HAVE_PSI_1 if the interface version 1 needs to be compiled in.
108*/
109
110/**
111 @def HAVE_PSI_2
112 Define HAVE_PSI_2 if the interface version 2 needs to be compiled in.
113*/
114
115#ifndef USE_PSI_2
116#ifndef USE_PSI_1
117#define USE_PSI_1
118#endif
119#endif
120
121#ifdef USE_PSI_1
122#define HAVE_PSI_1
123#endif
124
125#ifdef USE_PSI_2
126#define HAVE_PSI_2
127#endif
128
129/*
130 Allow to override PSI_XXX_CALL at compile time
131 with more efficient implementations, if available.
132 If nothing better is available,
133 make a dynamic call using the PSI_server function pointer.
134*/
135
136#define PSI_DYNAMIC_CALL(M) PSI_server->M
137
138#endif /* HAVE_PSI_INTERFACE */
139
140/** @} */
141
142#ifdef __cplusplus
143}
144#endif
145
146#endif /* MYSQL_PSI_BASE_H */
147
148