MySQL 9.1.0
Source Code Documentation
ut::detail::PFS_metadata Struct Reference

Memory layout representation of PFS metadata segment that is used by the allocator variants which also want to trace the memory consumption through PFS (PSI) interface. More...

#include <pfs.h>

Public Types

using pfs_owning_thread_t = PSI_thread *
 Convenience types that we will be using to serialize necessary details into the Aligned_alloc metadata (allocator and PFS) segments. More...
 
using pfs_datalen_t = std::size_t
 
using pfs_memory_key_t = PSI_memory_key
 
using pfs_meta_offset_t = std::uint32_t
 
using data_segment_ptr = void *
 

Static Public Member Functions

static void pfs_owning_thread (data_segment_ptr data, pfs_owning_thread_t thread) noexcept
 Helper function which stores the PFS thread info into the OWNER field. More...
 
static void pfs_datalen (data_segment_ptr data, size_t datalen) noexcept
 Helper function which stores the PFS datalen info into the DATALEN field. More...
 
static void pfs_key (data_segment_ptr data, pfs_memory_key_t key) noexcept
 Helper function which stores the PFS key info into the KEY field. More...
 
static void pfs_metaoffset (data_segment_ptr data, std::size_t alignment) noexcept
 Helper function which stores the offset to PFS metadata segment into the PFS-META-OFFSET field. More...
 
static pfs_owning_thread_t pfs_owning_thread (data_segment_ptr data) noexcept
 Helper function which recovers the information user previously stored in OWNER field. More...
 
static pfs_datalen_t pfs_datalen (data_segment_ptr data) noexcept
 Helper function which recovers the information user previously stored in DATALEN field. More...
 
static pfs_memory_key_t pfs_key (data_segment_ptr data) noexcept
 Helper function which recovers the information user previously stored in KEY field. More...
 
static void * deduce_pfs_meta (data_segment_ptr data) noexcept
 Helper function which deduces the pointer to the beginning of PFS metadata segment given the pointer to DATA segment. More...
 

Static Public Attributes

static constexpr auto meta_size
 Metadata size. More...
 
static constexpr auto size = meta_size + sizeof(pfs_meta_offset_t)
 

Static Private Member Functions

static pfs_owning_thread_tptr_to_pfs_owning_thread (data_segment_ptr data) noexcept
 Helper accessor function to OWNER metadata. More...
 
static pfs_datalen_tptr_to_pfs_datalen (data_segment_ptr data) noexcept
 Helper accessor function to DATALEN metadata. More...
 
static pfs_memory_key_tptr_to_pfs_key (data_segment_ptr data) noexcept
 Helper accessor function to PFS metadata. More...
 
static pfs_meta_offset_tptr_to_pfs_meta_offset (data_segment_ptr data, std::size_t alignment) noexcept
 Helper accessor function to PFS-META-OFFSET metadata. More...
 
static pfs_meta_offset_t pfs_meta_offset (data_segment_ptr data) noexcept
 Helper function which deduces PFS-META-OFFSET metadata value given the pointer to DATA segment. More...
 

Detailed Description

Memory layout representation of PFS metadata segment that is used by the allocator variants which also want to trace the memory consumption through PFS (PSI) interface.


| PFS-META | VARLEN | PFS-META-OFFSET | DATA |

^ ^ ^ | | | | ------------------------— | | | OWNER | DATALEN | KEY | | | ------------------------— | | | ptr returned by | Aligned_alloc_impl | | ptr to be returned to call-site will be pointing here

PFS-META is a segment that will hold all the necessary details one needs to otherwise carry around in order to exercise the PFS memory tracing. Following data will be serialized into this segment: Owning thread Total length of bytes allocated Key

VARLEN is the leftover variable-length segment that specialized implementations can further make use of by deducing its size from the following formulae: requested_alignment - sizeof(PFS-META-OFFSET) - sizeof(PFS-META). In code that would be alignment - PFS_metadata::size. Not used by this implementation.

PFS-META-OFFSET is a field which allows us to recover the pointer to PFS-META segment from a pointer to DATA segment.

DATA is an actual segment which will keep the user data.

Member Typedef Documentation

◆ data_segment_ptr

◆ pfs_datalen_t

◆ pfs_memory_key_t

◆ pfs_meta_offset_t

◆ pfs_owning_thread_t

Convenience types that we will be using to serialize necessary details into the Aligned_alloc metadata (allocator and PFS) segments.

Member Function Documentation

◆ deduce_pfs_meta()

static void * ut::detail::PFS_metadata::deduce_pfs_meta ( data_segment_ptr  data)
inlinestaticnoexcept

Helper function which deduces the pointer to the beginning of PFS metadata segment given the pointer to DATA segment.

◆ pfs_datalen() [1/2]

static pfs_datalen_t ut::detail::PFS_metadata::pfs_datalen ( data_segment_ptr  data)
inlinestaticnoexcept

Helper function which recovers the information user previously stored in DATALEN field.

◆ pfs_datalen() [2/2]

static void ut::detail::PFS_metadata::pfs_datalen ( data_segment_ptr  data,
size_t  datalen 
)
inlinestaticnoexcept

Helper function which stores the PFS datalen info into the DATALEN field.

◆ pfs_key() [1/2]

static pfs_memory_key_t ut::detail::PFS_metadata::pfs_key ( data_segment_ptr  data)
inlinestaticnoexcept

Helper function which recovers the information user previously stored in KEY field.

◆ pfs_key() [2/2]

static void ut::detail::PFS_metadata::pfs_key ( data_segment_ptr  data,
pfs_memory_key_t  key 
)
inlinestaticnoexcept

Helper function which stores the PFS key info into the KEY field.

◆ pfs_meta_offset()

static pfs_meta_offset_t ut::detail::PFS_metadata::pfs_meta_offset ( data_segment_ptr  data)
inlinestaticprivatenoexcept

Helper function which deduces PFS-META-OFFSET metadata value given the pointer to DATA segment.

◆ pfs_metaoffset()

static void ut::detail::PFS_metadata::pfs_metaoffset ( data_segment_ptr  data,
std::size_t  alignment 
)
inlinestaticnoexcept

Helper function which stores the offset to PFS metadata segment into the PFS-META-OFFSET field.

◆ pfs_owning_thread() [1/2]

static pfs_owning_thread_t ut::detail::PFS_metadata::pfs_owning_thread ( data_segment_ptr  data)
inlinestaticnoexcept

Helper function which recovers the information user previously stored in OWNER field.

◆ pfs_owning_thread() [2/2]

static void ut::detail::PFS_metadata::pfs_owning_thread ( data_segment_ptr  data,
pfs_owning_thread_t  thread 
)
inlinestaticnoexcept

Helper function which stores the PFS thread info into the OWNER field.

◆ ptr_to_pfs_datalen()

static pfs_datalen_t * ut::detail::PFS_metadata::ptr_to_pfs_datalen ( data_segment_ptr  data)
inlinestaticprivatenoexcept

Helper accessor function to DATALEN metadata.

◆ ptr_to_pfs_key()

static pfs_memory_key_t * ut::detail::PFS_metadata::ptr_to_pfs_key ( data_segment_ptr  data)
inlinestaticprivatenoexcept

Helper accessor function to PFS metadata.

◆ ptr_to_pfs_meta_offset()

static pfs_meta_offset_t * ut::detail::PFS_metadata::ptr_to_pfs_meta_offset ( data_segment_ptr  data,
std::size_t  alignment 
)
inlinestaticprivatenoexcept

Helper accessor function to PFS-META-OFFSET metadata.

◆ ptr_to_pfs_owning_thread()

static pfs_owning_thread_t * ut::detail::PFS_metadata::ptr_to_pfs_owning_thread ( data_segment_ptr  data)
inlinestaticprivatenoexcept

Helper accessor function to OWNER metadata.

Member Data Documentation

◆ meta_size

constexpr auto ut::detail::PFS_metadata::meta_size
staticconstexpr
Initial value:
= sizeof(pfs_memory_key_t) +
sizeof(pfs_datalen_t)
std::size_t pfs_datalen_t
Definition: pfs.h:91
PSI_thread * pfs_owning_thread_t
Convenience types that we will be using to serialize necessary details into the Aligned_alloc metadat...
Definition: pfs.h:90
PSI_memory_key pfs_memory_key_t
Definition: pfs.h:92

Metadata size.

◆ size

constexpr auto ut::detail::PFS_metadata::size = meta_size + sizeof(pfs_meta_offset_t)
staticconstexpr

The documentation for this struct was generated from the following file: