10 #include <type_traits>
12 #include <rmm/error.hpp>
82 [[nodiscard]] std::int64_t
total(
172 std::int64_t highest_peak_{0};
176 std::is_trivially_copyable_v<ScopedMemoryRecord>,
177 "ScopedMemoryRecord must be trivially copyable"
RAPIDS Multi-Processor interfaces.
Memory statistics for a specific scope.
ScopedMemoryRecord & add_subscope(ScopedMemoryRecord const &subscope)
Merge the memory statistics of a subscope into this record.
void record_allocation(AllocType alloc_type, std::int64_t nbytes)
Records a memory allocation event.
std::array< std::int64_t, 2 > AllocTypeArray
Array type for storing per-allocator statistics.
std::int64_t peak(AllocType alloc_type=AllocType::ALL) const noexcept
Returns the peak memory usage (in bytes) for the specified allocator type.
void record_deallocation(AllocType alloc_type, std::int64_t nbytes)
Records a memory deallocation event.
AllocType
Allocation source types.
@ PRIMARY
The primary allocator (first-choice allocator).
@ ALL
Aggregated statistics from both primary and fallback allocators.
@ FALLBACK
The fallback allocator (used when the primary fails).
ScopedMemoryRecord & add_scope(ScopedMemoryRecord const &scope)
Merge the memory statistics of another scope into this one.
std::int64_t total(AllocType alloc_type=AllocType::ALL) const noexcept
Returns the total number of bytes allocated.
std::int64_t num_current_allocs(AllocType alloc_type=AllocType::ALL) const noexcept
Returns the number of currently active (non-deallocated) allocations for the specified allocator type...
std::int64_t current(AllocType alloc_type=AllocType::ALL) const noexcept
Returns the current memory usage in bytes for the specified allocator type.
std::int64_t num_total_allocs(AllocType alloc_type=AllocType::ALL) const noexcept
Returns the total number of allocations performed by the specified allocator type.