Track statistics across rapidsmpf operations.
More...
#include <statistics.hpp>
|
| using | Formatter = std::function< void(std::ostream &, std::size_t, double)> |
| | Type alias for a statistics formatting function. More...
|
| |
Track statistics across rapidsmpf operations.
Definition at line 23 of file statistics.hpp.
◆ Formatter
Type alias for a statistics formatting function.
The formatter is called with the output stream, update count, and accumulated value.
Definition at line 101 of file statistics.hpp.
◆ Statistics() [1/3]
| rapidsmpf::Statistics::Statistics |
( |
bool |
enabled = true | ) |
|
Constructs a Statistics object without memory profiling.
- Parameters
-
| enabled | If true, enables tracking of statistics. If false, all operations are no-ops. |
◆ Statistics() [2/3]
Constructs a Statistics object with memory profiling enabled.
Automatically enables both statistics and memory profiling.
- Parameters
-
| mr | Pointer to a memory resource used for memory profiling. |
- Exceptions
-
| std::invalid_argument | If mr is the nullptr. |
◆ Statistics() [3/3]
| rapidsmpf::Statistics::Statistics |
( |
Statistics && |
o | ) |
|
|
inlinenoexcept |
◆ add_bytes_stat()
| std::size_t rapidsmpf::Statistics::add_bytes_stat |
( |
std::string const & |
name, |
|
|
std::size_t |
nbytes |
|
) |
| |
Adds a byte count to the named statistic.
Uses a formatter that formats values as human-readable byte sizes.
- Parameters
-
| name | Name of the statistic. |
| nbytes | Number of bytes to add. |
- Returns
- The updated byte total.
◆ add_duration_stat()
| Duration rapidsmpf::Statistics::add_duration_stat |
( |
std::string const & |
name, |
|
|
Duration |
seconds |
|
) |
| |
Adds a duration to the named statistic.
Uses a formatter that formats values as time durations in seconds.
- Parameters
-
| name | Name of the statistic. |
| seconds | Duration in seconds to add. |
- Returns
- The updated total duration.
◆ add_stat()
| double rapidsmpf::Statistics::add_stat |
( |
std::string const & |
name, |
|
|
double |
value, |
|
|
Formatter const & |
formatter = FormatterDefault |
|
) |
| |
Adds a numeric value to the named statistic.
Creates the statistic if it doesn't exist.
- Parameters
-
| name | Name of the statistic. |
| value | Value to add. |
| formatter | Optional formatter to use for this statistic. |
- Returns
- Updated total value.
◆ clear()
| void rapidsmpf::Statistics::clear |
( |
| ) |
|
Clears all statistics.
Memory profiling records are not cleared.
◆ create_memory_recorder()
| MemoryRecorder rapidsmpf::Statistics::create_memory_recorder |
( |
std::string |
name | ) |
|
Creates a scoped memory recorder for the given name.
If memory profiling is not enabled, returns a no-op recorder.
- Parameters
-
- Returns
- A MemoryRecorder instance.
◆ disabled()
| static std::shared_ptr<Statistics> rapidsmpf::Statistics::disabled |
( |
| ) |
|
|
static |
Returns a shared pointer to a disabled (no-op) Statistics instance.
Useful when you need to pass a Statistics reference but do not want to collect any data.
- Returns
- A shared pointer to a Statistics instance with tracking disabled.
◆ enabled()
| bool rapidsmpf::Statistics::enabled |
( |
| ) |
const |
|
inlinenoexcept |
Checks if statistics tracking is enabled.
- Returns
- True if statistics tracking is active, otherwise False.
Definition at line 83 of file statistics.hpp.
◆ FormatterDefault()
| static void rapidsmpf::Statistics::FormatterDefault |
( |
std::ostream & |
os, |
|
|
std::size_t |
count, |
|
|
double |
val |
|
) |
| |
|
static |
Default formatter for statistics output (implements Formatter).
Prints the total value and, if count > 1, also prints the average.
- Parameters
-
| os | Output stream to write the formatted result to. |
| count | Number of updates to the statistic. |
| val | Accumulated value. |
◆ get_memory_records()
| std::unordered_map<std::string, MemoryRecord> const& rapidsmpf::Statistics::get_memory_records |
( |
| ) |
const |
Retrieves all memory profiling records stored by this instance.
- Returns
- A reference to a map from record name to memory usage data.
◆ get_stat()
| Stat rapidsmpf::Statistics::get_stat |
( |
std::string const & |
name | ) |
const |
Retrieves a statistic by name.
- Parameters
-
| name | Name of the statistic. |
- Returns
- The requested statistic.
◆ is_memory_profiling_enabled()
| bool rapidsmpf::Statistics::is_memory_profiling_enabled |
( |
| ) |
const |
Checks whether memory profiling is enabled.
- Returns
- True if memory profiling is active, otherwise False.
◆ list_stat_names()
| std::vector<std::string> rapidsmpf::Statistics::list_stat_names |
( |
| ) |
const |
Get the names of all statistics.
- Returns
- A vector of all statistic names.
◆ operator=()
Move assignment operator.
- Parameters
-
- Returns
- Reference to this updated instance.
Definition at line 72 of file statistics.hpp.
◆ report()
| std::string rapidsmpf::Statistics::report |
( |
std::string const & |
header = "Statistics:" | ) |
const |
Generates a formatted report of all collected statistics.
- Parameters
-
| header | An optional header to prepend to the report. |
- Returns
- A string containing the formatted statistics.
The documentation for this class was generated from the following file: