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