|
timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
|
allocator that uses array of (ring) buffers to coalesce memory. Requires This allocator propagates on container swap and container move assignment. Use TIMEMORY_RING_BUFFER_ALLOCATOR_BUFFER_COUNT env variable to specify the default number of allocations or use the set_buffer_count / set_buffer_count_cb. When a reserve is requested and the request is greater than the free spaces in the buffer, the free spaces are stored in a "dangling" array of spaces which are used when single allocations are requested.
More...
#include "timemory/data/ring_buffer_allocator.hpp"
Collaboration diagram for tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >:Classes | |
| struct | rebind |
Public Types | |
| using | value_type = Tp |
| using | pointer = Tp * |
| using | reference = Tp & |
| using | const_pointer = const Tp * |
| using | const_reference = const Tp & |
| using | size_type = size_t |
| using | difference_type = ptrdiff_t |
| using | base_type = std::allocator< Tp > |
| using | buffer_type = data_storage::ring_buffer< Tp > |
| using | propagate_on_container_move_assignment = std::true_type |
| using | propagate_on_container_swap = std::true_type |
Public Member Functions | |
| ring_buffer_allocator ()=default | |
| ~ring_buffer_allocator ()=default | |
| ring_buffer_allocator (const ring_buffer_allocator &)=default | |
| ring_buffer_allocator (ring_buffer_allocator &&) noexcept=default | |
| ring_buffer_allocator & | operator= (const ring_buffer_allocator &)=default |
| ring_buffer_allocator & | operator= (ring_buffer_allocator &&) noexcept=default |
| bool | operator== (const ring_buffer_allocator &rhs) const |
| bool | operator!= (const ring_buffer_allocator &rhs) const |
| Tp * | address (Tp &_r) const |
| const Tp * | address (const Tp &_r) const |
| size_t | max_size () const |
| void | construct (Tp *const _p, const Tp &_v) const |
| void | construct (Tp *const _p, Tp &&_v) const |
| template<typename... ArgsT> | |
| void | construct (Tp *const _p, ArgsT &&... _args) const |
| void | destroy (Tp *const _p) const |
| Tp * | allocate (const size_t n) const |
| void | deallocate (Tp *const ptr, const size_t n) const |
| Tp * | allocate (const size_t n, const void *const) const |
| void | reserve (const size_t n) |
| void | steal_resources (ring_buffer_allocator &rhs) |
| transfers the buffers to another allocator More... | |
Static Public Member Functions | |
| template<typename FuncT > | |
| static void | set_buffer_count_cb (FuncT &&_f) |
| define a callback function for initializing the buffer size. Will throw if a request for the buffer size has already occured. More... | |
| static void | set_buffer_count (size_t _buff_sz) |
| set the minimum number of objects for the ring buffer. Will throw if a request for the buffer size has already occured. More... | |
allocator that uses array of (ring) buffers to coalesce memory. Requires This allocator propagates on container swap and container move assignment. Use TIMEMORY_RING_BUFFER_ALLOCATOR_BUFFER_COUNT env variable to specify the default number of allocations or use the set_buffer_count / set_buffer_count_cb. When a reserve is requested and the request is greater than the free spaces in the buffer, the free spaces are stored in a "dangling" array of spaces which are used when single allocations are requested.
| Tp | The data type for the allocator |
| MMapV | Whether to use mmap (if available) |
| BuffCntV | The default buffer count (will be rounded up to multiple of page size) |
Definition at line 57 of file ring_buffer_allocator.hpp.
| struct tim::data::ring_buffer_allocator::rebind |
Definition at line 99 of file ring_buffer_allocator.hpp.
Collaboration diagram for tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::rebind< U >:| Class Members | ||
|---|---|---|
| typedef ring_buffer_allocator< U, MMapV, BuffCntV > | other | |
| using tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::base_type = std::allocator<Tp> |
Definition at line 68 of file ring_buffer_allocator.hpp.
| using tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::buffer_type = data_storage::ring_buffer<Tp> |
Definition at line 69 of file ring_buffer_allocator.hpp.
| using tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::const_pointer = const Tp* |
Definition at line 64 of file ring_buffer_allocator.hpp.
| using tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::const_reference = const Tp& |
Definition at line 65 of file ring_buffer_allocator.hpp.
| using tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::difference_type = ptrdiff_t |
Definition at line 67 of file ring_buffer_allocator.hpp.
| using tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::pointer = Tp* |
Definition at line 62 of file ring_buffer_allocator.hpp.
| using tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::propagate_on_container_move_assignment = std::true_type |
Definition at line 70 of file ring_buffer_allocator.hpp.
| using tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::propagate_on_container_swap = std::true_type |
Definition at line 71 of file ring_buffer_allocator.hpp.
| using tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::reference = Tp& |
Definition at line 63 of file ring_buffer_allocator.hpp.
| using tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::size_type = size_t |
Definition at line 66 of file ring_buffer_allocator.hpp.
| using tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::value_type = Tp |
Definition at line 61 of file ring_buffer_allocator.hpp.
|
default |
|
default |
|
default |
|
defaultnoexcept |
|
inline |
Definition at line 89 of file ring_buffer_allocator.hpp.
|
inline |
Definition at line 88 of file ring_buffer_allocator.hpp.
|
inline |
Definition at line 116 of file ring_buffer_allocator.hpp.
References tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::max_size().
Referenced by tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::allocate().
|
inline |
Definition at line 182 of file ring_buffer_allocator.hpp.
References tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::allocate().
|
inline |
|
inline |
Definition at line 104 of file ring_buffer_allocator.hpp.
|
inline |
Definition at line 106 of file ring_buffer_allocator.hpp.
|
inline |
Definition at line 169 of file ring_buffer_allocator.hpp.
|
inline |
Definition at line 114 of file ring_buffer_allocator.hpp.
|
inline |
Definition at line 91 of file ring_buffer_allocator.hpp.
Referenced by tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::allocate().
|
inline |
Definition at line 85 of file ring_buffer_allocator.hpp.
|
default |
|
defaultnoexcept |
|
inline |
Definition at line 84 of file ring_buffer_allocator.hpp.
|
inline |
Definition at line 187 of file ring_buffer_allocator.hpp.
|
inlinestatic |
set the minimum number of objects for the ring buffer. Will throw if a request for the buffer size has already occured.
Definition at line 201 of file ring_buffer_allocator.hpp.
References tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::set_buffer_count_cb().
|
inlinestatic |
define a callback function for initializing the buffer size. Will throw if a request for the buffer size has already occured.
Definition at line 192 of file ring_buffer_allocator.hpp.
Referenced by tim::data::ring_buffer_allocator< Tp, MMapV, BuffCntV >::set_buffer_count().
|
inline |
transfers the buffers to another allocator
Definition at line 207 of file ring_buffer_allocator.hpp.