MySQL 9.1.0
Source Code Documentation
|
Classes | |
struct | Aligned_alloc |
Aligned allocation routines. More... | |
struct | Aligned_alloc_ |
Small wrapper which utilizes SFINAE to dispatch the call to appropriate aligned allocator implementation. More... | |
struct | Aligned_alloc_impl |
struct | Aligned_alloc_metadata |
Memory layout representation of metadata segment guaranteed by the inner workings of Aligned_alloc_impl. More... | |
struct | Aligned_alloc_pfs |
Aligned allocation routines which are instrumented through PFS (performance-schema). More... | |
struct | Aligned_array_deleter |
struct | Aligned_deleter |
struct | Alloc |
Allocation routines for non-extended alignment types, as opposed to Aligned_alloc for example. More... | |
struct | Alloc_ |
Small wrapper which utilizes SFINAE to dispatch the call to appropriate allocator implementation. More... | |
struct | Alloc_arr |
Specialization of allocation routines for non-extended alignment types but which in comparison to Alloc are providing support for arrays. More... | |
struct | Alloc_fn |
Simple wrapping type around malloc, calloc and friends. More... | |
struct | Alloc_pfs |
Allocation routines for non-extended alignment types, as opposed to Aligned_alloc_pfs for example, but which are instrumented through PFS (performance-schema). More... | |
struct | allocator_base |
struct | allocator_base_pfs |
struct | allocator_traits |
Simple allocator traits. More... | |
struct | Array_deleter |
struct | Deleter |
struct | Large_alloc_ |
Small wrapper which utilizes SFINAE to dispatch the call to appropriate aligned allocator implementation. More... | |
struct | Large_page_alloc |
Allocation routines which are purposed for allocating memory through the means of what is known as large (huge) pages. More... | |
struct | Large_page_alloc_pfs |
Allocation routines which are purposed for allocating memory through the means of what is known as large (huge) pages. More... | |
struct | Page_alloc |
Allocation routines which are purposed for allocating system page-aligned memory. More... | |
struct | Page_alloc_ |
Small wrapper which utilizes SFINAE to dispatch the call to appropriate aligned allocator implementation. More... | |
struct | Page_alloc_metadata |
Helper struct implementing the type which represents the metadata for all types of page-aligned allocations, be it regular pages or huge-pages. More... | |
struct | Page_alloc_metadata_pfs |
Helper struct implementing the type which represents the metadata for all types of PFS-aware page-aligned allocations, be it regular pages or huge-pages. More... | |
struct | Page_alloc_pfs |
Allocation routines which are purposed for allocating system page-aligned memory. More... | |
struct | PFS_metadata |
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... | |
struct | select_alloc_impl |
Simple utility metafunction which selects appropriate allocator variant (implementation) depending on the input parameter(s). More... | |
struct | select_alloc_impl< true > |
struct | select_large_page_alloc_impl |
Simple utility metafunction which selects appropriate allocator variant (implementation) depending on the input parameter(s). More... | |
struct | select_large_page_alloc_impl< true > |
struct | select_malloc_impl |
Simple utility metafunction which selects appropriate allocator variant (implementation) depending on the input parameter(s). More... | |
struct | select_malloc_impl< false, false > |
struct | select_malloc_impl< false, true > |
struct | select_malloc_impl< true, Array_specialization > |
struct | select_page_alloc_impl |
Simple utility meta-function which selects appropriate allocator variant (implementation) depending on the input parameter(s). More... | |
struct | select_page_alloc_impl< true > |
Typedefs | |
template<bool Pfs_memory_instrumentation_on> | |
using | select_alloc_impl_t = typename select_alloc_impl< Pfs_memory_instrumentation_on >::type |
Just a small helper type which saves us some keystrokes. More... | |
template<bool Pfs_memory_instrumentation_on, bool Array_specialization> | |
using | select_malloc_impl_t = typename select_malloc_impl< Pfs_memory_instrumentation_on, Array_specialization >::type |
Just a small helper type which saves us some keystrokes. More... | |
template<bool Pfs_memory_instrumentation_on> | |
using | select_large_page_alloc_impl_t = typename select_large_page_alloc_impl< Pfs_memory_instrumentation_on >::type |
Just a small helper type which saves us some keystrokes. More... | |
template<bool Pfs_memory_instrumentation_on> | |
using | select_page_alloc_impl_t = typename select_page_alloc_impl< Pfs_memory_instrumentation_on >::type |
Just a small helper type which saves us some keystrokes. More... | |
Enumerations | |
enum class | Page_type { system_page = 0x10 , large_page = 0x20 } |
Types of pages currently supported by ut:: library functions. More... | |
Functions | |
void * | malloc (size_t nbytes) |
void * | calloc (size_t nbytes) |
void * | realloc (void *ptr, size_t nbytes) |
void | free (void *ptr) |
constexpr size_t | calc_align (size_t n, size_t m) |
Calculates the smallest multiple of m that is not smaller than n when m is a power of two. More... | |
constexpr size_t | pow2_round (size_t n, size_t m) |
Calculates the biggest multiple of m that is not bigger than n when m is a power of two. More... | |
constexpr size_t | round_to_next_multiple (size_t n, size_t m) |
Calculates the next multiple of m that is bigger or equal to n. More... | |
void * | large_page_aligned_alloc (size_t n_bytes) |
Allocates memory backed by large (huge) pages. More... | |
bool | large_page_aligned_free (void *ptr, size_t n_bytes) |
Releases memory backed by large (huge) pages. More... | |
size_t | large_page_size () |
Queries the current size of large (huge) pages on running system. More... | |
std::vector< size_t > | large_page_all_supported_sizes () |
Queries all possible page-sizes. More... | |
void * | page_aligned_alloc (size_t n_bytes) |
Allocates system page-aligned memory. More... | |
bool | page_aligned_free (void *ptr, size_t n_bytes) |
Releases system page-aligned storage. More... | |
template<typename T , typename Tuple , size_t... Args_index_seq> | |
void | construct_impl (void *mem, size_t offset, Tuple &&tuple, std::index_sequence< Args_index_seq... >) |
template<typename T , typename Tuple > | |
void | construct (void *mem, size_t offset, Tuple &&tuple) |
constexpr uint64_t | multiply_uint64_portable (uint64_t x, uint64_t y, uint64_t &hi) |
Calculates the 128bit result of multiplication of the two specified 64bit integers. More... | |
constexpr uint32_t | hash_uint32_pair_ib (uint32_t n1, uint32_t n2) |
A helper method, it is used by hash_binary_ib for backward compatibility. More... | |
static int64_t | read_from_1 (const byte *addr) |
static int64_t | read_from_2 (const byte *addr) |
static int64_t | read_from_4 (const byte *addr) |
static int64_t | read_from_8 (const byte *addr) |
Variables | |
static constexpr auto | SUPER_PAGE_SIZE = VM_FLAGS_SUPERPAGE_SIZE_2MB |
Superpage size to be used (2MB). More... | |
template<typename > | |
constexpr bool | is_unbounded_array_v = false |
template<typename T > | |
constexpr bool | is_unbounded_array_v< T[]> = true |
template<typename > | |
constexpr bool | is_bounded_array_v = false |
template<typename T , std::size_t N> | |
constexpr bool | is_bounded_array_v< T[N]> = true |
template<typename > | |
constexpr size_t | bounded_array_size_v = 0 |
template<typename T , std::size_t N> | |
constexpr size_t | bounded_array_size_v< T[N]> = N |
thread_local uint64_t | random_seed = ut::this_thread_hash + my_timer_cycles() |
Seed value of ut::random_64() More... | |
std::array< std::array< uint64_t, 8 >, 256 > | tab_hash_lookup_table |
Table for Tabulation Hashing, precomputed hash values for all byte values. More... | |
using ut::detail::select_alloc_impl_t = typedef typename select_alloc_impl<Pfs_memory_instrumentation_on>::type |
Just a small helper type which saves us some keystrokes.
using ut::detail::select_large_page_alloc_impl_t = typedef typename select_large_page_alloc_impl<Pfs_memory_instrumentation_on>::type |
Just a small helper type which saves us some keystrokes.
using ut::detail::select_malloc_impl_t = typedef typename select_malloc_impl<Pfs_memory_instrumentation_on, Array_specialization>::type |
Just a small helper type which saves us some keystrokes.
using ut::detail::select_page_alloc_impl_t = typedef typename select_page_alloc_impl<Pfs_memory_instrumentation_on>::type |
Just a small helper type which saves us some keystrokes.
|
strong |
|
constexpr |
Calculates the smallest multiple of m that is not smaller than n when m is a power of two.
In other words, rounds n up to m * k.
n | in: number to round up |
m | in: alignment, must be a power of two |
|
inline |
|
inline |
|
inline |
|
inline |
|
constexpr |
A helper method, it is used by hash_binary_ib for backward compatibility.
NOTE: Do not use this method, it produces results that are not hashed well. Especially for sequences of pairs of <i+n, j+n> over n.
|
inline |
Allocates memory backed by large (huge) pages.
[in] | n_bytes | Size of storage (in bytes) requested to be allocated. |
|
inline |
Releases memory backed by large (huge) pages.
[in] | ptr | Pointer to large (huge) page aligned storage. |
[in] | n_bytes | Size of the storage. |
|
inline |
Queries all possible page-sizes.
Solaris allows picking one at runtime which is contrary to how Linux, Windows and OSX does.
|
inline |
Queries the current size of large (huge) pages on running system.
Queries the page-size that is next to the minimum supported page-size Lowest supported page size is usually 4K on x86_64 whereas it's 8K on SPARC.
|
inline |
|
constexpr |
Calculates the 128bit result of multiplication of the two specified 64bit integers.
[in] | x | First number to multiply. |
[in] | y | Second number to multiply. |
[out] | hi | A reference to 64bit integer that will store higher 64bits of the result. |
|
inline |
Allocates system page-aligned memory.
[in] | n_bytes | Size of storage (in bytes) requested to be allocated. |
|
inline |
Releases system page-aligned storage.
[in] | ptr | Pointer to system page-aligned storage. |
[in] | n_bytes | Size of the storage. |
|
constexpr |
Calculates the biggest multiple of m that is not bigger than n when m is a power of two.
In other words, rounds n down to m * k.
n | in: number to round down |
m | in: alignment, must be a power of two |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inline |
|
constexpr |
Calculates the next multiple of m that is bigger or equal to n.
n | in: number to find the next multiple of in terms of m |
m | in: alignment, must be a power of two |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
thread_local uint64_t ut::detail::random_seed = ut::this_thread_hash + my_timer_cycles() |
Seed value of ut::random_64()
|
staticconstexpr |
Superpage size to be used (2MB).
std::array< std::array< uint64_t, 8 >, 256 > ut::detail::tab_hash_lookup_table |
Table for Tabulation Hashing, precomputed hash values for all byte values.
The table could be for different amount of bits per chunk than 8, but 8 seems to yield faster hash calculation than 4 or 16bits - 4bits require 16 XOR operations and sets of bit manipulations, while 16bit require bigger tables that slow down caches. The indexes are set such that hash values for a specific byte value are stored in the same cache line (8 values * 8 bytes = 64B). This way it should be much faster and less demanding on CPU caches to calculate results for small integers (where most bytes are 0).