Resource that uses an upstream resource to allocate memory and tracks allocation statistics (current, peak, total bytes and allocation counts).
More...
#include <statistics_resource_adaptor.hpp>
|
|
using | counter = detail::statistics_resource_adaptor_impl::counter |
| | Counter type tracking current, peak, and total bytes or allocations.
|
| |
|
using | read_lock_t = detail::statistics_resource_adaptor_impl::read_lock_t |
| | Shared-reader lock type used to protect the counter stack.
|
| |
|
using | write_lock_t = detail::statistics_resource_adaptor_impl::write_lock_t |
| | Exclusive-writer lock type used to protect the counter stack.
|
| |
Resource that uses an upstream resource to allocate memory and tracks allocation statistics (current, peak, total bytes and allocation counts).
Supports nested statistics via push_counters()/pop_counters(). Intended as a debug adaptor.
This class is copyable and shares ownership of its internal state via cuda::mr::shared_resource.
◆ statistics_resource_adaptor()
| rmm::mr::statistics_resource_adaptor::statistics_resource_adaptor |
( |
cuda::mr::any_resource< cuda::mr::device_accessible > |
upstream | ) |
|
|
explicit |
Construct a statistics resource adaptor using upstream to satisfy allocation requests.
- Parameters
-
| upstream | The resource used for allocating/deallocating device memory. |
◆ get_allocations_counter()
| counter rmm::mr::statistics_resource_adaptor::get_allocations_counter |
( |
| ) |
const |
|
noexcept |
Returns a counter struct for number of allocations since construction (or last push).
- Returns
- counter containing current, peak, and total allocation counts
◆ get_bytes_counter()
| counter rmm::mr::statistics_resource_adaptor::get_bytes_counter |
( |
| ) |
const |
|
noexcept |
Returns a counter struct for bytes allocated since construction (or last push).
- Returns
- counter containing current, peak, and total byte counts
◆ get_upstream_resource()
◆ pop_counters()
| std::pair<counter, counter> rmm::mr::statistics_resource_adaptor::pop_counters |
( |
| ) |
|
Pop a pair of counters from the stack.
- Returns
- pair of counters (bytes, allocations) from the top before the pop
- Exceptions
-
| std::out_of_range | if the counter stack has fewer than two entries |
◆ push_counters()
| std::pair<counter, counter> rmm::mr::statistics_resource_adaptor::push_counters |
( |
| ) |
|
Push a pair of zero counters — new counters start fresh.
- Returns
- pair of counters (bytes, allocations) from the top before the push
The documentation for this class was generated from the following file: