jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
jau::counting_allocator< T > Struct Template Reference

Performance counter std::allocator specialization. More...

#include <counting_allocator.hpp>

Inheritance diagram for jau::counting_allocator< T >:
Collaboration diagram for jau::counting_allocator< T >:

Classes

struct  rebind
 

Public Types

typedef T value_type
 

Public Member Functions

 counting_allocator () noexcept
 
 counting_allocator (const counting_allocator &other) noexcept
 
template<typename U >
 counting_allocator (const counting_allocator< U > &other) noexcept
 
 ~counting_allocator ()=default
 
value_typeallocate (std::size_t n)
 
value_typeallocate (std::size_t n, const void *hint)
 
void deallocate (value_type *p, std::size_t n)
 
std::string toString (const nsize_t mem_width=0, const nsize_t count_width=0)
 

Public Attributes

ssize_t alloc_balance
 
std::size_t alloc_count
 
std::size_t dealloc_count
 
std::size_t memory_usage
 
bool old_stats
 

Detailed Description

template<class T>
struct jau::counting_allocator< T >

Performance counter std::allocator specialization.

This class shall be compliant with C++ named requirements for Allocator.

Not overriding deprecated (C++17) and removed (C++20) methods: address(), max_size(), construct() and destroy().

Definition at line 47 of file counting_allocator.hpp.

Member Typedef Documentation

◆ value_type

template<class T >
typedef T jau::counting_allocator< T >::value_type

Definition at line 53 of file counting_allocator.hpp.

Constructor & Destructor Documentation

◆ counting_allocator() [1/3]

template<class T >
jau::counting_allocator< T >::counting_allocator ( )
inlinenoexcept

Definition at line 94 of file counting_allocator.hpp.

◆ counting_allocator() [2/3]

template<class T >
jau::counting_allocator< T >::counting_allocator ( const counting_allocator< T > &  other)
inlinenoexcept

Definition at line 111 of file counting_allocator.hpp.

◆ counting_allocator() [3/3]

template<class T >
template<typename U >
jau::counting_allocator< T >::counting_allocator ( const counting_allocator< U > &  other)
inlinenoexcept

Definition at line 133 of file counting_allocator.hpp.

◆ ~counting_allocator()

template<class T >
jau::counting_allocator< T >::~counting_allocator ( )
default

Member Function Documentation

◆ toString()

template<class T >
std::string jau::counting_allocator< T >::toString ( const nsize_t  mem_width = 0,
const nsize_t  count_width = 0 
)
inline

Definition at line 88 of file counting_allocator.hpp.

◆ allocate() [1/2]

template<class T >
value_type * jau::counting_allocator< T >::allocate ( std::size_t  n,
const void *  hint 
)
inline

Definition at line 150 of file counting_allocator.hpp.

◆ allocate() [2/2]

template<class T >
value_type * jau::counting_allocator< T >::allocate ( std::size_t  n)
inline

Definition at line 168 of file counting_allocator.hpp.

◆ deallocate()

template<class T >
void jau::counting_allocator< T >::deallocate ( value_type p,
std::size_t  n 
)
inline

Definition at line 186 of file counting_allocator.hpp.

Member Data Documentation

◆ old_stats

template<class T >
bool jau::counting_allocator< T >::old_stats

Definition at line 56 of file counting_allocator.hpp.

◆ memory_usage

template<class T >
std::size_t jau::counting_allocator< T >::memory_usage

Definition at line 57 of file counting_allocator.hpp.

◆ alloc_count

template<class T >
std::size_t jau::counting_allocator< T >::alloc_count

Definition at line 58 of file counting_allocator.hpp.

◆ dealloc_count

template<class T >
std::size_t jau::counting_allocator< T >::dealloc_count

Definition at line 59 of file counting_allocator.hpp.

◆ alloc_balance

template<class T >
ssize_t jau::counting_allocator< T >::alloc_balance

Definition at line 60 of file counting_allocator.hpp.


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