Represents a single tracked statistic.
More...
#include <statistics.hpp>
|
|
| Stat ()=default |
| | Default-constructs a Stat.
|
| |
| | Stat (std::size_t count, double value, double max) |
| | Constructs a Stat with explicit field values. More...
|
| |
| auto | operator<=> (Stat const &) const noexcept=default |
| | Three-way comparison operator. More...
|
| |
| void | add (double value) |
| | Adds a value to this statistic. More...
|
| |
| std::size_t | count () const noexcept |
| | Returns the number of updates applied to this statistic. More...
|
| |
| double | value () const noexcept |
| | Returns the total accumulated value. More...
|
| |
| double | max () const noexcept |
| | Returns the maximum value seen across all add() calls. More...
|
| |
| std::uint8_t * | serialize (std::uint8_t *out) const |
| | Serializes this Stat to a byte buffer. More...
|
| |
| Stat | merge (Stat const &other) const |
| | Merges another Stat into this one, returning the combined result. More...
|
| |
|
| static constexpr std::size_t | serialized_size () noexcept |
| | Returns the serialized size of this Stat in bytes. More...
|
| |
| static std::pair< Stat, std::span< std::uint8_t const > > | deserialize (std::span< std::uint8_t const > data) |
| | Deserializes a Stat from a byte buffer. More...
|
| |
Represents a single tracked statistic.
- Note
- Stat is not thread-safe. Thread safety is provided by the enclosing Statistics object's mutex.
Definition at line 292 of file statistics.hpp.
◆ Stat()
| rapidsmpf::Statistics::Stat::Stat |
( |
std::size_t |
count, |
|
|
double |
value, |
|
|
double |
max |
|
) |
| |
Constructs a Stat with explicit field values.
- Parameters
-
| count | Number of updates. |
| value | Total accumulated value. |
| max | Maximum value seen. |
◆ add()
| void rapidsmpf::Statistics::Stat::add |
( |
double |
value | ) |
|
Adds a value to this statistic.
- Parameters
-
◆ count()
| std::size_t rapidsmpf::Statistics::Stat::count |
( |
| ) |
const |
|
noexcept |
Returns the number of updates applied to this statistic.
- Returns
- The number of times
add() was called.
◆ deserialize()
| static std::pair<Stat, std::span<std::uint8_t const> > rapidsmpf::Statistics::Stat::deserialize |
( |
std::span< std::uint8_t const > |
data | ) |
|
|
static |
Deserializes a Stat from a byte buffer.
- Parameters
-
- Returns
- A pair of the deserialized Stat and the remaining unconsumed bytes.
- Exceptions
-
| std::invalid_argument | If the data is truncated. |
◆ max()
| double rapidsmpf::Statistics::Stat::max |
( |
| ) |
const |
|
noexcept |
Returns the maximum value seen across all add() calls.
- Returns
- The maximum value added, or negative infinity if
add() was never called.
◆ merge()
| Stat rapidsmpf::Statistics::Stat::merge |
( |
Stat const & |
other | ) |
const |
Merges another Stat into this one, returning the combined result.
Counts and values are summed; the maximum is taken.
- Parameters
-
| other | The Stat to merge with. |
- Returns
- A new Stat containing the merged result.
◆ operator<=>()
| auto rapidsmpf::Statistics::Stat::operator<=> |
( |
Stat const & |
| ) |
const |
|
defaultnoexcept |
Three-way comparison operator.
Performs memberwise comparison of all data members.
- Returns
- The ordering result of the memberwise comparison.
◆ serialize()
| std::uint8_t* rapidsmpf::Statistics::Stat::serialize |
( |
std::uint8_t * |
out | ) |
const |
Serializes this Stat to a byte buffer.
- Parameters
-
| out | Pointer to the output buffer. Must have at least serialized_size() bytes available. |
- Returns
- Pointer past the last byte written.
◆ serialized_size()
| static constexpr std::size_t rapidsmpf::Statistics::Stat::serialized_size |
( |
| ) |
|
|
inlinestaticconstexprnoexcept |
Returns the serialized size of this Stat in bytes.
We size each field individually rather than using sizeof(Stat) to avoid platform-dependent struct padding.
- Returns
- The number of bytes needed to serialize this Stat.
Definition at line 354 of file statistics.hpp.
◆ value()
| double rapidsmpf::Statistics::Stat::value |
( |
| ) |
const |
|
noexcept |
Returns the total accumulated value.
- Returns
- The sum of all values added.
The documentation for this class was generated from the following file: