mysql_stage.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
  12. #ifndef MYSQL_STAGE_H
  13. #define MYSQL_STAGE_H
  14. /**
  15. @file mysql/psi/mysql_stage.h
  16. Instrumentation helpers for stages.
  17. */
  18. #include "mysql/psi/psi.h"
  19. /**
  20. @defgroup Stage_instrumentation Stage Instrumentation
  21. @ingroup Instrumentation_interface
  22. @{
  23. */
  24. /**
  25. @def mysql_stage_register(P1, P2, P3)
  26. Stage registration.
  27. */
  28. #ifdef HAVE_PSI_STAGE_INTERFACE
  29. #define mysql_stage_register(P1, P2, P3) \
  30. inline_mysql_stage_register(P1, P2, P3)
  31. #else
  32. #define mysql_stage_register(P1, P2, P3) \
  33. do {} while (0)
  34. #endif
  35. #ifdef HAVE_PSI_STAGE_INTERFACE
  36. #define MYSQL_SET_STAGE(K, F, L) \
  37. inline_mysql_set_stage(K, F, L)
  38. #else
  39. #define MYSQL_SET_STAGE(K, F, L) \
  40. do {} while (0)
  41. #endif
  42. #ifdef HAVE_PSI_STAGE_INTERFACE
  43. static inline void inline_mysql_stage_register(
  44. const char *category, PSI_stage_info **info, int count)
  45. {
  46. PSI_STAGE_CALL(register_stage)(category, info, count);
  47. }
  48. #endif
  49. #ifdef HAVE_PSI_STAGE_INTERFACE
  50. static inline void
  51. inline_mysql_set_stage(PSI_stage_key key,
  52. const char *src_file, int src_line)
  53. {
  54. PSI_STAGE_CALL(start_stage)(key, src_file, src_line);
  55. }
  56. #endif
  57. /** @} (end of group Stage_instrumentation) */
  58. #endif