mysql_memory.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Copyright (c) 2012, 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. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License, version 2.0, for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software Foundation,
  17. 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
  18. #ifndef MYSQL_MEMORY_H
  19. #define MYSQL_MEMORY_H
  20. /**
  21. @file mysql/psi/mysql_memory.h
  22. Instrumentation helpers for memory allocation.
  23. */
  24. #include "mysql/psi/psi.h"
  25. #ifndef PSI_MEMORY_CALL
  26. #define PSI_MEMORY_CALL(M) PSI_DYNAMIC_CALL(M)
  27. #endif
  28. /**
  29. @defgroup Memory_instrumentation Memory Instrumentation
  30. @ingroup Instrumentation_interface
  31. @{
  32. */
  33. /**
  34. @def mysql_memory_register(P1, P2, P3)
  35. Memory registration.
  36. */
  37. #define mysql_memory_register(P1, P2, P3) \
  38. inline_mysql_memory_register(P1, P2, P3)
  39. static inline void inline_mysql_memory_register(
  40. #ifdef HAVE_PSI_MEMORY_INTERFACE
  41. const char *category,
  42. PSI_memory_info *info,
  43. int count)
  44. #else
  45. const char *category MY_ATTRIBUTE((unused)),
  46. void *info MY_ATTRIBUTE((unused)),
  47. int count MY_ATTRIBUTE((unused)))
  48. #endif
  49. {
  50. #ifdef HAVE_PSI_MEMORY_INTERFACE
  51. PSI_MEMORY_CALL(register_memory)(category, info, count);
  52. #endif
  53. }
  54. /** @} (end of group Memory_instrumentation) */
  55. #endif