1 /* Copyright (c) 2010, 2014, 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"
26 #ifndef PSI_TABLE_CALL
27 #define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M)
31 @defgroup Table_instrumentation Table Instrumentation
32 @ingroup Instrumentation_interface
37 @def MYSQL_TABLE_WAIT_VARIABLES
38 Instrumentation helper for table waits.
39 This instrumentation declares local variables.
40 Do not use a ';' after this macro
41 @param LOCKER the locker
42 @param STATE the locker state
43 @sa MYSQL_START_TABLE_IO_WAIT.
44 @sa MYSQL_END_TABLE_IO_WAIT.
45 @sa MYSQL_START_TABLE_LOCK_WAIT.
46 @sa MYSQL_END_TABLE_LOCK_WAIT.
48 #ifdef HAVE_PSI_TABLE_INTERFACE
49 #define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE) \
50 struct PSI_table_locker* LOCKER; \
51 PSI_table_locker_state STATE;
53 #define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE)
57 @def MYSQL_START_TABLE_LOCK_WAIT
58 Instrumentation helper for table lock waits.
59 This instrumentation marks the start of a wait event.
60 @param LOCKER the locker
61 @param STATE the locker state
62 @param PSI the instrumented table
63 @param OP the table operation to be performed
64 @param FLAGS per table operation flags.
65 @sa MYSQL_END_TABLE_LOCK_WAIT.
67 #ifdef HAVE_PSI_TABLE_INTERFACE
68 #define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \
69 LOCKER= inline_mysql_start_table_lock_wait(STATE, PSI, \
70 OP, FLAGS, __FILE__, __LINE__)
72 #define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \
77 @def MYSQL_END_TABLE_LOCK_WAIT
78 Instrumentation helper for table lock waits.
79 This instrumentation marks the end of a wait event.
80 @param LOCKER the locker
81 @sa MYSQL_START_TABLE_LOCK_WAIT.
83 #ifdef HAVE_PSI_TABLE_INTERFACE
84 #define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \
85 inline_mysql_end_table_lock_wait(LOCKER)
87 #define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \
91 #ifdef HAVE_PSI_TABLE_INTERFACE
92 #define MYSQL_UNLOCK_TABLE(T) \
93 inline_mysql_unlock_table(T)
95 #define MYSQL_UNLOCK_TABLE(T) \
99 #ifdef HAVE_PSI_TABLE_INTERFACE
101 Instrumentation calls for MYSQL_START_TABLE_LOCK_WAIT.
102 @sa MYSQL_END_TABLE_LOCK_WAIT.
104 static inline struct PSI_table_locker *
105 inline_mysql_start_table_lock_wait(PSI_table_locker_state *state,
106 struct PSI_table *psi,
107 enum PSI_table_lock_operation op,
108 ulong flags, const char *src_file, int src_line)
112 struct PSI_table_locker *locker;
113 locker= PSI_TABLE_CALL(start_table_lock_wait)
114 (state, psi, op, flags, src_file, src_line);
121 Instrumentation calls for MYSQL_END_TABLE_LOCK_WAIT.
122 @sa MYSQL_START_TABLE_LOCK_WAIT.
125 inline_mysql_end_table_lock_wait(struct PSI_table_locker *locker)
128 PSI_TABLE_CALL(end_table_lock_wait)(locker);
132 inline_mysql_unlock_table(struct PSI_table *table)
135 PSI_TABLE_CALL(unlock_table)(table);
139 /** @} (end of group Table_instrumentation) */