Template Numerical Library: TNL::Benchmarks::BenchmarkResult Struct Reference

Template Numerical Library version\ main:0b2c40fb1

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
TNL::Benchmarks::BenchmarkResult Struct Reference

Container for benchmark measurement results. More...

`#include <TNL/Benchmarks/BenchmarkResult.h>`

Collaboration diagram for TNL::Benchmarks::BenchmarkResult:
[legend]

## Public Types
using | HeaderElements = Logging::HeaderElements
using | RowElements = Logging::RowElements

## Public Member Functions
virtual RowElements | getRowElements () const
| Returns formatted row data for logging.
virtual HeaderElements | getTableHeader () const
| Returns table header column names.
virtual void | setDerivedResults (double datasetSize, double baseTime, std::size_t operationsPerLoop)
| Computes derived metrics from raw timing data.
virtual void | setTimeResults (std::size_t loops_, double time_, double time_median_, double time_stddev_, double cpu_cycles_, double cpu_cycles_median_, double cpu_cycles_stddev_)
| Stores raw timing results.

## Public Attributes
double | bandwidth = std::numeric_limits< double >::quiet_NaN()
double | cpu_cycles = std::numeric_limits< double >::quiet_NaN()
double | cpu_cycles_median = std::numeric_limits< double >::quiet_NaN()
double | cpu_cycles_per_operation = 0
double | cpu_cycles_stddev = std::numeric_limits< double >::quiet_NaN()
std::size_t | loops = 0
std::size_t | operations_per_loop = 0
double | speedup = std::numeric_limits< double >::quiet_NaN()
double | time = std::numeric_limits< double >::quiet_NaN()
double | time_median = std::numeric_limits< double >::quiet_NaN()
double | time_stddev = std::numeric_limits< double >::quiet_NaN()

## Detailed Description

Container for benchmark measurement results.

Stores timing data and derived metrics from benchmark runs. The class supports virtual methods to allow derived classes to customize result storage and formatting.

Measured values:

- loops: Number of iterations executed
- time: Mean execution time per iteration
- time_median: Median execution time per iteration
- time_stddev: Standard deviation of execution time
- cpu_cycles: Mean CPU cycles per iteration (host devices only)
- cpu_cycles_median: Median CPU cycles per iteration (host devices only)
- cpu_cycles_stddev: Standard deviation of CPU cycles

Derived values (computed by setDerivedResults):

- bandwidth: Dataset size divided by execution time (GB/s)
- speedup: Baseline time divided by execution time
- cpu_cycles_per_operation: CPU cycles divided by operations per loop

## Member Function Documentation

## ◆ getRowElements()

virtual RowElements TNL::Benchmarks::BenchmarkResult::getRowElements | ( |  | ) | const
| inlinenodiscardvirtual

Returns formatted row data for logging.

Formats all result values as strings using scientific notation for floating-point values. Missing or invalid values are shown as "N/A".

Returns
  LoggingRowElements containing formatted string values

## ◆ getTableHeader()

virtual HeaderElements TNL::Benchmarks::BenchmarkResult::getTableHeader | ( |  | ) | const
| inlinenodiscardvirtual

Returns table header column names.

Returns
  Vector of column names in display order

## ◆ setDerivedResults()

virtual void TNL::Benchmarks::BenchmarkResult::setDerivedResults | ( | double | datasetSize,
|  | double | baseTime,
|  | std::size_t | operationsPerLoop )
| inlinevirtual

Computes derived metrics from raw timing data.

Must be called after setTimeResults. Calculates bandwidth, speedup, and cycles per operation based on dataset size, baseline time, and operation count.

Parameters

  datasetSize | Dataset size in gigabytes
  baseTime | Baseline time for speedup calculation
  operationsPerLoop | Number of operations performed per iteration

## ◆ setTimeResults()

virtual void TNL::Benchmarks::BenchmarkResult::setTimeResults | ( | std::size_t | loops_,
|  | double | time_,
|  | double | time_median_,
|  | double | time_stddev_,
|  | double | cpu_cycles_,
|  | double | cpu_cycles_median_,
|  | double | cpu_cycles_stddev_ )
| inlinevirtual

Stores raw timing results.

Called by timeFunction after completing all iterations. Derived classes can override to customize how timing data is stored.

Parameters

  loops_ | Number of iterations executed
  time_ | Mean execution time per iteration
  time_median_ | Median execution time per iteration
  time_stddev_ | Standard deviation of execution time
  cpu_cycles_ | Mean CPU cycles per iteration
  cpu_cycles_median_ | Median CPU cycles per iteration
  cpu_cycles_stddev_ | Standard deviation of CPU cycles

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

- src/TNL/Benchmarks/BenchmarkResult.h