MySQL 8.0.39
Source Code Documentation
PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V > Class Template Reference

#include <pfs_buffer_container.h>

Public Types

typedef T value_type
 Type of elements in the buffer. More...
 
typedef U array_type
 Type of pages in the buffer. More...
 
typedef V allocator_type
 
typedef PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V > container_type
 This container type. More...
 
typedef PFS_buffer_const_iterator< T > const_iterator_type
 
typedef PFS_buffer_scalable_iterator< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V > iterator_type
 
typedef PFS_buffer_processor< T > processor_type
 
typedef void(* function_type) (value_type *)
 

Public Member Functions

 PFS_buffer_scalable_container (allocator_type *allocator)
 
int init (long max_size)
 
void cleanup ()
 
size_t get_row_count ()
 
size_t get_row_size () const
 
size_t get_memory ()
 
value_typeallocate (pfs_dirty_state *dirty_state)
 
void deallocate (value_type *safe_pfs)
 
iterator_type iterate ()
 
iterator_type iterate (uint index)
 
void apply (function_type fct)
 
void apply_all (function_type fct)
 
void apply (processor_type &proc)
 
void apply_all (processor_type &proc)
 
value_typeget (uint index)
 
value_typeget (uint index, bool *has_more)
 
value_typesanitize (value_type *unsafe)
 

Static Public Member Functions

static void static_deallocate (value_type *safe_pfs)
 

Public Attributes

ulong m_lost
 

Static Public Attributes

static const size_t MAX_SIZE = PFS_PAGE_SIZE * PFS_PAGE_COUNT
 

Private Member Functions

uint get_page_logical_size (uint page_index)
 
value_typescan_next (uint &index, uint *found_index)
 

Private Attributes

std::atomic< bool > m_initialized {false}
 Initialized full flag. More...
 
std::atomic< bool > m_full {false}
 Buffer full flag. More...
 
std::atomic< size_t > m_max {0}
 Max number of items in the buffer. More...
 
PFS_cacheline_atomic_size_t m_monotonic
 Monotonic page counter. More...
 
PFS_cacheline_atomic_size_t m_max_page_index
 Current page index. More...
 
std::atomic< size_t > m_max_page_count {0}
 Max number of pages. More...
 
std::atomic< size_t > m_last_page_size {0}
 Size of the last page. More...
 
std::atomic< array_type * > m_pages [PFS_PAGE_COUNT]
 Array of pages. More...
 
std::atomic< allocator_type * > m_allocator {nullptr}
 Buffer allocator. More...
 
native_mutex_t m_critical_section
 

Friends

class PFS_buffer_scalable_iterator< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >
 

Member Typedef Documentation

◆ allocator_type

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
typedef V PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::allocator_type

◆ array_type

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
typedef U PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::array_type

Type of pages in the buffer.

The following attributes are required:

  • PFS_opaque_container *m_container

◆ const_iterator_type

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
typedef PFS_buffer_const_iterator<T> PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::const_iterator_type

◆ container_type

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
typedef PFS_buffer_scalable_container<T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V> PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::container_type

This container type.

◆ function_type

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
typedef void(* PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::function_type) (value_type *)

◆ iterator_type

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
typedef PFS_buffer_scalable_iterator<T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V> PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::iterator_type

◆ processor_type

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
typedef PFS_buffer_processor<T> PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::processor_type

◆ value_type

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
typedef T PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::value_type

Type of elements in the buffer.

The following attributes are required:

  • pfs_lock m_lock
    A 'lock' protecting performance schema internal buffers.
    Definition: pfs_lock.h:154
  • PFS_opaque_container_page *m_page

Constructor & Destructor Documentation

◆ PFS_buffer_scalable_container()

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::PFS_buffer_scalable_container ( allocator_type allocator)
inlineexplicit

Member Function Documentation

◆ allocate()

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
value_type * PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::allocate ( pfs_dirty_state dirty_state)
inline

◆ apply() [1/2]

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
void PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::apply ( function_type  fct)
inline

◆ apply() [2/2]

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
void PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::apply ( processor_type proc)
inline

