Utility struct for counting the current, peak, and total value of a number.
More...
#include <statistics_resource_adaptor.hpp>
|
int64_t | value {0} |
| Current value.
|
|
int64_t | peak {0} |
| Max value of value
|
|
int64_t | total {0} |
| Sum of all added values.
|
|
template<typename Upstream>
struct rmm::mr::statistics_resource_adaptor< Upstream >::counter
Utility struct for counting the current, peak, and total value of a number.
◆ add_counters_from_tracked_sub_block()
template<typename Upstream >
Add val
to the current value and update the peak value if necessary.
When updating the peak value, we assume that val
is tracking a code block inside the code block tracked by this
. Because nested statistics are cascading, we have to convert val.peak
to the peak it would have been if it was part of the statistics tracked by this
. We do this by adding the current value that was active when val
started tracking such that we get std::max(value + val.peak, peak)
.
- Parameters
-
◆ operator+=()
template<typename Upstream >
Add val
to the current value and update the peak value if necessary.
- Parameters
-
- Returns
- Reference to this object
◆ operator-=()
template<typename Upstream >
Subtract val
from the current value and update the peak value if necessary.
- Parameters
-
- Returns
- Reference to this object
The documentation for this struct was generated from the following file: