MySQL 8.4.0
Source Code Documentation
psi_memory_bits.h
Go to the documentation of this file.
1/* Copyright (c) 2013, 2024, Oracle and/or its affiliates.
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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
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
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef COMPONENTS_SERVICES_BITS_PSI_MEMORY_BITS_H
25#define COMPONENTS_SERVICES_BITS_PSI_MEMORY_BITS_H
26
27#ifndef MYSQL_ABI_CHECK
28#include <stddef.h> /* size_t */
29#endif
30
32
33/**
34 @file mysql/components/services/bits/psi_memory_bits.h
35 Performance schema instrumentation interface.
36*/
37
38/**
39 @defgroup psi_abi_memory Memory Instrumentation (ABI)
40 @ingroup psi_abi
41 @{
42*/
43
44/**
45 Instrumented memory key.
46 To instrument memory, a memory key must be obtained using @c register_memory.
47 Using a zero key always disable the instrumentation.
48*/
49typedef unsigned int PSI_memory_key;
50
51struct PSI_thread;
52
53/**
54 Memory instrument information.
55 @since PSI_MEMORY_VERSION_1
56 This structure is used to register instrumented memory.
57*/
59 /** Pointer to the key assigned to the registered memory. */
61 /** The name of the memory instrument to register. */
62 const char *m_name;
63 /**
64 The flags of the memory instrument to register.
65 @sa PSI_FLAG_ONLY_GLOBAL_STAT
66 */
67 unsigned int m_flags;
68 /** Volatility index. */
70 /** Documentation. */
71 const char *m_documentation;
72};
74
75/**
76 Memory registration API.
77 @param category a category name (typically a plugin name)
78 @param info an array of memory info to register
79 @param count the size of the info array
80*/
81typedef void (*register_memory_v1_t)(const char *category,
82 struct PSI_memory_info_v1 *info,
83 int count);
84
85/**
86 Instrument memory allocation.
87 @param key the memory instrument key
88 @param size the size of memory allocated
89 @param[out] owner the memory owner
90 @return the effective memory instrument key
91*/
93 struct PSI_thread **owner);
94
95/**
96 Instrument memory re allocation.
97 @param key the memory instrument key
98 @param old_size the size of memory previously allocated
99 @param new_size the size of memory re allocated
100 @param[in, out] owner the memory owner
101 @return the effective memory instrument key
102*/
104 size_t old_size, size_t new_size,
105 struct PSI_thread **owner);
106
107/**
108 Instrument memory claim.
109 @param key the memory instrument key
110 @param size the size of memory allocated
111 @param[in, out] owner the memory owner
112 @return the effective memory instrument key
113*/
115 struct PSI_thread **owner);
116
117/**
118 Instrument memory claim.
119 @param key the memory instrument key
120 @param size the size of memory allocated
121 @param[in, out] owner the memory owner
122 @param claim True to claim, false to unclaim
123 @return the effective memory instrument key
124*/
126 struct PSI_thread **owner,
127 bool claim);
128
129/**
130 Instrument memory free.
131 @param key the memory instrument key
132 @param size the size of memory allocated
133 @param owner the memory owner
134*/
135typedef void (*memory_free_v1_t)(PSI_memory_key key, size_t size,
136 struct PSI_thread *owner);
137
139
140/** @} (end of group psi_abi_memory) */
141
142#endif /* COMPONENTS_SERVICES_BITS_PSI_MEMORY_BITS_H */
PSI_memory_key(* memory_claim_v2_t)(PSI_memory_key key, size_t size, struct PSI_thread **owner, bool claim)
Instrument memory claim.
Definition: psi_memory_bits.h:125
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:103
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:92
void(* register_memory_v1_t)(const char *category, struct PSI_memory_info_v1 *info, int count)
Memory registration API.
Definition: psi_memory_bits.h:81
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
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:114
void(* memory_free_v1_t)(PSI_memory_key key, size_t size, struct PSI_thread *owner)
Instrument memory free.
Definition: psi_memory_bits.h:135
struct PSI_thread PSI_thread
Definition: psi_thread_bits.h:82
static int count
Definition: myisam_ftdump.cc:45
size_t size(const char *const c)
Definition: base64.h:46
static const char * category
Definition: sha2_password.cc:170
Performance schema instrumentation interface.
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Memory instrument information.
Definition: psi_memory_bits.h:58
PSI_memory_key * m_key
Pointer to the key assigned to the registered memory.
Definition: psi_memory_bits.h:60
const char * m_name
The name of the memory instrument to register.
Definition: psi_memory_bits.h:62
unsigned int m_flags
The flags of the memory instrument to register.
Definition: psi_memory_bits.h:67
const char * m_documentation
Documentation.
Definition: psi_memory_bits.h:71
int m_volatility
Volatility index.
Definition: psi_memory_bits.h:69