1
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
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.
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.
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 */
20
@file mysql/psi/mysql_table.h
21
Instrumentation helpers for table io.
24
#include "mysql/psi/psi.h"
27
@defgroup Table_instrumentation Table Instrumentation
28
@ingroup Instrumentation_interface
33
@def MYSQL_TABLE_WAIT_VARIABLES
34
Instrumentation helper for table waits.
35
This instrumentation declares local variables.
36
Do not use a ';' after this macro
37
@param LOCKER the locker
38
@param STATE the locker state
39
@sa MYSQL_START_TABLE_IO_WAIT.
40
@sa MYSQL_END_TABLE_IO_WAIT.
41
@sa MYSQL_START_TABLE_LOCK_WAIT.
42
@sa MYSQL_END_TABLE_LOCK_WAIT.
44
#ifdef HAVE_PSI_TABLE_INTERFACE
45
#define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE) \
46
struct PSI_table_locker* LOCKER; \
47
PSI_table_locker_state STATE;
49
#define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE)
53
@def MYSQL_TABLE_IO_WAIT
54
Instrumentation helper for table io_waits.
55
This instrumentation marks the start of a wait event.
56
@param PSI the instrumented table
57
@param OP the table operation to be performed
58
@param INDEX the table index used if any, or MAY_KEY.
59
@param FLAGS per table operation flags.
60
@sa MYSQL_END_TABLE_WAIT.
62
#ifdef HAVE_PSI_TABLE_INTERFACE
63
#define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
67
PSI_table_locker *locker; \
68
PSI_table_locker_state state; \
69
locker= PSI_TABLE_CALL(start_table_io_wait) \
70
(& state, PSI, OP, INDEX, __FILE__, __LINE__); \
73
PSI_TABLE_CALL(end_table_io_wait)(locker); \
81
#define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
86
@def MYSQL_TABLE_LOCK_WAIT
87
Instrumentation helper for table io_waits.
88
This instrumentation marks the start of a wait event.
89
@param PSI the instrumented table
90
@param OP the table operation to be performed
91
@param INDEX the table index used if any, or MAY_KEY.
92
@param FLAGS per table operation flags.
93
@sa MYSQL_END_TABLE_WAIT.
95
#ifdef HAVE_PSI_TABLE_INTERFACE
96
#define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
100
PSI_table_locker *locker; \
101
PSI_table_locker_state state; \
102
locker= PSI_TABLE_CALL(start_table_lock_wait) \
103
(& state, PSI, OP, FLAGS, __FILE__, __LINE__); \
105
if (locker != NULL) \
106
PSI_TABLE_CALL(end_table_lock_wait)(locker); \
114
#define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
119
@def MYSQL_START_TABLE_LOCK_WAIT
120
Instrumentation helper for table lock waits.
121
This instrumentation marks the start of a wait event.
122
@param LOCKER the locker
123
@param STATE the locker state
124
@param PSI the instrumented table
125
@param OP the table operation to be performed
126
@param FLAGS per table operation flags.
127
@sa MYSQL_END_TABLE_LOCK_WAIT.
129
#ifdef HAVE_PSI_TABLE_INTERFACE
130
#define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \
131
LOCKER= inline_mysql_start_table_lock_wait(STATE, PSI, \
132
OP, FLAGS, __FILE__, __LINE__)
134
#define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \
139
@def MYSQL_END_TABLE_LOCK_WAIT
140
Instrumentation helper for table lock waits.
141
This instrumentation marks the end of a wait event.
142
@param LOCKER the locker
143
@sa MYSQL_START_TABLE_LOCK_WAIT.
145
#ifdef HAVE_PSI_TABLE_INTERFACE
146
#define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \
147
inline_mysql_end_table_lock_wait(LOCKER)
149
#define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \
153
#ifdef HAVE_PSI_TABLE_INTERFACE
155
Instrumentation calls for MYSQL_START_TABLE_LOCK_WAIT.
156
@sa MYSQL_END_TABLE_LOCK_WAIT.
158
static inline struct PSI_table_locker *
159
inline_mysql_start_table_lock_wait(PSI_table_locker_state *state,
160
struct PSI_table *psi,
161
enum PSI_table_lock_operation op,
162
ulong flags, const char *src_file, int src_line)
166
struct PSI_table_locker *locker;
167
locker= PSI_TABLE_CALL(start_table_lock_wait)
168
(state, psi, op, flags, src_file, src_line);
175
Instrumentation calls for MYSQL_END_TABLE_LOCK_WAIT.
176
@sa MYSQL_START_TABLE_LOCK_WAIT.
179
inline_mysql_end_table_lock_wait(struct PSI_table_locker *locker)
182
PSI_TABLE_CALL(end_table_lock_wait)(locker);
186
/** @} (end of group Table_instrumentation) */