simplebench.reporters.csv.reporter package🔗

CSV Reporter package for simplebench.

class simplebench.reporters.csv.reporter.CSVConfig(
*,
name: str | None = None,
description: str | None = None,
sections: Iterable[Section] | None = None,
targets: Iterable[Target] | None = None,
default_targets: Iterable[Target] | None = None,
formats: Iterable[Format] | None = None,
choices: ChoicesConf | None = None,
file_suffix: str | None = None,
file_unique: bool | None = None,
file_append: bool | None = None,
subdir: str | None = None,
)[source]🔗

Bases: ReporterConfig

Configuration for a CSVReporter.

This class inherits from ReporterConfig and provides a type-safe, discoverable interface for overriding the default settings of a CSVReporter.

class simplebench.reporters.csv.reporter.CSVOptions[source]🔗

Bases: ReporterOptions

Class for holding CSV reporter specific options.

This class provides additional configuration options specific to the CSV reporter. It is accessed via the options attribute of a Choice instance or a Case instance.

It is currently only a stub for future expansion.

class simplebench.reporters.csv.reporter.CSVReporter(
config: CSVConfig | None = None,
)[source]🔗

Bases: Reporter

Class 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 of ChoicesConf instances defining the reporter instance, CLI flags, ChoiceConf name, supported Section objects, supported output Target objects, and supported output Format for the reporter.

  • targets (set[Target]) – The supported output targets for the reporter.

  • formats (set[Format]) – The supported output formats for the reporter.

render(
*,
case: Case,
section: Section,
options: ReporterOptions,
) str[source]🔗

Renders the benchmark results as tagged CSV data and returns it as a string.

Parameters:
  • case (Case) – The Case instance representing the benchmarked code.

  • section (Section) – The section to output (eg. OPS or TIMING).

  • options (ReporterOptions) – The options for the CSV report. (Currently unused.)

Returns:

The benchmark results formatted as tagged CSV data.

Return type:

str

Raises:

SimpleBenchValueError – If the specified section is unsupported.

Subpackages🔗

Submodules🔗