1 /* Copyright (c) 2010, 2012, 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, 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-1335  USA */
22 
23 #ifndef MYSQL_STAGE_H
24 #define MYSQL_STAGE_H
25 
26 /**
27   @file mysql/psi/mysql_stage.h
28   Instrumentation helpers for stages.
29 */
30 
31 #include "mysql/psi/psi.h"
32 
33 /**
34   @defgroup Stage_instrumentation Stage Instrumentation
35   @ingroup Instrumentation_interface
36   @{
37 */
38 
39 /**
40   @def mysql_stage_register(P1, P2, P3)
41   Stage registration.
42 */
43 #ifdef HAVE_PSI_STAGE_INTERFACE
44 #define mysql_stage_register(P1, P2, P3) \
45   inline_mysql_stage_register(P1, P2, P3)
46 #else
47 #define mysql_stage_register(P1, P2, P3) \
48   do {} while (0)
49 #endif
50 
51 #ifdef HAVE_PSI_STAGE_INTERFACE
52   #define MYSQL_SET_STAGE(K, F, L) \
53     inline_mysql_set_stage(K, F, L)
54 #else
55   #define MYSQL_SET_STAGE(K, F, L) \
56     do {} while (0)
57 #endif
58 
59 #ifdef HAVE_PSI_STAGE_INTERFACE
inline_mysql_stage_register(const char * category,PSI_stage_info ** info,int count)60 static inline void inline_mysql_stage_register(
61   const char *category, PSI_stage_info **info, int count)
62 {
63   PSI_STAGE_CALL(register_stage)(category, info, count);
64 }
65 #endif
66 
67 #ifdef HAVE_PSI_STAGE_INTERFACE
68 static inline void
inline_mysql_set_stage(PSI_stage_key key,const char * src_file,int src_line)69 inline_mysql_set_stage(PSI_stage_key key,
70                        const char *src_file, int src_line)
71 {
72   PSI_STAGE_CALL(start_stage)(key, src_file, src_line);
73 }
74 #endif
75 
76 /** @} (end of group Stage_instrumentation) */
77 
78 #endif
79 
80