5#ifndef MITTELIB_TRACKER_ALLOCATOR_HPP
6#define MITTELIB_TRACKER_ALLOCATOR_HPP
19 [[nodiscard]] std::size_t
current()
const;
20 [[nodiscard]] std::size_t
peak()
const;
34 [[nodiscard]]
static std::string
format_mem(std::size_t bytes);
80 template <
class T,
class U>
85 template <
class T,
class U>
Definition tracker_allocator.hpp:14
mem_counter & operator-=(std::size_t bytes)
Definition tracker_allocator.cpp:46
mem_counter & operator--()
Definition tracker_allocator.cpp:32
std::atomic< std::size_t > _peak
Definition tracker_allocator.hpp:16
mem_counter()
Definition tracker_allocator.cpp:10
std::size_t peak() const
Definition tracker_allocator.cpp:16
std::atomic< std::size_t > _current
Definition tracker_allocator.hpp:15
std::size_t current() const
Definition tracker_allocator.cpp:12
mem_counter & operator+=(std::size_t bytes)
Definition tracker_allocator.cpp:41
static std::string format_mem(std::size_t bytes)
Definition tracker_allocator.cpp:56
mem_counter & operator++()
Definition tracker_allocator.cpp:27
void update_peak(std::size_t new_current)
Definition tracker_allocator.cpp:20
Definition tracker_allocator.hpp:37
static mem_stats & instance()
Definition tracker_allocator.cpp:109
mem_counter const & total() const
Definition tracker_allocator.cpp:123
void allocate(std::size_t bytes)
Definition tracker_allocator.cpp:114
void print_stats() const
Definition tracker_allocator.cpp:70
void deallocate(std::size_t bytes)
Definition tracker_allocator.cpp:119
std::array< mem_counter, 20 > _blocks
Definition tracker_allocator.hpp:38
mem_counter _total
Definition tracker_allocator.hpp:39
mem_counter const & block_by_size(std::size_t bytes) const
Definition tracker_allocator.cpp:126
mem_counter const & by_size(std::size_t bytes) const
Definition tracker_allocator.cpp:95
bool operator!=(tracker_allocator< T > const &x, tracker_allocator< U > const &y) noexcept
Definition tracker_allocator.hpp:86
bool operator==(tracker_allocator< T > const &, tracker_allocator< U > const &) noexcept
Definition tracker_allocator.hpp:81
Definition tracker_allocator.hpp:58
void deallocate(value_type *p, std::size_t n)
Definition tracker_allocator.hpp:73
T value_type
Definition tracker_allocator.hpp:59
value_type * allocate(std::size_t n)
Definition tracker_allocator.hpp:68
tracker_allocator() noexcept=default