All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Public Member Functions | Public Attributes | List of all members
rmm::mr::statistics_resource_adaptor< Upstream >::counter Struct Reference

Utility struct for counting the current, peak, and total value of a number. More...

#include <statistics_resource_adaptor.hpp>

Public Member Functions

counteroperator+= (int64_t val)
 Add val to the current value and update the peak value if necessary. More...
 
counteroperator-= (int64_t val)
 Subtract val from the current value and update the peak value if necessary. More...
 
void add_counters_from_tracked_sub_block (const counter &val)
 Add val to the current value and update the peak value if necessary. More...
 

Public Attributes

int64_t value {0}
 Current value.
 
int64_t peak {0}
 Max value of value
 
int64_t total {0}
 Sum of all added values.
 

Detailed Description

template<typename Upstream>
struct rmm::mr::statistics_resource_adaptor< Upstream >::counter

Utility struct for counting the current, peak, and total value of a number.

Member Function Documentation

◆ add_counters_from_tracked_sub_block()

template<typename Upstream >
void rmm::mr::statistics_resource_adaptor< Upstream >::counter::add_counters_from_tracked_sub_block ( const counter val)
inline

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
valValue to add

◆ operator+=()

template<typename Upstream >
counter& rmm::mr::statistics_resource_adaptor< Upstream >::counter::operator+= ( int64_t  val)
inline

Add val to the current value and update the peak value if necessary.

Parameters
valValue to add
Returns
Reference to this object

◆ operator-=()

template<typename Upstream >
counter& rmm::mr::statistics_resource_adaptor< Upstream >::counter::operator-= ( int64_t  val)
inline

Subtract val from the current value and update the peak value if necessary.

Parameters
valValue to subtract
Returns
Reference to this object

The documentation for this struct was generated from the following file: