Template Numerical Library: TNL::Benchmarks::TerminalLogger Class Reference

Template Numerical Library version\ main:16b9213d5

Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
TNL::Benchmarks::TerminalLogger Class Reference

Logger that outputs benchmark results to terminal/console. More...

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

Inheritance diagram for TNL::Benchmarks::TerminalLogger:
[legend]
Collaboration diagram for TNL::Benchmarks::TerminalLogger:
[legend]

## Public Member Functions
| TerminalLogger (std::ostream &terminal, int verbose=1)
| Constructs terminal logger.
void | logResult (const std::string &performer, const HeaderElements &headerElements, const RowElements &rowElements, const std::string &errorMessage="") override
| Logs a benchmark result to terminal.
void | writeErrorMessage (const std::string &message) override
| Logs an error message to terminal.
Public Member Functions inherited from TNL::Benchmarks::Logging
| Logging (std::ostream &log, int verbose=1)
| Constructs logger with output stream.
const MetadataColumns & | getMetadataColumns () const
| Gets current metadata columns.
int | getVerbose () const
| Gets current verbosity level.
virtual void | setMetadataColumns (const MetadataColumns &elements)
| Sets all metadata columns at once.
virtual void | setMetadataElement (const typename MetadataColumns::value_type &element, int insertPosition=-1)
| Updates or adds a single metadata element.
void | setVerbose (int verbose)
| Sets verbosity level.
void | syncMetadata (Logging &other)
| Copies metadata from another logger instance.

## Protected Attributes
MetadataColumns | lastMetadata
Protected Attributes inherited from TNL::Benchmarks::Logging
bool | header_changed = true
std::ostream & | log
MetadataColumns | metadataColumns
int | verbose = 0

## Additional Inherited Members
Public Types inherited from TNL::Benchmarks::Logging
using | HeaderElements = std::vector< std::string >
using | MetadataColumns = std::vector< MetadataElement >
using | MetadataElement = std::pair< std::string, std::string >
using | RowElements = LoggingRowElements

## Detailed Description

Logger that outputs benchmark results to terminal/console.

Provides human-readable output with configurable verbosity:

- Level 0: No output (silent)
- Level 1: Summary with key metrics (time, speedup, bandwidth, loops)
- Level 2+: Full details including all metrics and configuration

Metadata is printed once when it changes, followed by result rows.

Example output (verbose=1):

=== Configuration ===
operation : multiply
precision : double
=== Results ===
CPU : time=4.44e-04 speedup=N/A bandwidth=1.11GB/s loops=10
GPU : time=1.11e-04 speedup=4.0 bandwidth=4.44GB/s loops=10

## Constructor & Destructor Documentation

## ◆ TerminalLogger()

TNL::Benchmarks::TerminalLogger::TerminalLogger | ( | std::ostream & | terminal,
|  | int | verbose = 1 )
| inline

Constructs terminal logger.

Parameters

  terminal | Output stream (typically std::cout)
  verbose | Verbosity level (0=silent, 1=normal, 2=verbose)

## Member Function Documentation

## ◆ logResult()

void TNL::Benchmarks::TerminalLogger::logResult | ( | const std::string & | performer,
|  | const HeaderElements & | headerElements,
|  | const RowElements & | rowElements,
|  | const std::string & | errorMessage = "" )
| inlineoverridevirtual

Logs a benchmark result to terminal.

Prints metadata block header when metadata changes, then the result row. Format varies based on verbosity level.

Parameters

  performer | Name of implementation being tested
  headerElements | Column names
  rowElements | Formatted row values
  errorMessage | Optional error description

Implements TNL::Benchmarks::Logging.

## ◆ writeErrorMessage()

void TNL::Benchmarks::TerminalLogger::writeErrorMessage | ( | const std::string & | message | ) |
| inlineoverridevirtual

Logs an error message to terminal.

Parameters

  message | Error description

Implements TNL::Benchmarks::Logging.

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

- src/TNL/Benchmarks/TerminalLogging.h