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