simplebench.reporters.csv.reporter.reporter module🔗
Reporter for benchmark results using CSV files.
This module provides the CSVReporter class, which is responsible for
outputting benchmark results to CSV files.
- class simplebench.reporters.csv.reporter.reporter.CSVReporter( )[source]🔗
Bases:
ReporterClass for outputting benchmark results to CSV files.
It supports reporting statistics for various sections, either separately or together, to the filesystem, via a callback function, or to the console in CSV format.
The CSV files are tagged with metadata comments including the case title, description, and units for clarity.
- Defined command-line flags:
–csv: {file, console, callback} (default=file) Outputs results to CSV.
program.py --csv # Outputs results to CSV files in the filesystem (default). program.py --csv filesystem # Outputs results to CSV files in the filesystem. program.py --csv console # Outputs results to the console in CSV format. program.py --csv callback # Outputs results via a callback function in CSV format. program.py --csv filesystem console # Outputs results to both CSV files and the console.
- Variables:
name (str) – The unique identifying name of the reporter.
description (str) – A brief description of the reporter.
choices (Iterable[
ChoicesConf]) – Iterable ofChoicesConfinstances defining the reporter instance, CLI flags,ChoiceConfname, supportedSectionobjects, supported outputTargetobjects, and supported outputFormatfor the reporter.targets (set[
Target]) – The supported output targets for the reporter.formats (set[
Format]) – The supported output formats for the reporter.
Initialize the
CSVReporter.Note
The exception documentation below refers to validation of subclass configuration class variables
_OPTIONS_TYPEand_OPTIONS_KWARGS. These must be correctly defined in any subclass ofCSVReporterto ensure proper functionality.- Parameters:
config (CSVConfig | None) – An optional configuration object to override default reporter settings. If not provided, default settings will be used.
- Raises:
SimpleBenchTypeError – If the subclass configuration types are invalid.
SimpleBenchValueError – If the subclass configuration values are invalid.
- render(
- *,
- case: Case,
- section: Section,
- options: ReporterOptions,
Renders the benchmark results as tagged CSV data and returns it as a string.
- Parameters:
- Returns:
The benchmark results formatted as tagged CSV data.
- Raises:
SimpleBenchValueError – If the specified section is unsupported.