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