template<Allocator A>
class nda::mem::stats< A >
Wrap an allocator to gather statistics about memory allocation.
It gathers a histogram of the different allocation sizes. The histogram is a std::vector of size 65, where element \( i \in \{0,...,63\} \) contains the number of allocations with a size in the range \( [2^{64-i-1}, 2^{64-i}) \) and the last element contains the number of allocations of size zero.
- Template Parameters
-
Definition at line 560 of file allocators.hpp.
|
|
| stats ()=default |
| | Default constructor.
|
|
| stats (stats &&)=default |
| | Default move constructor.
|
|
| stats (stats const &)=delete |
| | Deleted copy constructor.
|
|
| ~stats () |
| | Destructor that outputs the statistics about the memory allocation in debug mode.
|
| blk_t | allocate (uint64_t s) |
| | Allocate memory and update the histogram.
|
| blk_t | allocate_zero (uint64_t s) |
| | Allocate memory, set it to zero and update the histogram.
|
| void | deallocate (blk_t b) noexcept |
| | Deallocate memory.
|
| auto const & | histogram () const noexcept |
| | Get the histogram of the allocation sizes.
|
|
stats & | operator= (stats &&)=default |
| | Default move assignment operator.
|
|
stats & | operator= (stats const &)=delete |
| | Deleted copy assignment operator.
|
| bool | owns (blk_t b) const noexcept |
| | Check if a given nda::mem::blk_t memory block is owned by the base allocator.
|
| void | print_histogram (std::ostream &os) const |
| | Print the histogram to a std::ostream.
|