MySQL  8.0.16
Source Code Documentation
psi_memory.h
Go to the documentation of this file.
1 /* Copyright (c) 2013, 2019, 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-1301 USA */
22 
23 #ifndef MYSQL_PSI_MEMORY_H
24 #define MYSQL_PSI_MEMORY_H
25 
26 #include "my_psi_config.h" // IWYU pragma: keep
27 #include "my_sharedlib.h"
29 
30 /*
31  MAINTAINER:
32  Note that this file is part of the public API,
33  because mysql.h exports
34  struct MEM_ROOT
35  See
36  - PSI_memory_key MEM_ROOT::m_psi_key
37  - include/mysql.h.pp
38 */
39 
40 /**
41  @file include/mysql/psi/psi_memory.h
42  Performance schema instrumentation interface.
43 */
44 
45 /**
46  @defgroup psi_abi_memory Memory Instrumentation (ABI)
47  @ingroup psi_abi
48  @{
49 */
50 
51 /**
52  Instrumented memory key.
53  To instrument memory, a memory key must be obtained using @c register_memory.
54  Using a zero key always disable the instrumentation.
55 */
56 typedef unsigned int PSI_memory_key;
57 
58 /**
59  @def PSI_MEMORY_VERSION_1
60  Performance Schema Memory Interface number for version 1.
61  This version is supported.
62 */
63 #define PSI_MEMORY_VERSION_1 1
64 
65 /**
66  @def PSI_CURRENT_MEMORY_VERSION
67  Performance Schema Memory Interface number for the most recent version.
68  The most current version is @c PSI_MEMORY_VERSION_1
69 */
70 #define PSI_CURRENT_MEMORY_VERSION 1
71 
72 struct PSI_thread;
73 
74 /** Entry point for the performance schema interface. */
76  /**
77  ABI interface finder.
78  Calling this method with an interface version number returns either
79  an instance of the ABI for this version, or NULL.
80  @sa PSI_MEMORY_VERSION_1
81  @sa PSI_MEMORY_VERSION_2
82  @sa PSI_CURRENT_MEMORY_VERSION
83  */
84  void *(*get_interface)(int version);
85 };
87 
88 #ifdef HAVE_PSI_MEMORY_INTERFACE
89 
90 /**
91  Performance Schema Memory Interface, version 1.
92  @since PSI_MEMORY_VERSION_1
93 */
95  /** @sa register_memory_v1_t. */
97  /** @sa memory_alloc_v1_t. */
99  /** @sa memory_realloc_v1_t. */
101  /** @sa memory_claim_v1_t. */
103  /** @sa memory_free_v1_t. */
105 };
106 
108 
110 
111 #endif /* HAVE_PSI_MEMORY_INTERFACE */
112 
113 /** @} (end of group psi_abi_memory) */
114 
115 #endif /* MYSQL_PSI_MEMORY_H */
memory_claim_v1_t memory_claim
Definition: psi_memory.h:102
memory_free_v1_t memory_free
Definition: psi_memory.h:104
#define MYSQL_PLUGIN_IMPORT
Definition: my_sharedlib.h:70
Performance schema instrumentation interface.
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory.h:56
MYSQL_PLUGIN_IMPORT PSI_memory_service_t * psi_memory_service
Definition: psi_noop.cc:901
memory_realloc_v1_t memory_realloc
Definition: psi_memory.h:100
Functions related to handling of plugins and other dynamically loaded libraries.
void(* register_memory_v1_t)(const char *category, struct PSI_memory_info_v1 *info, int count)
Memory registration API.
Definition: psi_memory_bits.h:78
PSI_memory_key(* memory_alloc_v1_t)(PSI_memory_key key, size_t size, struct PSI_thread **owner)
Instrument memory allocation.
Definition: psi_memory_bits.h:89
PSI_memory_key(* memory_claim_v1_t)(PSI_memory_key key, size_t size, struct PSI_thread **owner)
Instrument memory claim.
Definition: psi_memory_bits.h:111
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
memory_alloc_v1_t memory_alloc
Definition: psi_memory.h:98
const string version("\ersion\)
Performance Schema Memory Interface, version 1.
Definition: psi_memory.h:94
PSI_memory_key(* memory_realloc_v1_t)(PSI_memory_key key, size_t old_size, size_t new_size, struct PSI_thread **owner)
Instrument memory re allocation.
Definition: psi_memory_bits.h:100
Entry point for the performance schema interface.
Definition: psi_memory.h:75
register_memory_v1_t register_memory
Definition: psi_memory.h:96
void(* memory_free_v1_t)(PSI_memory_key key, size_t size, struct PSI_thread *owner)
Instrument memory free.
Definition: psi_memory_bits.h:120
struct PSI_thread PSI_thread
Definition: psi_thread_bits.h:71