Template Numerical Library version\ main:0b2c40f
Loading...
Searching...
No Matches
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::ostreamlog
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
terminalOutput stream (typically std::cout)
verboseVerbosity 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
performerName of implementation being tested
headerElementsColumn names
rowElementsFormatted row values
errorMessageOptional error description

Implements TNL::Benchmarks::Logging.

◆ writeErrorMessage()

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

Logs an error message to terminal.

Parameters
messageError description

Implements TNL::Benchmarks::Logging.


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