◆ apply_all() [1/2]

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
void PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::apply_all ( function_type  fct)
inline

◆ apply_all() [2/2]

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
void PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::apply_all ( processor_type proc)
inline

◆ cleanup()

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
void PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::cleanup ( void  )
inline

◆ deallocate()

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
void PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::deallocate ( value_type safe_pfs)
inline

◆ get() [1/2]

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
value_type * PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::get ( uint  index)
inline

◆ get() [2/2]

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
value_type * PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::get ( uint  index,
bool *  has_more 
)
inline

◆ get_memory()

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
size_t PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::get_memory ( )
inline

◆ get_page_logical_size()

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
uint PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::get_page_logical_size ( uint  page_index)
inlineprivate

◆ get_row_count()

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
size_t PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::get_row_count ( )
inline

◆ get_row_size()

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
size_t PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::get_row_size ( ) const
inline

◆ init()

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
int PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::init ( long  max_size)
inline

◆ iterate() [1/2]

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
iterator_type PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::iterate ( )
inline

◆ iterate() [2/2]

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
iterator_type PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::iterate ( uint  index)
inline

◆ sanitize()

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
value_type * PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::sanitize ( value_type unsafe)
inline

◆ scan_next()

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
value_type * PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::scan_next ( uint index,
uint found_index 
)
inlineprivate

◆ static_deallocate()

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
static void PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::static_deallocate ( value_type safe_pfs)
inlinestatic

Friends And Related Function Documentation

◆ PFS_buffer_scalable_iterator< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
friend class PFS_buffer_scalable_iterator< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >
friend

Member Data Documentation

◆ m_allocator

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
std::atomic<allocator_type *> PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::m_allocator {nullptr}
private

Buffer allocator.

Concurrency profile:

  • written once on buffer creation
  • read only during normal operations.

◆ m_critical_section

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
native_mutex_t PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::m_critical_section
private

◆ m_full

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
std::atomic<bool> PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::m_full {false}
private

Buffer full flag.

Concurrency profile:

  • mostly read during normal operations.
  • do not perform useless write, check for previous value first
  • occasional write on state changes

◆ m_initialized

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
std::atomic<bool> PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::m_initialized {false}
private

Initialized full flag.

Concurrency profile:

  • write in init / cleanup
  • readonly during normal operations

◆ m_last_page_size

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
std::atomic<size_t> PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::m_last_page_size {0}
private

Size of the last page.

Concurrency profile:

  • written once on buffer creation
  • read only during normal operations.

◆ m_lost

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
ulong PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::m_lost

◆ m_max

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
std::atomic<size_t> PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::m_max {0}
private

Max number of items in the buffer.

Concurrency profile:

  • written once on page creation
  • read only during normal operations.

◆ m_max_page_count

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
std::atomic<size_t> PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::m_max_page_count {0}
private

Max number of pages.

Concurrency profile:

  • written once on buffer creation
  • read only during normal operations.

◆ m_max_page_index

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
PFS_cacheline_atomic_size_t PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::m_max_page_index
private

Current page index.

Concurrency profile:

  • occasional write on buffer extend
  • mostly read otherwise

◆ m_monotonic

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
PFS_cacheline_atomic_size_t PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::m_monotonic
private

Monotonic page counter.

This counter is used to access pages in the array.

Concurrency profile:

  • frequent read and write, must be on its own cacheline

◆ m_pages

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
std::atomic<array_type *> PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::m_pages[PFS_PAGE_COUNT]
private

Array of pages.

Concurrency profile:

  • occasional write on buffer extend
  • mostly read otherwise

◆ MAX_SIZE

template<class T , int PFS_PAGE_SIZE, int PFS_PAGE_COUNT, class U = PFS_buffer_default_array<T>, class V = PFS_buffer_default_allocator<T>>
const size_t PFS_buffer_scalable_container< T, PFS_PAGE_SIZE, PFS_PAGE_COUNT, U, V >::MAX_SIZE = PFS_PAGE_SIZE * PFS_PAGE_COUNT
static

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