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