MySQL  8.0.17
Source Code Documentation
psi_memory_bits.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 COMPONENTS_SERVICES_PSI_MEMORY_BITS_H
24 #define COMPONENTS_SERVICES_PSI_MEMORY_BITS_H
25 
26 #ifndef MYSQL_ABI_CHECK
27 #include <stddef.h> /* size_t */
28 #endif
29 
30 /**
31  @file
32  Performance schema instrumentation interface.
33 */
34 
35 /**
36  @defgroup psi_abi_memory Memory Instrumentation (ABI)
37  @ingroup psi_abi
38  @{
39 */
40 
41 /**
42  Instrumented memory key.
43  To instrument memory, a memory key must be obtained using @c register_memory.
44  Using a zero key always disable the instrumentation.
45 */
46 typedef unsigned int PSI_memory_key;
47 
48 struct PSI_thread;
49 
50 /**
51  Memory instrument information.
52  @since PSI_MEMORY_VERSION_1
53  This structure is used to register instrumented memory.
54 */
56  /** Pointer to the key assigned to the registered memory. */
58  /** The name of the memory instrument to register. */
59  const char *m_name;
60  /**
61  The flags of the memory instrument to register.
62  @sa PSI_FLAG_ONLY_GLOBAL_STAT
63  */
64  unsigned int m_flags;
65  /** Volatility index. */
67  /** Documentation. */
68  const char *m_documentation;
69 };
71 
72 /**
73  Memory registration API.
74  @param category a category name (typically a plugin name)
75  @param info an array of memory info to register
76  @param count the size of the info array
77 */
78 typedef void (*register_memory_v1_t)(const char *category,
79  struct PSI_memory_info_v1 *info,
80  int count);
81 
82 /**
83  Instrument memory allocation.
84  @param key the memory instrument key
85  @param size the size of memory allocated
86  @param[out] owner the memory owner
87  @return the effective memory instrument key
88 */
90  struct PSI_thread **owner);
91 
92 /**
93  Instrument memory re allocation.
94  @param key the memory instrument key
95  @param old_size the size of memory previously allocated
96  @param new_size the size of memory re allocated
97  @param[in, out] owner the memory owner
98  @return the effective memory instrument key
99 */
101  size_t old_size, size_t new_size,
102  struct PSI_thread **owner);
103 
104 /**
105  Instrument memory claim.
106  @param key the memory instrument key
107  @param size the size of memory allocated
108  @param[in, out] owner the memory owner
109  @return the effective memory instrument key
110 */
112  struct PSI_thread **owner);
113 
114 /**
115  Instrument memory free.
116  @param key the memory instrument key
117  @param size the size of memory allocated
118  @param owner the memory owner
119 */
120 typedef void (*memory_free_v1_t)(PSI_memory_key key, size_t size,
121  struct PSI_thread *owner);
122 
124 
125 /** @} (end of group psi_abi_memory) */
126 
127 #endif /* COMPONENTS_SERVICES_PSI_MEMORY_BITS_H */
ssize_t count
Definition: memcached.c:386
unsigned int m_flags
The flags of the memory instrument to register.
Definition: psi_memory_bits.h:64
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:46
Memory instrument information.
Definition: psi_memory_bits.h:55
const char * m_documentation
Documentation.
Definition: psi_memory_bits.h:68
const char * m_name
The name of the memory instrument to register.
Definition: psi_memory_bits.h:59
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 * m_key
Pointer to the key assigned to the registered memory.
Definition: psi_memory_bits.h:57
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
static const char * key
Definition: suite_stubs.c:14
static const char * category
Definition: sha2_password.cc:168
int m_volatility
Volatility index.
Definition: psi_memory_bits.h:66
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
Log info(cout, "NOTE")
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