psi_base.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /* Copyright (c) 2008, 2016, 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, version 2.0,
  4. as published by the Free Software Foundation.
  5. This program is also distributed with certain software (including
  6. but not limited to OpenSSL) that is licensed under separate terms,
  7. as designated in a particular file or component or in included license
  8. documentation. The authors of MySQL hereby grant you an additional
  9. permission to link the program and your derivative works with the
  10. separately licensed software that they have included with MySQL.
  11. Without limiting anything contained in the foregoing, this file,
  12. which is part of C Driver for MySQL (Connector/C), is also subject to the
  13. Universal FOSS Exception, version 1.0, a copy of which can be found at
  14. http://oss.oracle.com/licenses/universal-foss-exception.
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. GNU General Public License, version 2.0, for more details.
  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 Foundation,
  21. 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
  22. #ifndef MYSQL_PSI_BASE_H
  23. #define MYSQL_PSI_BASE_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. /**
  28. @file mysql/psi/psi_base.h
  29. Performance schema instrumentation interface.
  30. @defgroup Instrumentation_interface Instrumentation Interface
  31. @ingroup Performance_schema
  32. @{
  33. */
  34. #define PSI_INSTRUMENT_ME 0
  35. #define PSI_NOT_INSTRUMENTED 0
  36. /**
  37. Global flag.
  38. This flag indicate that an instrumentation point is a global variable,
  39. or a singleton.
  40. */
  41. #define PSI_FLAG_GLOBAL (1 << 0)
  42. /**
  43. Mutable flag.
  44. This flag indicate that an instrumentation point is a general placeholder,
  45. that can mutate into a more specific instrumentation point.
  46. */
  47. #define PSI_FLAG_MUTABLE (1 << 1)
  48. #define PSI_FLAG_THREAD (1 << 2)
  49. /**
  50. Stage progress flag.
  51. This flag apply to the stage instruments only.
  52. It indicates the instrumentation provides progress data.
  53. */
  54. #define PSI_FLAG_STAGE_PROGRESS (1 << 3)
  55. /**
  56. Shared Exclusive flag.
  57. Indicates that rwlock support the shared exclusive state.
  58. */
  59. #define PSI_RWLOCK_FLAG_SX (1 << 4)
  60. /**
  61. Transferable flag.
  62. This flag indicate that an instrumented object can
  63. be created by a thread and destroyed by another thread.
  64. */
  65. #define PSI_FLAG_TRANSFER (1 << 5)
  66. /**
  67. Volatility flag.
  68. This flag indicate that an instrumented object
  69. has a volatility (life cycle) comparable
  70. to the volatility of a session.
  71. */
  72. #define PSI_FLAG_VOLATILITY_SESSION (1 << 6)
  73. #ifdef HAVE_PSI_INTERFACE
  74. /**
  75. @def PSI_VERSION_1
  76. Performance Schema Interface number for version 1.
  77. This version is supported.
  78. */
  79. #define PSI_VERSION_1 1
  80. /**
  81. @def PSI_VERSION_2
  82. Performance Schema Interface number for version 2.
  83. This version is not implemented, it's a placeholder.
  84. */
  85. #define PSI_VERSION_2 2
  86. /**
  87. @def PSI_CURRENT_VERSION
  88. Performance Schema Interface number for the most recent version.
  89. The most current version is @c PSI_VERSION_1
  90. */
  91. #define PSI_CURRENT_VERSION 1
  92. /**
  93. @def USE_PSI_1
  94. Define USE_PSI_1 to use the interface version 1.
  95. */
  96. /**
  97. @def USE_PSI_2
  98. Define USE_PSI_2 to use the interface version 2.
  99. */
  100. /**
  101. @def HAVE_PSI_1
  102. Define HAVE_PSI_1 if the interface version 1 needs to be compiled in.
  103. */
  104. /**
  105. @def HAVE_PSI_2
  106. Define HAVE_PSI_2 if the interface version 2 needs to be compiled in.
  107. */
  108. #ifndef USE_PSI_2
  109. #ifndef USE_PSI_1
  110. #define USE_PSI_1
  111. #endif
  112. #endif
  113. #ifdef USE_PSI_1
  114. #define HAVE_PSI_1
  115. #endif
  116. #ifdef USE_PSI_2
  117. #define HAVE_PSI_2
  118. #endif
  119. /*
  120. Allow to override PSI_XXX_CALL at compile time
  121. with more efficient implementations, if available.
  122. If nothing better is available,
  123. make a dynamic call using the PSI_server function pointer.
  124. */
  125. #define PSI_DYNAMIC_CALL(M) PSI_server->M
  126. #endif /* HAVE_PSI_INTERFACE */
  127. /** @} */
  128. #ifdef __cplusplus
  129. }
  130. #endif
  131. #endif /* MYSQL_PSI_BASE_H */